2022-02-14 11:03:37 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2024-06-18 15:07:35 +00:00
|
|
|
BUILDROOT=buildroot-2024.02.3
|
|
|
|
BUILDROOT_TAR=buildroot-2024.02.3.tar.gz
|
2022-02-14 11:03:37 +01:00
|
|
|
|
2024-05-22 22:56:48 +00:00
|
|
|
if [ ! -e "${BUILDROOT}" ]; then
|
|
|
|
tar xvf "${BUILDROOT_TAR}"
|
2022-02-14 11:03:37 +01:00
|
|
|
fi
|
|
|
|
|
2024-05-22 22:56:48 +00:00
|
|
|
if [ ! -e "${BUILDROOT}/.config" ]; then
|
|
|
|
make -C "${BUILDROOT}" BR2_EXTERNAL="${PWD}/imager" rpi-imager_defconfig
|
2022-02-14 11:03:37 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Build everything
|
|
|
|
#
|
2024-05-22 22:56:48 +00:00
|
|
|
make -C "${BUILDROOT}" BR2_EXTERNAL="$PWD/imager"
|
2022-02-14 11:03:37 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Copy the files we are interested in from buildroot's "output/images" directory
|
|
|
|
# to our "output" directory in top level directory
|
|
|
|
#
|
|
|
|
|
|
|
|
# Copy Linux kernel and initramfs
|
2024-05-22 22:56:48 +00:00
|
|
|
cp "${BUILDROOT}/output/images/rootfs.cpio.zst" "${BUILDROOT}/output/images/Image.gz" output
|
2022-02-14 11:03:37 +01:00
|
|
|
# Raspberry Pi firmware files
|
2024-05-22 22:56:48 +00:00
|
|
|
cp "${BUILDROOT}/output/images/rpi-firmware/start4.elf" output
|
|
|
|
cp "${BUILDROOT}/output/images/rpi-firmware/fixup4.dat" output
|
2022-02-14 11:03:37 +01:00
|
|
|
|
|
|
|
# Not used by Pi 4, but need to be present to make usbboot think it is a valid directory
|
|
|
|
touch output/bootcode.bin
|
|
|
|
|
2024-06-18 15:07:35 +00:00
|
|
|
cp ${BUILDROOT}/output/images/bcm2711*.dtb output/
|
|
|
|
cp ${BUILDROOT}/output/images/bcm2712*.dtb output/
|
|
|
|
|
2022-02-14 11:03:37 +01:00
|
|
|
mkdir -p output/overlays
|
|
|
|
|
2024-05-23 08:31:41 +00:00
|
|
|
cp ${BUILDROOT}/output/images/dwc2-overlay.dtb output/overlays/dwc2.dtbo
|
2024-06-18 15:07:35 +00:00
|
|
|
cp ${BUILDROOT}/output/images/bcm2712d0-overlay.dtb output/overlays/bcm2712d0.dtbo
|
2024-05-23 08:31:41 +00:00
|
|
|
cp ${BUILDROOT}/output/images/vc4-kms-v3d-pi5-overlay.dtb output/overlays/vc4-kms-v3d-pi5.dtbo
|
|
|
|
cp ${BUILDROOT}/output/images/vc4-kms-v3d-pi4-overlay.dtb output/overlays/vc4-kms-v3d-pi4.dtbo
|
|
|
|
cp ${BUILDROOT}/output/images/disable-bt-overlay.dtb output/overlays/disable-bt.dtbo
|
|
|
|
cp ${BUILDROOT}/output/images/disable-wifi-overlay.dtb output/overlays/disable-wifi.dtbo
|
|
|
|
cp ${BUILDROOT}/output/images/disable-bt-pi5-overlay.dtb output/overlays/disable-bt-pi5.dtbo
|
|
|
|
cp ${BUILDROOT}/output/images/disable-wifi-pi5-overlay.dtb output/overlays/disable-wifi-pi5.dtbo
|
|
|
|
cp ${BUILDROOT}/output/images/overlay_map.dtb output/overlays/overlay_map.dtb
|
2022-02-14 11:03:37 +01:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo Build complete. Files are in output folder.
|
|
|
|
echo
|