mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 09:39:08 +00:00
Put full filesystem on EFI ISO
In line with BIOS ISO changes previously. Remove boot options, user can add if required, they made boot very slow. Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
parent
2a26a68aff
commit
fdc4eb7c32
@ -5,49 +5,47 @@ set -e
|
|||||||
mkdir -p /tmp/efi
|
mkdir -p /tmp/efi
|
||||||
cd /tmp/efi
|
cd /tmp/efi
|
||||||
|
|
||||||
# input is a tarball of kernel and initrd.img on stdin
|
# input is a tarball on stdin with kernel and cmdline 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
|
# Create a EFI boot file with kernel. From:
|
||||||
[ "$INITRD" = "./initrd.img" ] || mv "$INITRD" initrd.img
|
|
||||||
|
|
||||||
# clean up subdirectories
|
|
||||||
find . -mindepth 1 -maxdepth 1 -type d | xargs rm -rf
|
|
||||||
|
|
||||||
# Create a EFI boot file with kernel and initrd. From:
|
|
||||||
# https://github.com/haraldh/mkrescue-uefi/blob/master/mkrescue-uefi.sh
|
# https://github.com/haraldh/mkrescue-uefi/blob/master/mkrescue-uefi.sh
|
||||||
cp /usr/lib/gummiboot/linuxx64.efi.stub .
|
cp /usr/lib/gummiboot/linuxx64.efi.stub .
|
||||||
echo "${CMDLINE} rootdelay=300 noautodetect" > cmdline.txt
|
echo "${CMDLINE}" > cmdline.txt
|
||||||
|
|
||||||
objcopy \
|
objcopy \
|
||||||
--add-section .osrel=/etc/os-release --change-section-vma .osrel=0x20000 \
|
--add-section .osrel=/etc/os-release --change-section-vma .osrel=0x20000 \
|
||||||
--add-section .cmdline=./cmdline.txt --change-section-vma .cmdline=0x30000 \
|
--add-section .cmdline=./cmdline.txt --change-section-vma .cmdline=0x30000 \
|
||||||
--add-section .linux=./kernel --change-section-vma .linux=0x40000 \
|
--add-section .linux=./boot/kernel --change-section-vma .linux=0x40000 \
|
||||||
--add-section .initrd=./initrd.img --change-section-vma .initrd=0x3000000 \
|
|
||||||
./linuxx64.efi.stub \
|
./linuxx64.efi.stub \
|
||||||
linuxkit.efi
|
linuxkit.efi
|
||||||
|
|
||||||
|
rm cmdline.txt
|
||||||
|
|
||||||
# create a ISO with a EFI boot partition
|
# create a ISO with a EFI boot partition
|
||||||
mkdir -p iso
|
|
||||||
# Stuff it into a FAT filesystem, making it as small as possible. 511KiB
|
# Stuff it into a FAT filesystem, making it as small as possible. 511KiB
|
||||||
# headroom seems to be enough; (x+31)/32*32 rounds up to multiple of 32.
|
# headroom seems to be enough; (x+31)/32*32 rounds up to multiple of 32.
|
||||||
mkfs.vfat -v -C iso/efi.raw \
|
mkfs.vfat -v -C boot/efi.raw \
|
||||||
$(( ($(stat -c %s "linuxkit.efi") / 1024 + 511) \
|
$(( ($(stat -c %s "linuxkit.efi") / 1024 + 511) \
|
||||||
/ 32 * 32 )) > /dev/null
|
/ 32 * 32 )) > /dev/null
|
||||||
echo "mtools_skip_check=1" >> /etc/mtools.conf && \
|
echo "mtools_skip_check=1" >> /etc/mtools.conf && \
|
||||||
mmd -i iso/efi.raw ::/EFI
|
mmd -i boot/efi.raw ::/EFI
|
||||||
mmd -i iso/efi.raw ::/EFI/BOOT
|
mmd -i boot/efi.raw ::/EFI/BOOT
|
||||||
mcopy -i iso/efi.raw linuxkit.efi ::/EFI/BOOT/BOOTX64.EFI
|
mcopy -i boot/efi.raw linuxkit.efi ::/EFI/BOOT/BOOTX64.EFI
|
||||||
|
|
||||||
|
rm linuxkit.efi linuxx64.efi.stub
|
||||||
|
|
||||||
xorriso -as mkisofs \
|
xorriso -as mkisofs \
|
||||||
-R -f -e efi.raw -no-emul-boot -o linuxkit-efi.iso iso
|
-R -e boot/efi.raw -no-emul-boot -o linuxkit-efi.iso .
|
||||||
|
|
||||||
cat linuxkit-efi.iso
|
cat linuxkit-efi.iso
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user