Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/distrib/utils/embedded Improvements and fixes for FAT+FFS im...
details: https://anonhg.NetBSD.org/src/rev/555cb1666a5e
branches: trunk
changeset: 352830:555cb1666a5e
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Tue Apr 11 18:04:08 2017 +0000
description:
Improvements and fixes for FAT+FFS images:
- Add a "NETBSD" volume label to the MSDOS file-system.
- Explicitly initialize boot sector.
- Correct an issue where the MSDOS file-system was larger than the
partition table entry.
- Add NetBSD partition to the MBR partition table.
diffstat:
distrib/utils/embedded/mkimage | 36 +++++++++++++++++++++++++++++++++---
1 files changed, 33 insertions(+), 3 deletions(-)
diffs (66 lines):
diff -r eb89a59254bf -r 555cb1666a5e distrib/utils/embedded/mkimage
--- a/distrib/utils/embedded/mkimage Tue Apr 11 17:59:23 2017 +0000
+++ b/distrib/utils/embedded/mkimage Tue Apr 11 18:04:08 2017 +0000
@@ -1,5 +1,5 @@
#!/bin/sh
-# $NetBSD: mkimage,v 1.62 2017/03/14 06:37:39 skrll Exp $
+# $NetBSD: mkimage,v 1.63 2017/04/11 18:04:08 jmcneill Exp $
#
# Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -82,6 +82,28 @@
echo $5
}
+getsectors() {
+ case "$1" in
+ *g)
+ m=1073741824
+ v=${1%g}
+ ;;
+ *m)
+ m=1048576
+ v=${1%m}
+ ;;
+ *k)
+ m=1024
+ v=${1%k}
+ ;;
+ *[0-9b])
+ m=1
+ v=${1%b}
+ ;;
+ esac
+ echo $((m * v / 512))
+}
+
usage() {
cat << EOF 1>&2
Usage: $PROG -h <host-arch> [-bdmx] [-B <byte-order>] [-K <kerneldir>] [-S <srcdir>] [-D <destdir>] [-c <custom-files-dir>] [-s <Mb size>] [<image>]
@@ -188,8 +210,8 @@
if [ -n "${msdosid}" ]; then
echo ${bar} Populating msdos filesystem ${bar}
- ${MAKEFS} -N ${release}/etc -t msdos \
- -O $((${init} / 2))m -s $((${boot} / 2 + ${init} / 2))m \
+ ${MAKEFS} -N ${release}/etc -t msdos -o volume_label=NETBSD \
+ -O $((${init} / 2))m -s $((${boot} / 2))m \
${image} ${mnt}/boot
fi
@@ -220,7 +242,15 @@
echo ${bar} Running fdisk ${bar}
initsecs=$((${init} * 1024))
bootsecs=$((${boot} * 1024))
+ ${FDISK} -f -i ${image}
${FDISK} -f -a -u -0 -s ${msdosid}/${initsecs}/${bootsecs} -F ${image}
+ if [ -z "${bootonly}" ]; then
+ ffsstart="$(getsectors ${ffsoffset})"
+ imagesize="$(getsize "${image}")"
+ imagesecs="$(getsectors ${imagesize})"
+ ffssize="$(expr ${imagesecs} - ${ffsstart})"
+ ${FDISK} -f -u -1 -s 169/${ffsstart}/${ffssize} -F ${image}
+ fi
elif [ -n "${netbsdid}" ]; then
echo ${bar} Running fdisk ${bar}
${FDISK} -f -i ${image}
Home |
Main Index |
Thread Index |
Old Index