Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/distrib/utils/embedded Add support for hybrid MBR/GPT images.
details: https://anonhg.NetBSD.org/src/rev/2cbbeb79fa44
branches: trunk
changeset: 933320:2cbbeb79fa44
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun May 24 18:43:39 2020 +0000
description:
Add support for hybrid MBR/GPT images.
diffstat:
distrib/utils/embedded/files/resize_gpt | 6 +++---
distrib/utils/embedded/mkimage | 24 +++++++++++++++++-------
2 files changed, 20 insertions(+), 10 deletions(-)
diffs (75 lines):
diff -r a562b7d1822a -r 2cbbeb79fa44 distrib/utils/embedded/files/resize_gpt
--- a/distrib/utils/embedded/files/resize_gpt Sun May 24 18:42:48 2020 +0000
+++ b/distrib/utils/embedded/files/resize_gpt Sun May 24 18:43:39 2020 +0000
@@ -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 @@
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 -r a562b7d1822a -r 2cbbeb79fa44 distrib/utils/embedded/mkimage
--- a/distrib/utils/embedded/mkimage Sun May 24 18:42:48 2020 +0000
+++ b/distrib/utils/embedded/mkimage Sun May 24 18:43:39 2020 +0000
@@ -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 @@
resize=false
gpt=false
+gpt_hybrid=false
. "${DIR}/conf/${h}.conf"
release="/usr/obj/${MACHINE}/release"
@@ -271,19 +272,28 @@
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}
Home |
Main Index |
Thread Index |
Old Index