From cde40efb0cd56b9b63b4096df46edead40291c42 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Wed, 15 Jun 2011 14:50:29 +0200 Subject: [PATCH] boot(8): add cfs support --- sys/src/9/boot/bootrc | 18 ++++++++++++++++-- sys/src/9/port/bootfs.proto | 2 ++ sys/src/9/port/portmkfile | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/sys/src/9/boot/bootrc b/sys/src/9/boot/bootrc index ccf4e809b..5fe86ee87 100644 --- a/sys/src/9/boot/bootrc +++ b/sys/src/9/boot/bootrc @@ -8,7 +8,7 @@ bind -q '#p' /proc 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 @@ fn main{ # 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/cfs + rm /srv/boot + mv /srv/cfs /srv/boot + } + } + # mount and change root in new enviroment and namespace rfork ne @@ -182,5 +196,5 @@ while(){ # 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 >[2]/dev/cons diff --git a/sys/src/9/port/bootfs.proto b/sys/src/9/port/bootfs.proto index 9b195a2e6..274103264 100644 --- a/sys/src/9/port/bootfs.proto +++ b/sys/src/9/port/bootfs.proto @@ -6,6 +6,7 @@ $cputype kbdfs bind cat + cfs cryptsetup dd disk @@ -22,6 +23,7 @@ $cputype mkdir mntgen mount + mv rc rm sed diff --git a/sys/src/9/port/portmkfile b/sys/src/9/port/portmkfile index 450fc82b6..2f5ab1d54 100644 --- a/sys/src/9/port/portmkfile +++ b/sys/src/9/port/portmkfile @@ -98,7 +98,7 @@ bootfs.paq: ../port/bootfs.proto 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