shithub: riscv

Download patch

ref: cde40efb0cd56b9b63b4096df46edead40291c42
parent: 21ede7960fcb7f30ed9bf14e618190529d2f77d1
author: cinap_lenrek <cinap_lenrek@localhost>
date: Wed Jun 15 10:50:29 EDT 2011

boot(8): add cfs support

--- a/sys/src/9/boot/bootrc
+++ b/sys/src/9/boot/bootrc
@@ -8,7 +8,7 @@
 for(i in S f k æ t)
 	bind -a '#'^$i /dev >/dev/null >[2=1]
 
-for(i in init sysname user nvram rootdir bootdisk bootargs \
+for(i in init sysname user nvram rootdir cfs bootdisk bootargs \
 	nobootprompt debugfactotum \
 	fs fsaddr auth authaddr){
 	a=$$i
@@ -93,6 +93,20 @@
 	# connect method
 	$mp(2) $ma
 
+	# insert cfs in the pipeline
+	if(test -x /bin/cfs){
+		if(~ $#bootdisk 1 && ~ $#cfs 0)
+			cfs=$bootdisk/cache
+		if(~ $#cfs 1 && ! ~ $cfs off && test -f $cfs){
+			x=(/bin/cfs -s -f $cfs)
+			if(~ -f $ff)
+				x=($x -r)
+			{$x </srv/boot &} | echo 0 >/srv/cfs
+			rm /srv/boot
+			mv /srv/cfs /srv/boot
+		}
+	}
+
 	# mount and change root in new enviroment and namespace
 	rfork ne
 
@@ -182,5 +196,5 @@
 	# cleanup so it can be restarted
 	nobootprompt=()
 	user=()
-	rm -f /srv/boot /srv/slashn /srv/cs /srv/dns
+	rm -f /srv/cfs /srv/boot /srv/slashn /srv/cs /srv/dns
 } </dev/cons >/dev/cons >[2]/dev/cons 
--- a/sys/src/9/port/bootfs.proto
+++ b/sys/src/9/port/bootfs.proto
@@ -6,6 +6,7 @@
 			kbdfs
 		bind
 		cat
+		cfs
 		cryptsetup
 		dd
 		disk
@@ -22,6 +23,7 @@
 		mkdir
 		mntgen
 		mount
+		mv
 		rc
 		rm
 		sed
--- a/sys/src/9/port/portmkfile
+++ b/sys/src/9/port/portmkfile
@@ -98,7 +98,7 @@
 	disk/mkfs -s / -d bootfs ../port/bootfs.proto
 	@{
 		cd bootfs/$objtype/bin
-		strip * */* >[2]/dev/null || status=''
+		strip * */* */*/* >[2]/dev/null || status=''
 	}
 	mkpaqfs -o $target bootfs
 	rm -rf bootfs