Skip to content

Commit

Permalink
feat: build sdcard image, overclock settings
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Riegler <[email protected]>
  • Loading branch information
xvzf committed Jun 6, 2024
1 parent 8a3d1b7 commit 2345170
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 25 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Readme.md
Makefile
.github/
.git/
.git*
dist
dist.zip
out/
7 changes: 5 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ jobs:
run: make dist
- uses: sigstore/[email protected]
with:
inputs: dist.zip
inputs: out/uefi.zip
- uses: sigstore/[email protected]
with:
inputs: out/sdcard.img
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist.zip*
file: out/*
file_glob: true
tag: ${{ github.ref }}
overwrite: true
36 changes: 34 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,37 @@ RUN bash build.sh


# Final artifact output
FROM scratch
COPY --from=builder /build/Build/RPi4/RELEASE_GCC5/FV/RPI_EFI.fd /RPI_EFI.fd
FROM scratch as dist
WORKDIR /
COPY --from=builder /build/Build/RPi4/RELEASE_GCC5/FV/RPI_EFI.fd .
COPY --from=builder /build/rpi-firmware/boot/fixup4.dat .
COPY --from=builder /build/rpi-firmware/boot/start4.elf .
COPY --from=builder /build/rpi-firmware/boot/bcm2711-rpi-4-b.dtb .
COPY --from=builder /build/rpi-firmware/boot/bcm2711-rpi-cm4.dtb .
COPY --from=builder /build/rpi-firmware/boot/bcm2711-rpi-400.dtb .
COPY --from=builder /build/rpi-firmware/boot/overlays overlays
COPY --from=builder /build/firmware firmware
COPY config.txt .


FROM ubuntu:22.04 AS image-build
RUN apt-get update && apt-get install -y \
dosfstools \
mtools \
zip

WORKDIR /sdcard/files
COPY --from=dist / /sdcard/files

WORKDIR /sdcard

RUN fallocate -l 64M sdcard.img && \
mkfs.vfat -F 32 sdcard.img && \
mcopy -i sdcard.img files/* :: && \
mdir -i sdcard.img ::

RUN zip -r uefi.zip files/*

FROM scratch as image
COPY --from=image-build /sdcard/sdcard.img .
COPY --from=image-build /sdcard/uefi.zip .
18 changes: 1 addition & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.PHONY: all
all: dist
all: build

.PHONY: init
init:
Expand All @@ -9,19 +9,3 @@ init:
.PHONY: build
build: init
docker buildx build --progress=plain . -o out --no-cache

.PHONY: dist
dist: init build
mkdir -p dist
cp out/* dist/
cp rpi-firmware/boot/fixup4.dat dist/
cp rpi-firmware/boot/start4.elf dist/
cp rpi-firmware/boot/bcm2711-rpi-4-b.dtb dist/
cp rpi-firmware/boot/bcm2711-rpi-cm4.dtb dist/
cp rpi-firmware/boot/bcm2711-rpi-400.dtb dist/
cp -rf rpi-firmware/boot/overlays dist/
mkdir -p dist/firmware
cp -rf firmware/* dist/firmware/
cp config.txt dist/
zip -r dist.zip dist

6 changes: 5 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# ComputeBlade/CM4 optimized UEFI Firmware Images
> [!CAUTION]
> ** THE CONFIGURATION IS PROBABLY NOT SANE FOR ALL USERS **
> THE CONFIGURATION IS PROBABLY NOT SANE FOR ALL USERS.
This is a fork of the amazing [pftf/RPi4](https://github.com/pftf/RPi4) project, which brings a UEFI images for the RaspberryPi 4 Model B.

# Adaptations compared to the pftf/RPi4 proejct

## Adjustments
- server-workload oriented -> limit GPU mem to 64MB
- overclock ComputeModule 4 to 2.0GHz

## Ease of use improvements
- Allow easy local builds using `make dist`

Expand Down
2 changes: 0 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,3 @@ build -a AARCH64 -t GCC5 -b RELEASE \
--pcd gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor=L"${PROJECT_URL}" \
--pcd gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString=L"UEFI Firmware ${VERSION}" \
${BUILD_FLAGS} ${DEFAULT_KEYS}

cp Build/RPi4/RELEASE_GCC5/FV/RPI_EFI.fd .
5 changes: 5 additions & 0 deletions config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ dtoverlay=tpm-slb9670
dtparam=i2c_arm=on
dtoverlay=i2c-rtc,ds3231
dtparam=sd=off

[cm4]
over_voltage=6
arm_freq=2000
gpu_mem=64

0 comments on commit 2345170

Please sign in to comment.