shithub: riscv

Download patch

ref: 792b186b3a1d3360592d085062cab81d725f76c7
parent: f83d4972db310ce49036b4aae5d0c1da22ca95b9
author: cinap_lenrek <cinap_lenrek@centraldogma>
date: Sat Jun 4 01:19:29 EDT 2011

boot(8): replace bzfs with paqfs

--- a/sys/src/9/alphapc/apc
+++ b/sys/src/9/alphapc/apc
@@ -55,12 +55,12 @@
 port
 	int cpuserver = 0;
 
-boot
+boot boot
 	tcp
+	local
 
 bootdir
-	bootapc.out boot
-	/alpha/bin/disk/kfs
-	/alpha/bin/auth/factotum
-	/alpha/bin/ip/ipconfig
-
+	boot$CONF.out	boot
+	/$objtype/bin/paqfs
+	/$objtype/bin/auth/factotum
+	bootfs.paq
--- a/sys/src/9/alphapc/mkfile
+++ b/sys/src/9/alphapc/mkfile
@@ -76,9 +76,6 @@
 install:V: $p$CONF
 	cp $p$CONF /$objtype/$p$CONF
 
-rootfs.bz2:
-	rc ../port/mkbootfs
-
 <../boot/bootmkfile
 <../port/portmkfile
 <|../port/mkbootrules $CONF
--- a/sys/src/9/boot/boot.c
+++ b/sys/src/9/boot/boot.c
@@ -16,6 +16,7 @@
 {
 	Waitmsg *w;
 	int pid, i;
+	char buf[32];
 
 	fmtinstall('r', errfmt);
 
@@ -54,10 +55,10 @@
 	setenv("bootdisk", bootdisk, 0);
 	
 	/* setup the boot namespace */
-	run("/boot/mntgen", "-s", "slash", "/mnt", nil);
-	run("/boot/bzfs", "-f", "/boot/rootfs.bz2", "-m", "/mnt/broot", nil);
-	bind("/mnt/broot", "/", MAFTER);
-	bind("/386/bin", "/bin", MAFTER);
+	run("/boot/paqfs", "-m" "/root", "/boot/bootfs.paq", nil);
+	bind("/root", "/", MAFTER);
+	snprint(buf, sizeof(buf), "/%s/bin", cputype);
+	bind(buf, "/bin", MAFTER);
 	bind("/rc/bin", "/bin", MAFTER);
 	bind("/boot", "/bin", MAFTER);
 
--- a/sys/src/9/boot/bootrc
+++ b/sys/src/9/boot/bootrc
@@ -1,5 +1,11 @@
 #!/bin/rc
 
+mntgen -s slash /mnt
+bind /root /mnt/broot
+unmount /root
+
+ramfs
+
 bind -q '#p' /proc
 
 for(i in S f k æ t){
@@ -99,6 +105,7 @@
 	# remove part of our temporary root
 	/mnt/broot/$cputype/bin/unmount /$cputype/bin /bin
 	/mnt/broot/$cputype/bin/unmount /rc/bin /bin
+	/mnt/broot/$cputype/bin/unmount /tmp
 	/mnt/broot/$cputype/bin/unmount /
 
 	# create the name space, mount the root fs
--- a/sys/src/9/kw/plug
+++ b/sys/src/9/kw/plug
@@ -66,15 +66,12 @@
 	int cpuserver = 1;
 	int i8250freq = 3686000;
 
-boot cpu
+boot boot
 	tcp
-#	paq
+	local
 
 bootdir
-	boot$CONF.out boot
-	/arm/bin/ip/ipconfig
-	/arm/bin/auth/factotum
-#	/arm/bin/paqfs
-	/arm/bin/usb/usbd
-# nvram not needed any longer, it's in flash
-	nvram
+	boot$CONF.out	boot
+	/$objtype/bin/paqfs
+	/$objtype/bin/auth/factotum
+	bootfs.paq
--- a/sys/src/9/omap/beagle
+++ b/sys/src/9/omap/beagle
@@ -69,13 +69,12 @@
 	int cpuserver = 1;
 	int i8250freq = 3686000;
 
-boot cpu
+boot boot
 	tcp
 	local
 
 bootdir
-	boot$CONF.out boot
-	/arm/bin/bzfs
-	/arm/bin/mntgen
-	/arm/bin/auth/factotum
-	rootfs.bz2
+	boot$CONF.out	boot
+	/$objtype/bin/paqfs
+	/$objtype/bin/auth/factotum
+	bootfs.paq
--- a/sys/src/9/omap/mkfile
+++ b/sys/src/9/omap/mkfile
@@ -92,9 +92,6 @@
 	wait
 	touch $target
 
-rootfs.bz2:
-	rc ../port/mkbootfs
-
 <../boot/bootmkfile
 <../port/portmkfile
 <|../port/mkbootrules $CONF
--- a/sys/src/9/pc/mkfile
+++ b/sys/src/9/pc/mkfile
@@ -77,9 +77,6 @@
 	$LD -o $target -T$KTZERO -l $OBJ $CONF.$O $LIB
 	size $target
 
-rootfs.bz2:
-	rc ../port/mkbootfs
-
 # don't strip the gzipped kernels -- too frustrating when that's all you have!
 $p%.gz:D:	$p%
 	gzip -9 <$p$stem >$p$stem.gz
@@ -188,13 +185,3 @@
 
 %.clean:V:
 	rm -f $stem.c [9bz]$stem [9bz]$stem.gz boot$stem.* reboot.h apbootstrap.h init.h
-
-# testing
-9load:D: /usr/rsc/boot/$O.load 9pcload
-	cat $prereq >$target
-
-9load.flp: 9load
-	disk/format -b /386/pbs -df $target $prereq
-
-$p$CONF.flp: /386/9load plan9.ini $p$CONF.gz
-	disk/format -b /386/pbs -df $target $prereq
--- a/sys/src/9/pc/pccpuf
+++ b/sys/src/9/pc/pccpuf
@@ -118,13 +118,12 @@
 port
 	int cpuserver = 1;
 
-boot cpu boot #S/sdC0/
+boot boot
 	tcp
 	local
 
 bootdir
-	bootpccpuf.out boot
-	/386/bin/bzfs
-	/386/bin/mntgen
-	/386/bin/auth/factotum
-	rootfs.bz2
+	boot$CONF.out	boot
+	/$objtype/bin/paqfs
+	/$objtype/bin/auth/factotum
+	bootfs.paq
--- a/sys/src/9/pc/pcf
+++ b/sys/src/9/pc/pcf
@@ -127,13 +127,12 @@
 port
 	int cpuserver = 0;
 
-boot boot #S/sdC0/
+boot boot
 	tcp
 	local
 
 bootdir
-	bootpcf.out boot
-	/386/bin/bzfs
-	/386/bin/mntgen
-	/386/bin/auth/factotum
-	rootfs.bz2
+	boot$CONF.out	boot
+	/$objtype/bin/paqfs
+	/$objtype/bin/auth/factotum
+	bootfs.paq
--- a/sys/src/9/port/bootfs.proto
+++ b/sys/src/9/port/bootfs.proto
@@ -5,7 +5,6 @@
 		aux
 			kbdfs
 		bind
-		bzfs
 		cat
 		cryptsetup
 		dd
@@ -23,6 +22,7 @@
 			ipconfig
 		ls
 		mkdir
+		mntgen
 		mount
 		ramfs
 		rc
--- a/sys/src/9/port/mkbootfs
+++ /dev/null
@@ -1,39 +1,0 @@
-#!/bin/rc
- 
-fn bootraw {
-	proto=../port/bootfs.proto
-	mkdir bootfs
-
-	aux/stub /sys/log/timesync
-	bind /dev/null /sys/log/timesync
-	# make files writable for now.
-	cat $proto | sed 's!d000!d775!;s!000!664!;s!555!775!;s!444!664!' > proto.cp
-	disk/mkfs -a proto.cp | disk/mkext -d bootfs
-	@{
-		cd bootfs/386/bin
-		strip * */* >[2]/dev/null || status=''
-	}
-	disk/mkfs -a -s bootfs proto.cp >boot.raw
-	rm proto.cp
-}
-
-fn bootbz2 {
-	aux/bflz -n 32 < boot.raw >boot.bflz
-	bzip2 -9 < boot.bflz >boot.bz2
-	rm boot.raw boot.bflz
-}
-
-fn rootbz2 {
-	{
-		echo bzfilesystem
-		cat boot.bz2
-		dd -if /dev/zero -bs 1024 -count 1 >[2]/dev/null
-	} >rootfs.bz2
-	ls -l rootfs.bz2
-	rm boot.bz2
-}
-
-bootraw
-bootbz2
-rootbz2
-rm -rf bootfs
--- a/sys/src/9/port/portmkfile
+++ b/sys/src/9/port/portmkfile
@@ -30,7 +30,7 @@
 		mk 'CONF='$i
 
 clean:V:
-	rm -f *.[$OS] *.i *.root.s *.rootc.c cfs.h fs.h init.h conf.h *.out *.m errstr.h rootfs.bz2
+	rm -f *.[$OS] *.i *.root.s *.rootc.c cfs.h fs.h init.h conf.h *.out *.m errstr.h bootfs.paq
 	for(i in $CONFLIST $CRAPLIST)
 		mk $i.clean
 
@@ -92,3 +92,13 @@
 	$CC $CFLAGS boot$CONF.c
 	$CC $CFLAGS ../boot/printstub.c
 	$LD -o boot$CONF.out boot$CONF.$O $BOOTLIB printstub.$O
+
+bootfs.paq:	../port/bootfs.proto
+	mkdir -p bootfs
+	disk/mkfs -s / -d bootfs ../port/bootfs.proto
+	@{
+		cd bootfs/$objtype/bin
+		strip * */* >[2]/dev/null || status=''
+	}
+	mkpaqfs -o $target bootfs
+	rm -rf bootfs