@@ -19,6 +19,36 @@ BOOT_MOUNTPOINT=/tmp/rpi-boot-img
1919# read config vars
2020source /etc/initramfs/rpi-vars.sh
2121
22+ RPI_CONFIG=$( cat " $RPI_CONFIG_FILE " )
23+ RPI_CONFIG_RAW=$( cat " $RPI_CONFIG_RAW_FILE " )
24+ RPI_CMDLINE=$( cat " $RPI_CMDLINE_FILE " | head -1)
25+ [[ -z " $RPI_CONFIG_EXTRA " ]] || RPI_CONFIG+="
26+ $RPI_CONFIG_EXTRA "
27+ [[ -z " $RPI_CMDLINE_EXTRA " ]] || RPI_CMDLINE+=" $RPI_CMDLINE_EXTRA "
28+
29+ INTERPOLATE_VARS=(
30+ " ROOTFS_PARTITION=LABEL=$IMAGE_ROOTFS_PART_NAME "
31+ )
32+
33+ function download_firmware_files() {
34+ for file in " ${RPI_FIRMWARE_FILES[@]} " ; do
35+ if [[ " $file " == " /" * ]]; then
36+ # absolute path, copy it
37+ cp -f " $file " " $1 /$( basename " $file " ) "
38+ else
39+ # download the latest rpi firmware files (debian repo is outdated)
40+ wget " https://github.com/raspberrypi/firmware/raw/master/boot/$file " \
41+ -O " $1 /$file "
42+ fi
43+ done
44+ }
45+
46+ if [[ -n " $RPI_SKIP_IMAGE_GEN " ]]; then
47+ # save config.txt to /boot
48+ interpolate_vars " $RPI_CONFIG " " ${INTERPOLATE_VARS[@]} " > " /boot/config.txt"
49+ exit 0
50+ fi
51+
2252echo " Running RPI ramdisk generator for version $version ..."
2353
2454dd if=/dev/zero bs=1M count=$BOOT_IMG_SIZE of=" $BOOT_IMG "
@@ -38,27 +68,8 @@ mount /dev/loop8 "$BOOT_MOUNTPOINT"
3868
3969install " /boot/vmlinuz-$version " " $BOOT_MOUNTPOINT /kernel8.img"
4070install " /boot/initrd.img-$version " " $BOOT_MOUNTPOINT /initrd.img"
41- for file in " ${RPI_FIRMWARE_FILES[@]} " ; do
42- if [[ " $file " == " /" * ]]; then
43- # absolute path, copy it
44- cp -f " $file " " $BOOT_MOUNTPOINT /$( basename " $file " ) "
45- else
46- # download the latest rpi firmware files (debian repo is outdated)
47- wget " https://github.com/raspberrypi/firmware/raw/master/boot/$file " \
48- -O " $BOOT_MOUNTPOINT /$file "
49- fi
50- done
51-
52- RPI_CONFIG=$( cat " $RPI_CONFIG_FILE " )
53- RPI_CONFIG_RAW=$( cat " $RPI_CONFIG_RAW_FILE " )
54- RPI_CMDLINE=$( cat " $RPI_CMDLINE_FILE " | head -1)
55- [[ -z " $RPI_CONFIG_EXTRA " ]] || RPI_CONFIG+="
56- $RPI_CONFIG_EXTRA "
57- [[ -z " $RPI_CMDLINE_EXTRA " ]] || RPI_CMDLINE+=" $RPI_CMDLINE_EXTRA "
71+ download_firmware_files " $BOOT_MOUNTPOINT /"
5872
59- INTERPOLATE_VARS=(
60- " ROOTFS_PARTITION=LABEL=$IMAGE_ROOTFS_PART_NAME "
61- )
6273interpolate_vars " $RPI_CONFIG " " ${INTERPOLATE_VARS[@]} " > " $BOOT_MOUNTPOINT /config.txt"
6374interpolate_vars " $RPI_CONFIG_RAW " " ${INTERPOLATE_VARS[@]} " > " /boot/config-raw.txt"
6475interpolate_vars " $RPI_CMDLINE " " ${INTERPOLATE_VARS[@]} " > " $BOOT_MOUNTPOINT /cmdline.txt"
0 commit comments