From c972e5747b01767625f9754a31fed50f8ee61fca Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 5 Mar 2012 17:48:51 +0000 Subject: Replace use of parted with sfdisk. Add some inline documentation of what's happening. --- mkimage.sh | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'mkimage.sh') diff --git a/mkimage.sh b/mkimage.sh index 2684314d..87db0c63 100755 --- a/mkimage.sh +++ b/mkimage.sh @@ -70,35 +70,45 @@ fi img="$1" shift +# Create an empty file (a hole) as the raw disk image file. dd if=/dev/zero of="$img" bs=16G seek=1 count=0 -parted -s "$img" mklabel msdos -parted -s "$img" mkpart primary 0% 100% -parted -s "$img" set 1 boot on -install-mbr "$img" +# Partition. See the sfdisk(8) manpage for an explanation of the input. +sfdisk "$img" < /dev/null +# Configure fstab for the new system. +cat < "$mp/etc/fstab" /dev/sda1 / ext4 errors=remount-ro 0 1 EOF -cat < /dev/null +# Install extlinux as the bootloader. +cat < "$mp/extlinux.conf" default linux timeout 1 @@ -107,7 +117,7 @@ kernel /boot/vmlinuz append root=/dev/sda1 init=/sbin/init rw EOF -sudo extlinux --install "$mp" +extlinux --install "$mp" sync sleep 2 -- cgit v1.2.1