diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2019-05-04 00:10:26 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska-skaware@skarnet.org> | 2019-05-04 00:10:26 +0000 |
| commit | 7bb2006007c1996f33758e41db070252d4d3607f (patch) | |
| tree | 3dc03d4f6a8867742961a3dea9ecc96c52d00a10 /sub/disk-image/make-disk-image | |
| parent | 1202c964c4e91083a3c60b41b9c11e220bfa759d (diff) | |
| download | lh-bootstrap-7bb2006007c1996f33758e41db070252d4d3607f.tar.gz | |
Make a lean and mean version, as a basis for filling an initramfs
Diffstat (limited to 'sub/disk-image/make-disk-image')
| -rwxr-xr-x | sub/disk-image/make-disk-image | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/sub/disk-image/make-disk-image b/sub/disk-image/make-disk-image deleted file mode 100755 index a7a2f97..0000000 --- a/sub/disk-image/make-disk-image +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/sh -e - -output="$1" -rootfs_size="$2" -swap_size="$3" -rwfs_size="$4" -userfs_size="$5" -extra_size="$6" - -totalsize=$(s6-expr ${rootfs_size} + ${swap_size} + ${rwfs_size} + ${userfs_size} + ${extra_size} + 4) - -# prepare extlinux.conf - -if s6-test ${KERNEL_GENERIC_ARCH} = x86 ; then - consolearg="console=ttyS0,115200n8" - if ${USE_GRAPHIC} ; then - consolearg= - fi - if ${USE_VIRTIO_DISK} ; then - bootpartition=/dev/vda1 - elif s6-test ${KERNEL_ARCH} = x86_64 ; then - bootpartition=/dev/sda1 - else - bootpartition=/dev/hda1 - fi - s6-cat > ${output}/rootfs/boot/extlinux.conf <<EOF -serial 0 115200 -console 0 -prompt 0 -default linux -totaltimeout 1200 -say extlinux booting -label linux - linux /boot/vmlinuz - append ro root=$bootpartition rootfstype=ext4 loglevel=4 $consolearg -EOF -fi - -s6-rmrf "$output/disk-image.raw" -setuidgid ${NORMALUSER} dd if=/dev/zero of=$output/disk-image.raw bs=1 count=0 seek=${totalsize}M - -fdisk $output/disk-image.raw <<EOF -n - - - -+${rootfs_size}M -n - - - -+${swap_size}M -t -2 -82 -n - - - -+${rwfs_size}M -n - - - -n - -+${userfs_size}M -n - - -a -1 -w -EOF - -loop=$(losetup -f) -losetup -P "$loop" "$output/disk-image.raw" - -{ - mkfs.ext4 -O ^huge_file ${loop}p1 - mkswap ${loop}p2 - mkfs.ext4 -O ^huge_file ${loop}p3 - mkfs.ext4 -O ^huge_file ${loop}p5 - mkfs.ext4 -O ^huge_file ${loop}p6 - - s6-mkdir -p "$output/tmp/rootfs" "$output/tmp/rwfs" "$output/tmp/userfs" "$output/tmp/stagingfs" - mount -t ext4 ${loop}p1 "$output/tmp/rootfs" - s6-hiercopy "$output/rootfs" "$output/tmp/rootfs" - if s6-test ${KERNEL_GENERIC_ARCH} = x86 ; then - dd if=${output}/build-build/opt/syslinux/usr/share/syslinux/mbr.bin of=${loop} - extlinux -i "$output/tmp/rootfs/boot" - fi - umount -l "$output/tmp/rootfs" - mount -t ext4 ${loop}p3 "$output/tmp/rwfs" - s6-hiercopy "$output/rwfs" "$output/tmp/rwfs" - umount -l "$output/tmp/rwfs" - mount -t ext4 ${loop}p5 "$output/tmp/userfs" - s6-hiercopy "$output/userfs" "$output/tmp/userfs" - umount -l "$output/tmp/userfs" - mount -t ext4 ${loop}p6 "$output/tmp/stagingfs" - s6-hiercopy "$output/stagingfs" "$output/tmp/stagingfs" - umount -l "$output/tmp/stagingfs" -} || { losetup -d "$loop" ; exit 1 ; } - -losetup -d "$loop" |
