mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-24 11:25:40 +00:00
Unpack filesystem for BIOS ISO
Now that LinuxKit works on a truly immutable filesystem, for an ISO it makes sense to use the ISO filesystem rather than using an initrd. Only major difference is you may need to specify the device for the root filesystem in the kernel command line, but we set a sane default of `/dev/sr0` if unspecified. Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
parent
4daf008956
commit
2b045f59fe
@ -5,22 +5,17 @@ set -e
|
|||||||
mkdir -p /tmp/iso
|
mkdir -p /tmp/iso
|
||||||
cd /tmp/iso
|
cd /tmp/iso
|
||||||
|
|
||||||
# input is a tarball of kernel and initrd.img on stdin
|
# input is a tarball of filesystem on stdin with kernel in /boot
|
||||||
# output is an iso on stdout
|
# output is an iso on stdout
|
||||||
|
|
||||||
# extract. BSD tar auto recognises compression, unlike GNU tar
|
# extract. BSD tar auto recognises compression, unlike GNU tar
|
||||||
# only if stdin is a tty, if so need files volume mounted...
|
# only if stdin is a tty, if so need files volume mounted...
|
||||||
[ -t 0 ] || bsdtar xzf -
|
[ -t 0 ] || bsdtar xzf -
|
||||||
|
|
||||||
INITRD="$(find . -name '*.img')"
|
CMDLINE="$(cat boot/cmdline)"
|
||||||
KERNEL="$(find . -name kernel -or -name '*bzImage')"
|
# if no root= root device specified, assume /dev/sr0 ie first CD drive
|
||||||
CMDLINE="$*"
|
echo "${CMDLINE}" | grep -q 'root=' || CMDLINE="${CMDLINE} root=/dev/sr0"
|
||||||
|
rm boot/cmdline
|
||||||
[ "$KERNEL" = "kernel" ] || mv "$KERNEL" kernel
|
|
||||||
[ "$INITRD" = "initrd.img" ] || mv "$INITRD" initrd.img
|
|
||||||
|
|
||||||
# clean up subdirectories
|
|
||||||
find . -mindepth 1 -maxdepth 1 -type d | xargs rm -rf
|
|
||||||
|
|
||||||
mkdir -p isolinux
|
mkdir -p isolinux
|
||||||
cp /usr/share/syslinux/isolinux.bin ./isolinux/
|
cp /usr/share/syslinux/isolinux.bin ./isolinux/
|
||||||
@ -28,8 +23,7 @@ cp /usr/share/syslinux/ldlinux.c32 ./isolinux/
|
|||||||
|
|
||||||
CFG="DEFAULT linux
|
CFG="DEFAULT linux
|
||||||
LABEL linux
|
LABEL linux
|
||||||
KERNEL /kernel
|
KERNEL /boot/kernel
|
||||||
INITRD /initrd.img
|
|
||||||
APPEND ${CMDLINE}
|
APPEND ${CMDLINE}
|
||||||
"
|
"
|
||||||
|
|
||||||
@ -39,6 +33,7 @@ genisoimage -o ../linuxkit-bios.iso -l -J -R \
|
|||||||
-c isolinux/boot.cat \
|
-c isolinux/boot.cat \
|
||||||
-b isolinux/isolinux.bin \
|
-b isolinux/isolinux.bin \
|
||||||
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
||||||
|
-joliet-long -input-charset utf8 \
|
||||||
-V LinuxKit .
|
-V LinuxKit .
|
||||||
|
|
||||||
isohybrid ../linuxkit-bios.iso
|
isohybrid ../linuxkit-bios.iso
|
||||||
|
Loading…
Reference in New Issue
Block a user