mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 09:39:08 +00:00
Merge pull request #1116 from justincormack/iso-cleanup
Cleanup BIOS ISO builds
This commit is contained in:
commit
38b6847669
2
Makefile
2
Makefile
@ -54,7 +54,7 @@ hyperkit-test: hyperkit.sh hyperkit.bin/com.docker.hyperkit hyperkit.bin/com.doc
|
||||
rm -f disk.img
|
||||
INITRD=alpine/initrd-test.img ./hyperkit.sh 2>&1 | tee test.log
|
||||
$(call check_test_log, test.log)
|
||||
|
||||
|
||||
test: alpine/initrd-test.img alpine/kernel/x86_64/vmlinuz64
|
||||
tar cf - $^ | docker run --rm -i $(QEMU_IMAGE) 2>&1 | tee test.log
|
||||
$(call check_test_log, test.log)
|
||||
|
@ -1,52 +0,0 @@
|
||||
# Create a EFI Bootable ISO
|
||||
# Tag: cb55eabd696f41c5e4983a7440a865685087f683
|
||||
FROM mobylinux/alpine-efi@sha256:3693e786f48858c1b104e64727ac487e3c851046755b241f8a4556afac97edd6
|
||||
|
||||
WORKDIR /tmp/efi
|
||||
|
||||
COPY initrd.img ./
|
||||
COPY kernel/x86_64/vmlinuz64 ./
|
||||
|
||||
# Create a EFI boot file with kernel and initrd. From:
|
||||
# https://github.com/haraldh/mkrescue-uefi/blob/master/mkrescue-uefi.sh
|
||||
RUN cp /usr/lib/gummiboot/linuxx64.efi.stub . && \
|
||||
echo "earlyprintk=ttyS0,115200 console=ttyS0,115200 mobyplatform=windows vsyscall=emulate panic=1 rootdelay=300 noautodetect" > cmdline.txt && \
|
||||
objcopy \
|
||||
--add-section .osrel=/etc/os-release --change-section-vma .osrel=0x20000 \
|
||||
--add-section .cmdline=./cmdline.txt --change-section-vma .cmdline=0x30000 \
|
||||
--add-section .linux=./vmlinuz64 --change-section-vma .linux=0x40000 \
|
||||
--add-section .initrd=initrd.img --change-section-vma .initrd=0x3000000 \
|
||||
./linuxx64.efi.stub \
|
||||
mobylinux.efi
|
||||
|
||||
# create a ISO with a EFI boot partition
|
||||
RUN mkdir -p iso && \
|
||||
dd if=/dev/zero of=iso/efi.raw bs=1024 count=78000 && \
|
||||
mkfs.vfat iso/efi.raw
|
||||
|
||||
RUN echo "mtools_skip_check=1" >> /etc/mtools.conf && \
|
||||
mmd -i iso/efi.raw ::/EFI && \
|
||||
mmd -i iso/efi.raw ::/EFI/BOOT && \
|
||||
mcopy -i iso/efi.raw mobylinux.efi ::/EFI/BOOT/BOOTX64.EFI && \
|
||||
xorriso -as mkisofs \
|
||||
-R -f -e efi.raw -no-emul-boot -o mobylinux-efi.iso iso
|
||||
|
||||
# How to build a VHDX. Commented out because we are currently not using it
|
||||
# Don't delete: It took too long to figure out how to do this...
|
||||
# # create a disk image (150MB)
|
||||
# # This is a little odd, as we run this as part of the default command.
|
||||
# # Can't run this during the build step as it requires privilege.
|
||||
# # The Magic numbers in losetup are startsector (2048) times 512 and
|
||||
# # (endsector - startsector) * 512
|
||||
# CMD cd /tmp/efi && \
|
||||
# dd if=/dev/zero of=disk.raw bs=1024 count=51200 && \
|
||||
# sgdisk -N 1 -t 1:ef00 disk.raw && \
|
||||
# losetup -o 1048576 --sizelimit 51362816 /dev/loop/1 disk.raw && \
|
||||
# mkfs.vfat /dev/loop/1 && \
|
||||
# echo "drive c: file=\"/dev/loop/1\" mtools_skip_check=1" > /etc/mtools.conf && \
|
||||
# mmd c:/EFI && \
|
||||
# mmd c:/EFI/BOOT && \
|
||||
# mcopy mobylinux.efi c:/EFI/BOOT/BOOTX64.EFI && \
|
||||
# losetup -d /dev/loop/1 && \
|
||||
# qemu-img convert -O vhdx disk.raw mobylinux-boot.vhdx && \
|
||||
# cp /tmp/efi/mobylinux.efi /tmp/efi/mobylinuxefi.iso /tmp/efi/mobylinux-boot.vhdx /mnt/
|
@ -13,8 +13,11 @@ endif
|
||||
# By default we want to always auth to GCE to upload moby images
|
||||
FORCE_GSUTIL_AUTH ?= 1
|
||||
|
||||
# Tag: 22b043cb43f6bc3bc4e1f1ecf9d64932f9325642
|
||||
BIOS_IMAGE=mobylinux/mkimage-iso-bios@sha256:7e28f7745fd62284142dce59a137c3331f7673efe8b3f19ee5c65e4cc27ff18c
|
||||
# Tag: 2a860edda12a44c8e141a924f29ea931dbc01110
|
||||
BIOS_IMAGE=mobylinux/mkimage-iso-bios@sha256:974304cfff80524a37bf96d299de9b3163ba07df5feeb620c6bdcd132b46f16d
|
||||
|
||||
# Tag: f81034d118744a42e8e93cfe0777dc3490c1f6a0
|
||||
EFI_IMAGE=mobylinux/mkimage-iso-efi@sha256:4bb10d794fd0fe58366c36ab0fabf7b6d22e5bd760a994900da3b910230519cc
|
||||
|
||||
# Tag: 1edffcbfa13d4795f006d38e871a778ffba03d8a
|
||||
PAD4_IMAGE=mobylinux/pad4@sha256:1ad26970698670373ee0bf374a06900f712a61b8038255e78271b840a1267b25
|
||||
@ -84,14 +87,12 @@ initrd-test.img: initrd.img test.img
|
||||
ebpf: kernel/x86_64/kernel.img
|
||||
$(MAKE) -C ebpf
|
||||
|
||||
mobylinux-efi.iso: Dockerfile.efi initrd.img kernel/x86_64/vmlinuz64
|
||||
BUILD=$$( tar cf - $^ | docker build -q -f Dockerfile.efi - ) && [ -n "$$BUILD" ] && echo "Built $$BUILD" && \
|
||||
docker run --rm --net=none --log-driver=none --cap-add sys_admin $$BUILD cat /tmp/efi/mobylinux.efi > mobylinux.efi && \
|
||||
docker run --rm --net=none --log-driver=none --cap-add sys_admin $$BUILD cat /tmp/efi/mobylinux-efi.iso > $@
|
||||
# outputs tarball of mobylinux-efi.iso mobylinux.efi
|
||||
mobylinux-efi.iso: initrd.img kernel/x86_64/vmlinuz64
|
||||
tar cf - $^ | docker run --rm --net=none --log-driver=none -i $(EFI_IMAGE) | tar xf -
|
||||
|
||||
mobylinux-bios.iso: initrd.img kernel/x86_64/vmlinuz64
|
||||
tar cf - initrd.img -C kernel/x86_64 vmlinuz64 | \
|
||||
docker run --rm --net=none --log-driver=none -i $(BIOS_IMAGE) >$@
|
||||
tar cf - $^ | docker run --rm --net=none --log-driver=none -i $(BIOS_IMAGE) >$@
|
||||
|
||||
gce: gce.img.tar.gz
|
||||
|
||||
|
@ -1,16 +1,13 @@
|
||||
FROM alpine:3.4
|
||||
FROM alpine:3.5
|
||||
|
||||
RUN \
|
||||
apk update && apk upgrade && \
|
||||
apk add --no-cache \
|
||||
libarchive-tools \
|
||||
cdrkit \
|
||||
syslinux \
|
||||
&& true
|
||||
|
||||
WORKDIR /tmp/iso
|
||||
COPY . .
|
||||
|
||||
COPY isolinux.cfg ./isolinux/
|
||||
|
||||
COPY make-iso /usr/bin
|
||||
|
||||
CMD [ "/usr/bin/make-iso" ]
|
||||
CMD [ "/make-iso" ]
|
||||
|
@ -1,14 +1,14 @@
|
||||
.PHONY: tag push
|
||||
|
||||
BASE=alpine:3.4
|
||||
BASE=alpine:3.5
|
||||
IMAGE=mkimage-iso-bios
|
||||
|
||||
default: push
|
||||
|
||||
hash:
|
||||
hash: Dockerfile make-iso
|
||||
DOCKER_CONTENT_TRUST=1 docker pull $(BASE)
|
||||
tar cf - Dockerfile make-iso isolinux.cfg | docker build --no-cache -t $(IMAGE):build -
|
||||
docker run --rm $(IMAGE):build sha1sum /lib/apk/db/installed | sed 's/ .*//' > hash
|
||||
tar cf - $^ | docker build --no-cache -t $(IMAGE):build -
|
||||
docker run --rm --entrypoint /bin/sh $(IMAGE):build -c 'cat $^ /lib/apk/db/installed | sha1sum' | sed 's/ .*//' > $@
|
||||
|
||||
push: hash
|
||||
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
|
||||
|
@ -1,5 +0,0 @@
|
||||
DEFAULT linux
|
||||
LABEL linux
|
||||
KERNEL /vmlinuz64
|
||||
INITRD /initrd.img
|
||||
APPEND earlyprintk=serial console=ttyS0 console=tty1
|
@ -1,12 +1,38 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
mkdir -p /tmp/iso
|
||||
cd /tmp/iso
|
||||
|
||||
# input is a tarball of vmlinuz64 and initrd.img on stdin
|
||||
# output is an iso on stdout
|
||||
|
||||
# extract. BSD tar auto recognises compression, unlike GNU tar
|
||||
# only if stdin is a tty, if so need files volume mounted...
|
||||
[ -t 0 ] || bsdtar xzf -
|
||||
|
||||
INITRD="$(find . -name '*.img')"
|
||||
KERNEL="$(find . -name vmlinuz64 -or -name bzImage)"
|
||||
|
||||
[ "$KERNEL" = "vmlinuz64" ] || mv "$KERNEL" vmlinuz64
|
||||
[ "$INITRD" = "initrd.img" ] || mv "$INITRD" initrd.img
|
||||
|
||||
# clean up subdirectories
|
||||
find . -mindepth 1 -maxdepth 1 -type d | xargs rm -rf
|
||||
|
||||
mkdir -p isolinux
|
||||
cp /usr/share/syslinux/isolinux.bin ./isolinux/
|
||||
cp /usr/share/syslinux/ldlinux.c32 ./isolinux/
|
||||
|
||||
tar xf -
|
||||
CFG="DEFAULT linux
|
||||
LABEL linux
|
||||
KERNEL /vmlinuz64
|
||||
INITRD /initrd.img
|
||||
APPEND earlyprintk=serial console=ttyS0 console=tty1 $*
|
||||
"
|
||||
|
||||
printf "$CFG" > isolinux/isolinux.cfg
|
||||
|
||||
genisoimage -o ../mobylinux-bios.iso -l -J -R \
|
||||
-c isolinux/boot.cat \
|
||||
|
@ -3,8 +3,13 @@ FROM alpine:3.5
|
||||
RUN \
|
||||
apk update && apk upgrade && \
|
||||
apk add --no-cache \
|
||||
libarchive-tools \
|
||||
binutils \
|
||||
gummiboot \
|
||||
mtools \
|
||||
xorriso \
|
||||
&& true
|
||||
|
||||
COPY . .
|
||||
|
||||
CMD [ "/make-efi" ]
|
@ -1,14 +1,14 @@
|
||||
.PHONY: tag push
|
||||
|
||||
BASE=alpine:3.5
|
||||
IMAGE=alpine-efi
|
||||
IMAGE=mkimage-iso-efi
|
||||
|
||||
default: push
|
||||
|
||||
hash:
|
||||
hash: Dockerfile make-efi
|
||||
DOCKER_CONTENT_TRUST=1 docker pull $(BASE)
|
||||
tar cf - Dockerfile | docker build --no-cache -t $(IMAGE):build -
|
||||
docker run --rm $(IMAGE):build sha1sum /lib/apk/db/installed | sed 's/ .*//' > hash
|
||||
tar cf - $^ | docker build --no-cache -t $(IMAGE):build -
|
||||
docker run --rm --entrypoint /bin/sh $(IMAGE):build -c 'cat $^ /lib/apk/db/installed | sha1sum' | sed 's/ .*//' > $@
|
||||
|
||||
push: hash
|
||||
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
|
73
base/mkimage-iso-efi/make-efi
Executable file
73
base/mkimage-iso-efi/make-efi
Executable file
@ -0,0 +1,73 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
mkdir -p /tmp/efi
|
||||
cd /tmp/efi
|
||||
|
||||
# input is a tarball of vmlinuz64 and initrd.img on stdin
|
||||
# output is an iso on stdout
|
||||
|
||||
# extract. BSD tar auto recognises compression, unlike GNU tar
|
||||
# only if stdin is a tty, if so need files volume mounted...
|
||||
[ -t 0 ] || bsdtar xzf -
|
||||
|
||||
INITRD="$(find . -name '*.img')"
|
||||
KERNEL="$(find . -name vmlinuz64 -or -name bzImage)"
|
||||
|
||||
[ "$KERNEL" = "vmlinuz64" ] || mv "$KERNEL" vmlinuz64
|
||||
[ "$INITRD" = "initrd.img" ] || mv "$INITRD" initrd.img
|
||||
|
||||
# clean up subdirectories
|
||||
find . -mindepth 1 -maxdepth 1 -type d | xargs rm -rf
|
||||
|
||||
# Docker for Windows specific options, should be moved
|
||||
WINDOWS_OPTIONS="mobyplatform=windows vsyscall=emulate panic=1 rootdelay=300 noautodetect"
|
||||
|
||||
# Create a EFI boot file with kernel and initrd. From:
|
||||
# https://github.com/haraldh/mkrescue-uefi/blob/master/mkrescue-uefi.sh
|
||||
cp /usr/lib/gummiboot/linuxx64.efi.stub .
|
||||
echo "earlyprintk=ttyS0,115200 console=ttyS0,115200 $WINDOWS_OPTIONS" > cmdline.txt
|
||||
|
||||
objcopy \
|
||||
--add-section .osrel=/etc/os-release --change-section-vma .osrel=0x20000 \
|
||||
--add-section .cmdline=./cmdline.txt --change-section-vma .cmdline=0x30000 \
|
||||
--add-section .linux=./vmlinuz64 --change-section-vma .linux=0x40000 \
|
||||
--add-section .initrd=initrd.img --change-section-vma .initrd=0x3000000 \
|
||||
./linuxx64.efi.stub \
|
||||
mobylinux.efi
|
||||
|
||||
# create a ISO with a EFI boot partition
|
||||
mkdir -p iso
|
||||
dd if=/dev/zero of=iso/efi.raw bs=1024 count=78000
|
||||
mkfs.vfat iso/efi.raw
|
||||
|
||||
echo "mtools_skip_check=1" >> /etc/mtools.conf && \
|
||||
mmd -i iso/efi.raw ::/EFI
|
||||
mmd -i iso/efi.raw ::/EFI/BOOT
|
||||
mcopy -i iso/efi.raw mobylinux.efi ::/EFI/BOOT/BOOTX64.EFI
|
||||
|
||||
xorriso -as mkisofs \
|
||||
-R -f -e efi.raw -no-emul-boot -o mobylinux-efi.iso iso
|
||||
|
||||
tar cf - mobylinux-efi.iso mobylinux.efi
|
||||
|
||||
# How to build a VHDX. Commented out because we are currently not using it
|
||||
# Don't delete: It took too long to figure out how to do this...
|
||||
# # create a disk image (150MB)
|
||||
# # This is a little odd, as we run this as part of the default command.
|
||||
# # Can't run this during the build step as it requires privilege.
|
||||
# # The Magic numbers in losetup are startsector (2048) times 512 and
|
||||
# # (endsector - startsector) * 512
|
||||
# CMD cd /tmp/efi && \
|
||||
# dd if=/dev/zero of=disk.raw bs=1024 count=51200 && \
|
||||
# sgdisk -N 1 -t 1:ef00 disk.raw && \
|
||||
# losetup -o 1048576 --sizelimit 51362816 /dev/loop/1 disk.raw && \
|
||||
# mkfs.vfat /dev/loop/1 && \
|
||||
# echo "drive c: file=\"/dev/loop/1\" mtools_skip_check=1" > /etc/mtools.conf && \
|
||||
# mmd c:/EFI && \
|
||||
# mmd c:/EFI/BOOT && \
|
||||
# mcopy mobylinux.efi c:/EFI/BOOT/BOOTX64.EFI && \
|
||||
# losetup -d /dev/loop/1 && \
|
||||
# qemu-img convert -O vhdx disk.raw mobylinux-boot.vhdx && \
|
||||
# cp /tmp/efi/mobylinux.efi /tmp/efi/mobylinuxefi.iso /tmp/efi/mobylinux-boot.vhdx /mnt/
|
Loading…
Reference in New Issue
Block a user