reproducible builds for efi and bios isos

Signed-off-by: Justin Cormack <justin@specialbusservice.com>
This commit is contained in:
Justin Cormack 2016-09-11 11:54:13 +01:00 committed by Justin Cormack
parent 18912fa3b5
commit af85abc84d
6 changed files with 97 additions and 22 deletions

View File

@ -1,20 +1,16 @@
# Create a legacy BIOS bootable ISO
FROM alpine:3.4
FROM mobylinux/alpine-bios:626757290dbb54109514af22108645cae9ea40c3
RUN apk update && apk add \
cdrkit \
syslinux
WORKDIR /tmp/iso
RUN mkdir -p /tmp/iso/isolinux && \
cp /usr/share/syslinux/isolinux.bin /tmp/iso/isolinux && \
cp /usr/share/syslinux/ldlinux.c32 /tmp/iso/isolinux
COPY initrd.img.gz ./
COPY kernel/x86_64/vmlinuz64 ./
COPY isolinux.cfg ./isolinux/
COPY initrd.img.gz /tmp/iso
COPY kernel/x86_64/vmlinuz64 /tmp/iso
COPY isolinux.cfg /tmp/iso/isolinux
RUN cp /usr/share/syslinux/isolinux.bin ./isolinux/ && \
cp /usr/share/syslinux/ldlinux.c32 ./isolinux/
RUN cd /tmp/iso && \
genisoimage -o ../mobylinux-bios.iso -l -J -R \
RUN genisoimage -o ../mobylinux-bios.iso -l -J -R \
-c isolinux/boot.cat \
-b isolinux/isolinux.bin \
-no-emul-boot -boot-load-size 4 -boot-info-table \

View File

@ -1,15 +1,14 @@
# Create a EFI Bootable ISO
FROM alpine:3.4
FROM mobylinux/alpine-efi:2f8c8e9ecc4bfefaf1b5ca56bac5506baba301f2
RUN apk add --no-cache binutils mtools xorriso gummiboot
WORKDIR /tmp/efi
COPY initrd.img.gz /tmp/efi/
COPY kernel/x86_64/vmlinuz64 /tmp/efi/
COPY initrd.img.gz ./
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 cd /tmp/efi && \
cp /usr/lib/gummiboot/linuxx64.efi.stub . && \
RUN cp /usr/lib/gummiboot/linuxx64.efi.stub . && \
echo "earlyprintk=serial console=ttyS0 mobyplatform=windows" > cmdline.txt && \
objcopy \
--add-section .osrel=/etc/os-release --change-section-vma .osrel=0x20000 \
@ -20,13 +19,11 @@ RUN cd /tmp/efi && \
mobylinux.efi
# create a ISO with a EFI boot partition
RUN cd /tmp/efi && \
mkdir -p iso && \
RUN mkdir -p iso && \
dd if=/dev/zero of=iso/efi.raw bs=1024 count=70000 && \
mkfs.vfat iso/efi.raw
RUN cd /tmp/efi && \
echo "mtools_skip_check=1" >> /etc/mtools.conf && \
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 && \

View File

@ -0,0 +1,8 @@
FROM alpine:3.4
RUN \
apk update && apk upgrade && \
apk add \
cdrkit \
syslinux \
&& rm -rf /var/cache/apk/*

View File

@ -0,0 +1,32 @@
.PHONY: tag push
BASE=alpine:3.4
IMAGE=alpine-bios
default: push
hash:
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
push: hash
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
(docker tag $(IMAGE):build mobylinux/$(IMAGE):latest && \
docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash) && \
docker push mobylinux/$(IMAGE):$(shell cat hash) && \
docker push mobylinux/$(IMAGE):latest)
docker rmi $(IMAGE):build
rm -f hash
tag: hash
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
(docker tag $(IMAGE):build mobylinux/$(IMAGE):latest && \
docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash))
docker rmi $(IMAGE):build
rm -f hash
clean:
rm -f hash
.DELETE_ON_ERROR:

View File

@ -0,0 +1,10 @@
FROM alpine:3.4
RUN \
apk update && apk upgrade && \
apk add \
binutils \
mtools \
xorriso \
gummiboot \
&& rm -rf /var/cache/apk/*

View File

@ -0,0 +1,32 @@
.PHONY: tag push
BASE=alpine:3.4
IMAGE=alpine-efi
default: push
hash:
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
push: hash
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
(docker tag $(IMAGE):build mobylinux/$(IMAGE):latest && \
docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash) && \
docker push mobylinux/$(IMAGE):$(shell cat hash) && \
docker push mobylinux/$(IMAGE):latest)
docker rmi $(IMAGE):build
rm -f hash
tag: hash
docker pull mobylinux/$(IMAGE):$(shell cat hash) || \
(docker tag $(IMAGE):build mobylinux/$(IMAGE):latest && \
docker tag $(IMAGE):build mobylinux/$(IMAGE):$(shell cat hash))
docker rmi $(IMAGE):build
rm -f hash
clean:
rm -f hash
.DELETE_ON_ERROR: