shithub: riscv

Download patch

ref: 0bc9ad781fdc9e4cfcd5fed1560775e241a366fc
parent: 8ab9c6d38864362d3683883f22d7539de742cf56
author: cinap_lenrek <[email protected]>
date: Tue Mar 24 20:11:54 EDT 2015

boot: allow alternative proto files per kernel and kernel config for bootfs.paq

bootmkfile will now looks for the following proto files in order
and pick the first one it finds to build the bootfs.paq file:

1)	$CONF.boofs.proto		(config specific)
2)	bootfs.proto			(kernel specific)
3)	$BOOTDIR/bootfs.proto	(default generic)

--- a/sys/src/9/boot/bootmkfile
+++ b/sys/src/9/boot/bootmkfile
@@ -13,7 +13,12 @@
 boot:	$BOOTFILES
 	$LD -o $target $BOOTFILES
 
-BOOTFSPROTO=$BOOTDIR/bootfs.proto
+# look for proto file in order:
+#	1) $CONF.bootfs.proto		(config specific)
+#	2) bootfs.proto			(kernel specific)
+#	3) $BOOTDIR/bootfs.proto	(default generic)
+#
+BOOTFSPROTO=`{for(i in $CONF.bootfs.proto bootfs.proto $BOOTDIR/bootfs.proto) test -r $i && echo $i && exit}
 
 bootfs.paq:	$BOOTFSPROTO `{disk/mkfs -aos / $BOOTFSPROTO >[2]/dev/null}
 	mkdir -p bootfs
--- a/sys/src/9/boot/bootrc
+++ b/sys/src/9/boot/bootrc
@@ -180,8 +180,12 @@
 if(~ $#usbwait 0)
 	sleep 2
 
-. /rc/lib/net.rc
-. /rc/lib/local.rc
+# load boot methods
+fn showlocaldevs {}
+fn configlocal {}
+for(i in /rc/lib/*.rc){
+	. $i
+}
 
 # add partitions and binds
 configlocal