summary refs log tree commit diff
path: root/nixos/modules/system/boot/loader/raspberrypi
diff options
context:
space:
mode:
authorBen Wolsieffer <benwolsieffer@gmail.com>2018-09-12 17:18:07 -0400
committerTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>2018-10-21 17:44:11 +0300
commite2fbada6f8d24660f68ad2b48f8a5cc900f095fc (patch)
tree1090064260011b96be158bff73eca372ea126685 /nixos/modules/system/boot/loader/raspberrypi
parent1afff7c10bdacbdd2d5c2d7010ee96987fdffb0e (diff)
downloadnixlib-e2fbada6f8d24660f68ad2b48f8a5cc900f095fc.tar
nixlib-e2fbada6f8d24660f68ad2b48f8a5cc900f095fc.tar.gz
nixlib-e2fbada6f8d24660f68ad2b48f8a5cc900f095fc.tar.bz2
nixlib-e2fbada6f8d24660f68ad2b48f8a5cc900f095fc.tar.lz
nixlib-e2fbada6f8d24660f68ad2b48f8a5cc900f095fc.tar.xz
nixlib-e2fbada6f8d24660f68ad2b48f8a5cc900f095fc.tar.zst
nixlib-e2fbada6f8d24660f68ad2b48f8a5cc900f095fc.zip
raspberrypi-bootloader: uboot: allow specification of target directory
Diffstat (limited to 'nixos/modules/system/boot/loader/raspberrypi')
-rw-r--r--nixos/modules/system/boot/loader/raspberrypi/uboot-builder.sh31
1 files changed, 20 insertions, 11 deletions
diff --git a/nixos/modules/system/boot/loader/raspberrypi/uboot-builder.sh b/nixos/modules/system/boot/loader/raspberrypi/uboot-builder.sh
index 36bf15066274..ea591427179f 100644
--- a/nixos/modules/system/boot/loader/raspberrypi/uboot-builder.sh
+++ b/nixos/modules/system/boot/loader/raspberrypi/uboot-builder.sh
@@ -1,5 +1,14 @@
 #! @bash@/bin/sh -e
 
+target=/boot # Target directory
+
+while getopts "t:c:d:g:" opt; do
+    case "$opt" in
+        d) target="$OPTARG" ;;
+        *) ;;
+    esac
+done
+
 copyForced() {
     local src="$1"
     local dst="$2"
@@ -12,18 +21,18 @@ copyForced() {
 
 # Add the firmware files
 fwdir=@firmware@/share/raspberrypi/boot/
-copyForced $fwdir/bootcode.bin  /boot/bootcode.bin
-copyForced $fwdir/fixup.dat     /boot/fixup.dat
-copyForced $fwdir/fixup_cd.dat  /boot/fixup_cd.dat
-copyForced $fwdir/fixup_db.dat  /boot/fixup_db.dat
-copyForced $fwdir/fixup_x.dat   /boot/fixup_x.dat
-copyForced $fwdir/start.elf     /boot/start.elf
-copyForced $fwdir/start_cd.elf  /boot/start_cd.elf
-copyForced $fwdir/start_db.elf  /boot/start_db.elf
-copyForced $fwdir/start_x.elf   /boot/start_x.elf
+copyForced $fwdir/bootcode.bin  $target/bootcode.bin
+copyForced $fwdir/fixup.dat     $target/fixup.dat
+copyForced $fwdir/fixup_cd.dat  $target/fixup_cd.dat
+copyForced $fwdir/fixup_db.dat  $target/fixup_db.dat
+copyForced $fwdir/fixup_x.dat   $target/fixup_x.dat
+copyForced $fwdir/start.elf     $target/start.elf
+copyForced $fwdir/start_cd.elf  $target/start_cd.elf
+copyForced $fwdir/start_db.elf  $target/start_db.elf
+copyForced $fwdir/start_x.elf   $target/start_x.elf
 
 # Add the uboot file
-copyForced @uboot@/u-boot.bin /boot/u-boot-rpi.bin
+copyForced @uboot@/u-boot.bin $target/u-boot-rpi.bin
 
 # Add the config.txt
-copyForced @configTxt@ /boot/config.txt
+copyForced @configTxt@ $target/config.txt