Skip to content

Commit

Permalink
chore: build updates; ubuntu 22.04, remove svn, Makefile feature-flag…
Browse files Browse the repository at this point in the history
…s, re-add Dockerfile

git submodule updates to reflect latest from https://github.com/netbootxyz/pipxe

svn on github has been deprecated, see: https://github.blog/2023-01-20-sunsetting-subversion-support/

re-create Dockerfile for easier local testing (use ubuntu:22.04 to mimic github's runner)

use latest supported github ubuntu version (currently 22.04); include hack to use latest
mtools version (currently 4.0.43) - ubuntu 22.04's mtools (version 4.0.32) contains crash-bug

include c compile flag fixes in Makefile (since git modules are not yet updated) ( TODO: verify if needed after git submodule updates )

Makefile has a few environment switches:
 - RPI_MAJ_VER: [ 3 | default: 4 ]  # inspired by netbootxyz, influences IPXE_TGT and output img/zip names
 - BOOTLOADER_FILENAME: example.ipxe # inspired by netbootxyz, ipxe file to embed
 - TRUST_FILES: example1.crt,example2.crt # inspired by netbootxyz, adds cert data
  • Loading branch information
vanillaSprinkles committed Feb 27, 2024
1 parent a93262a commit b03fdf9
Show file tree
Hide file tree
Showing 9 changed files with 309 additions and 36 deletions.
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#**/.git

#edk2/*
#edk2-non-osi/*
#edk2-platforms/*
#ipxe/*

outs/*
sdcard_rpi*.img
sdcard_rpi*.zip
104 changes: 88 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,80 @@ jobs:

build:
name: Build
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:

- name: Check out code
uses: actions/checkout@v2

- name: "mtools hack (for ubuntu 22.04): set apt default-release to DISTRIB_CODENAME from lsb-release"
run: |
echo "Distrib Codename: $(sed -r -n 's/DISTRIB_CODENAME=(.*)/\1/p' /etc/lsb-release)"
FILE=$(printf 'APT\n{\n Default-Release "%s";\n}\n' "$(sed -r -n 's/DISTRIB_CODENAME=(.*)/\1/p' /etc/lsb-release)" )
echo "$FILE" | sudo dd of=/etc/apt/apt.conf.d/01-default-release
- name: "mtools hack (for ubuntu 22.04): add apt source for noble"
run: |
FILE=$(printf '%s\ndeb http://security.ubuntu.com/ubuntu noble main\n' "$(cat /etc/apt/sources.list)" )
echo "$FILE" | sudo dd of=/etc/apt/sources.list
- name: "mtools hack (for ubuntu 22.04): mtools package-pin to noble"
run: |
FILE=$(printf 'Package: mtools\nPin: release n=noble\nPin-Priority: 995\n')
echo "$FILE" | sudo dd of=/etc/apt/preferences.d/01-mtools
#- name: python hack (for ubuntu 22.04): ensure python exists in PATH as symlink to python3
# run: sudo ln -sf $(which python3) $(which python3 | sed 's/3//g')


- name: Install packages
run: |
sudo apt update
sudo apt install -y -o Acquire::Retries=50 \
gcc-aarch64-linux-gnu iasl mtools subversion \
lzma-dev uuid-dev
gcc-aarch64-linux-gnu iasl mtools \
lzma-dev uuid-dev zip
- name: Sources (git)
run: |
make submodules
- name: Sources (subversion)
- name: Sources (git sparce-checkout)
run: |
make firmware
- name: Build (EFI)
- name: Build (EFI) (rpi3)
run: |
make efi -e RPI_MAJ_VER=3
- name: Build (iPXE) (rpi3)
run: |
make efi
make ipxe -j 4 -e RPI_MAJ_VER=3
- name: Build (iPXE)
- name: SD card (rpi3)
run: |
make ipxe -j 4
make -e RPI_MAJ_VER=3
- name: SD card
- name: Build (EFI) (rpi4)
run: |
make efi -e RPI_MAJ_VER=4
- name: Build (iPXE) (rpi4)
run: |
make ipxe -j 4 -e RPI_MAJ_VER=4
- name: SD card (rpi4)
run: |
make
make -e RPI_MAJ_VER=4
- name: Create release
id: create_release
Expand All @@ -49,24 +91,54 @@ jobs:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}

- name: Upload (sdcard.img)



- name: Upload (sdcard_rpi3.img)
if: startsWith(github.event.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: sdcard_rpi3.img
asset_path: sdcard_rpi3.img
asset_content_type: application/octet-stream


- name: Upload (sdcard_rpi3.zip)
if: startsWith(github.event.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: sdcard.img
asset_path: sdcard.img
asset_name: sdcard_rpi3.zip
asset_path: sdcard_rpi3.zip
asset_content_type: application/zip




- name: Upload (sdcard_rpi4.img)
if: startsWith(github.event.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: sdcard_rpi4.img
asset_path: sdcard_rpi4.img
asset_content_type: application/octet-stream

- name: Upload (sdcard.zip)

- name: Upload (sdcard_rpi4.zip)
if: startsWith(github.event.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_name: sdcard.zip
asset_path: sdcard.zip
asset_name: sdcard_rpi4.zip
asset_path: sdcard_rpi4.zip
asset_content_type: application/zip
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Build/
firmware/
sdcard/
sdcard.img
sdcard.zip
outs/*
132 changes: 132 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@


## docker build -f Dockerfile . -t ipxe_pipxe_localbuild --output "./" --target copytohost

## docker via podman
## docker --cgroup-manager cgroupfs build -f Dockerfile . -t ipxe_pipxe_localbuild --output "./" --target copytohost


## todo use volume map for build and output
## (untested) docker build -f Dockerfile . -v $(pwd):/opt/thisrepo -t ipxe_pipxe_localbuild



FROM ubuntu:22.04 as runner

RUN \
apt update && \
DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends \
binutils \
ca-certificates \
gcc \
g++ \
git \
make \
python-is-python3 \
python3

RUN \
apt clean




## jammy's mtools (ver 4.0.32) has breaking bug; noble's (ver 4.0.43) works

## mtools hack (for ubuntu 22.04); set default apt release
ENV MTOOLS_UBUNTU_RELEASE_NAME=noble
RUN \
cat <<EOFF > /etc/apt/apt.conf.d/01-default-release
APT
{
Default-Release "jammy";
};
EOFF
RUN \
cat <<EOFF >> /etc/apt/sources.list

## hack for mtools; add different source repo
deb http://security.ubuntu.com/ubuntu ${MTOOLS_UBUNTU_RELEASE_NAME} main
EOFF

## package pin for mtools to use different source repo
RUN \
cat <<EOFF >> /etc/apt/preferences.d/01-mtools
Package: mtools
Pin: release n=${MTOOLS_UBUNTU_RELEASE_NAME}
Pin-Priority: 995
EOFF




## install packages
RUN apt update
RUN apt install -y -o Acquire::Retries=50 \
gcc-aarch64-linux-gnu iasl mtools \
lzma-dev uuid-dev zip




FROM runner as builder




## copy in repo
## improve? with mounting $(pwd):/opt/thisrepo
COPY . /opt/thisrepo




WORKDIR /opt/thisrepo




## run make: Sources (git)
RUN \
make submodules

## run make: Sources (git sparce-checkout)
RUN \
make firmware




FROM builder as build




## run make: Build (EFI)
RUN \
make efi -e RPI_MAJ_VER=3

## run make: Build (iPXE)
RUN \
make ipxe -j 4 -e RPI_MAJ_VER=3

## run make: SD card (rpi3)
RUN \
make -e RPI_MAJ_VER=3

## run make: SD card (rpi4)
RUN \
make -e RPI_MAJ_VER=4

RUN \
chmod 666 sdcard_rpi*.*


FROM scratch as copytohost


COPY --link --from=build /opt/thisrepo/sdcard_rpi3.zip /outs/sdcard_rpi3.img
COPY --link --from=build /opt/thisrepo/sdcard_rpi3.zip /outs/sdcard_rpi3.zip

COPY --link --from=build /opt/thisrepo/sdcard_rpi4.zip /outs/sdcard_rpi4.img
COPY --link --from=build /opt/thisrepo/sdcard_rpi4.zip /outs/sdcard_rpi4.zip
Loading

0 comments on commit b03fdf9

Please sign in to comment.