diff --git a/README.md b/README.md index f02d286..03fc476 100644 --- a/README.md +++ b/README.md @@ -196,6 +196,9 @@ Run `make bcm2709_defconfig` (and optional `make menuconfig`) to configure the k ##### `KERNELSRC_PREBUILT`=false With this parameter set to true the script expects the existing kernel sources directory to be already successfully cross-compiled. The parameters `KERNELSRC_CLEAN`, `KERNELSRC_CONFIG` and `KERNEL_MENUCONFIG` are ignored and no kernel compilation tasks are performed. +##### `FIRMWAREDIR`="" +The directory containing a local copy of the firmware from the [RaspberryPi firmware project](https://github.com/raspberrypi/firmware). Default is to download the latest firmware directly from the project. + #### Reduce disk usage: The following list of parameters is ignored if `ENABLE_REDUCE`=false. diff --git a/bootstrap.d/13-kernel.sh b/bootstrap.d/13-kernel.sh index 2652142..c6b43c6 100644 --- a/bootstrap.d/13-kernel.sh +++ b/bootstrap.d/13-kernel.sh @@ -131,14 +131,25 @@ if [ "$BUILD_KERNEL" = true ] ; then rm -fr "${KERNELDIR}" fi - # Install latest boot binaries from raspberry/firmware github - wget -q -O "${BOOTDIR}/bootcode.bin" https://github.com/raspberrypi/firmware/raw/master/boot/bootcode.bin - wget -q -O "${BOOTDIR}/fixup.dat" https://github.com/raspberrypi/firmware/raw/master/boot/fixup.dat - wget -q -O "${BOOTDIR}/fixup_cd.dat" https://github.com/raspberrypi/firmware/raw/master/boot/fixup_cd.dat - wget -q -O "${BOOTDIR}/fixup_x.dat" https://github.com/raspberrypi/firmware/raw/master/boot/fixup_x.dat - wget -q -O "${BOOTDIR}/start.elf" https://github.com/raspberrypi/firmware/raw/master/boot/start.elf - wget -q -O "${BOOTDIR}/start_cd.elf" https://github.com/raspberrypi/firmware/raw/master/boot/start_cd.elf - wget -q -O "${BOOTDIR}/start_x.elf" https://github.com/raspberrypi/firmware/raw/master/boot/start_x.elf + if [ -n "$FIRMWAREDIR" ] && [ -d "$FIRMWAREDIR" ] ; then + # Install boot binaries from local directory + cp ${FIRMWAREDIR}/boot/bootcode.bin ${BOOTDIR}/bootcode.bin + cp ${FIRMWAREDIR}/boot/fixup.dat ${BOOTDIR}/fixup.dat + cp ${FIRMWAREDIR}/boot/fixup_cd.dat ${BOOTDIR}/fixup_cd.dat + cp ${FIRMWAREDIR}/boot/fixup_x.dat ${BOOTDIR}/fixup_x.dat + cp ${FIRMWAREDIR}/boot/start.elf ${BOOTDIR}/start.elf + cp ${FIRMWAREDIR}/boot/start_cd.elf ${BOOTDIR}/start_cd.elf + cp ${FIRMWAREDIR}/boot/start_x.elf ${BOOTDIR}/start_x.elf + else + # Install latest boot binaries from raspberry/firmware github + wget -q -O "${BOOTDIR}/bootcode.bin" https://github.com/raspberrypi/firmware/raw/master/boot/bootcode.bin + wget -q -O "${BOOTDIR}/fixup.dat" https://github.com/raspberrypi/firmware/raw/master/boot/fixup.dat + wget -q -O "${BOOTDIR}/fixup_cd.dat" https://github.com/raspberrypi/firmware/raw/master/boot/fixup_cd.dat + wget -q -O "${BOOTDIR}/fixup_x.dat" https://github.com/raspberrypi/firmware/raw/master/boot/fixup_x.dat + wget -q -O "${BOOTDIR}/start.elf" https://github.com/raspberrypi/firmware/raw/master/boot/start.elf + wget -q -O "${BOOTDIR}/start_cd.elf" https://github.com/raspberrypi/firmware/raw/master/boot/start_cd.elf + wget -q -O "${BOOTDIR}/start_x.elf" https://github.com/raspberrypi/firmware/raw/master/boot/start_x.elf + fi else # BUILD_KERNEL=false # Kernel installation diff --git a/rpi2-gen-image.sh b/rpi2-gen-image.sh index a04c8e3..e921e25 100755 --- a/rpi2-gen-image.sh +++ b/rpi2-gen-image.sh @@ -57,6 +57,9 @@ ETCDIR="${R}/etc" BOOTDIR="${R}/boot/firmware" KERNELDIR="${R}/usr/src/linux" +# Firmware directory: Blank if download from github +FIRMWAREDIR=${FIRMWAREDIR:=""} + # General settings HOSTNAME=${HOSTNAME:=rpi2-${RELEASE}} PASSWORD=${PASSWORD:=raspberry}