diff options
| author | jmcneill <jmcneill@NetBSD.org> | 2020-05-24 18:43:39 +0000 |
|---|---|---|
| committer | jmcneill <jmcneill@NetBSD.org> | 2020-05-24 18:43:39 +0000 |
| commit | cbc8e374c4b1504c4481802ee0fc1698b8b11950 (patch) | |
| tree | 3aa39baecab68d2a0773a5e557404252b06c5be0 /distrib/utils | |
| parent | 083c8543a1f258e118ea50d417097fbb21cb97c6 (diff) | |
Add support for hybrid MBR/GPT images.
Diffstat (limited to 'distrib/utils')
| -rw-r--r-- | distrib/utils/embedded/files/resize_gpt | 6 | ||||
| -rwxr-xr-x | distrib/utils/embedded/mkimage | 24 |
2 files changed, 20 insertions, 10 deletions
diff --git a/distrib/utils/embedded/files/resize_gpt b/distrib/utils/embedded/files/resize_gpt index d9008a78ab9..537dfcb8fec 100644 --- a/distrib/utils/embedded/files/resize_gpt +++ b/distrib/utils/embedded/files/resize_gpt @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: resize_gpt,v 1.1 2020/05/24 14:45:49 jmcneill Exp $ +# $NetBSD: resize_gpt,v 1.2 2020/05/24 18:43:39 jmcneill Exp $ # # PROVIDE: resize_gpt @@ -28,8 +28,8 @@ resize_gpt_start() BLOCK_DEVICE=$(dkctl ${ROOT_DEVICE} getwedgeinfo | head -1 | sed 's/://' | awk '{ print $3; }') - gpt resizedisk -q ${BLOCK_DEVICE} - gpt resize -a 4m -i 2 -q ${BLOCK_DEVICE} + gpt -H resizedisk -q ${BLOCK_DEVICE} + gpt -H resize -a 4m -i 2 -q ${BLOCK_DEVICE} return } diff --git a/distrib/utils/embedded/mkimage b/distrib/utils/embedded/mkimage index b9dd71a2390..36f325d3e8e 100755 --- a/distrib/utils/embedded/mkimage +++ b/distrib/utils/embedded/mkimage @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: mkimage,v 1.73 2020/05/24 14:45:49 jmcneill Exp $ +# $NetBSD: mkimage,v 1.74 2020/05/24 18:43:39 jmcneill Exp $ # # Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. # All rights reserved. @@ -149,6 +149,7 @@ fi resize=false gpt=false +gpt_hybrid=false . "${DIR}/conf/${h}.conf" release="/usr/obj/${MACHINE}/release" @@ -271,19 +272,28 @@ do done if $gpt; then + if $gpt_hybrid; then + gpt_flags="-H" + fi initsecs=$((${init} * 1024)) bootsecs=$((${boot} * 1024)) ffsstart="$(getsectors ${ffsoffset})" echo ${bar} Clearing existing partitions ${bar} - ${GPT} ${image} destroy || true + ${GPT} ${gpt_flags} ${image} destroy || true echo ${bar} Creating partitions ${bar} - ${GPT} ${image} create ${gpt_create_flags} - ${GPT} ${image} add -b ${initsecs} -s ${bootsecs} -l ${gpt_label_efi:-EFI} -t efi - ${GPT} ${image} set -a required -i 1 - ${GPT} ${image} add -a 4m -b ${ffsstart} -l ${gpt_label_ffs:-netbsd-root} -t ffs - ${GPT} ${image} show + ${GPT} ${gpt_flags} ${image} create ${gpt_create_flags} + ${GPT} ${gpt_flags} ${image} add -b ${initsecs} -s ${bootsecs} -l ${gpt_label_efi:-EFI} -t efi + ${GPT} ${gpt_flags} ${image} set -a required -i 1 + ${GPT} ${gpt_flags} ${image} add -a 4m -b ${ffsstart} -l ${gpt_label_ffs:-netbsd-root} -t ffs + ${GPT} ${gpt_flags} ${image} show + if $gpt_hybrid; then + echo ${bar} Creating hybrid MBR ${bar} + ${FDISK} -f -g -u -0 -a -s ${msdosid}/${initsecs}/${bootsecs} -F ${image} + ${FDISK} -f -g -u -3 -s 238/1/$((${initsecs} - 1)) -F ${image} + ${FDISK} -F ${image} + fi else if [ -n "${msdosid}" ]; then echo ${bar} Running fdisk ${bar} |
