shithub: riscv

Download patch

ref: 67bed722f21cb216a0fcc3d3ebebf161b09439d4
parent: 1d674abe9cdb20c59852fe096412a6890314f99a
author: cinap_lenrek <[email protected]>
date: Sun Dec 14 17:10:34 EST 2014

kernel: get rid of /boot/boot parametrization

there is no use for "bootdisk" variable parametrization
of /boot/boot and no point for the boot section with its
boot methods in the kernel configuration anymore. so
mkboot and boot$CONF.out are gone.

move the rules for bootfs.paq creation in 9/boot/bootmkfile.
location of bootfs.proto is now in 9/boot/bootfs.proto.
our /boot/boot target is now just "boot".

--- a/sys/src/9/alphapc/apc
+++ b/sys/src/9/alphapc/apc
@@ -55,12 +55,8 @@
 port
 	int cpuserver = 0;
 
-boot boot
-	tcp
-	local
-
 bootdir
-	boot$CONF.out	boot
 	/$objtype/bin/paqfs
 	/$objtype/bin/auth/factotum
 	bootfs.paq
+	boot
--- a/sys/src/9/alphapc/apccpu
+++ b/sys/src/9/alphapc/apccpu
@@ -49,12 +49,8 @@
 port
 	int cpuserver = 1;
 
-boot cpu
-	tcp
-
 bootdir
-	bootapccpu.out boot
-	/alpha/bin/ip/ipconfig
-	/alpha/bin/auth/factotum
-
-
+	/$objtype/bin/paqfs
+	/$objtype/bin/auth/factotum
+	bootfs.paq
+	boot
--- a/sys/src/9/bcm/picpuf
+++ b/sys/src/9/bcm/picpuf
@@ -45,12 +45,8 @@
 port
 	int cpuserver = 1;
 
-boot boot #S/sdM0/
-	local
-	tcp
-
 bootdir
-	boot$CONF.out	boot
 	/$objtype/bin/paqfs
 	/$objtype/bin/auth/factotum
 	bootfs.paq
+	boot
--- a/sys/src/9/bcm/pif
+++ b/sys/src/9/bcm/pif
@@ -45,12 +45,9 @@
 port
 	int cpuserver = 0;
 
-boot boot #S/sdM0/
-	local
-	tcp
-
 bootdir
-	boot$CONF.out	boot
 	/$objtype/bin/paqfs
 	/$objtype/bin/auth/factotum
 	bootfs.paq
+	boot
+
--- a/sys/src/9/bitsy/bitsy
+++ b/sys/src/9/bitsy/bitsy
@@ -41,9 +41,9 @@
 port
 	int cpuserver = 1;
 
-boot cpu
-boot
-	paq
 bootdir
-	bootbitsy.out	boot
-	/arm/bin/paqfs	paqfs
+	/$objtype/bin/paqfs
+	/$objtype/bin/auth/factotum
+	bootfs.paq
+	boot
+
--- a/sys/src/9/boot/boot.c
+++ b/sys/src/9/boot/boot.c
@@ -5,7 +5,7 @@
 #include "../boot/boot.h"
 
 void
-boot(int argc, char *argv[])
+main(int argc, char *argv[])
 {
 	char cputype[64];
 	char buf[32];
@@ -36,7 +36,6 @@
 	USED(argc);
 
 	readfile("#e/cputype", cputype, sizeof(cputype));
-	setenv("bootdisk", bootdisk, 0);
 
 	/* setup the boot namespace */
 	bind("/boot", "/bin", MAFTER);
--- a/sys/src/9/boot/boot.h
+++ b/sys/src/9/boot/boot.h
@@ -2,8 +2,6 @@
 	Debug = 0,
 };
 
-extern char*	bootdisk;
-
 extern void	fatal(char*);
 extern int	readfile(char*, char*, int);
 extern void	run(char*, ...);
--- /dev/null
+++ b/sys/src/9/boot/bootfs.proto
@@ -1,0 +1,58 @@
+$objtype
+	bin
+		9660srv
+		awk
+		auth
+			secstore
+		aux
+			kbdfs
+			wpa
+		bind
+		cat
+		cfs
+		cryptsetup
+		dd
+		disk
+			fdisk
+			prep
+		dossrv
+		echo
+		cwfs64x
+		grep
+		ip
+			ipconfig
+		ls
+		mkdir
+		mntgen
+		mount
+		mv
+		ndb
+			dnsgetip
+		hjfs
+		rc
+		rm
+		sed
+		sleep
+		srv
+		test
+		unmount
+		nusb
+			usbd
+			ether
+			disk
+			kb
+		xd
+rc
+	lib
+		rcmain
+		local.rc 555 sys sys ../boot/local.rc
+		net.rc 555 sys sys ../boot/net.rc
+	bin
+		fstype
+		diskparts
+		nusbrc 555 sys sys ../boot/nusbrc
+		bootrc 555 sys sys ../boot/bootrc
+tmp
+lib
+	firmware
+		+
--- a/sys/src/9/boot/bootmkfile
+++ b/sys/src/9/boot/bootmkfile
@@ -1,18 +1,29 @@
 BOOTDIR=../boot
-BOOTLIB=$BOOTDIR/libboot.a$O
 
 BOOTFILES=\
 	aux.$O\
 	boot.$O\
+	printstub.$O\
 
-$BOOTLIB(%.$O):N:	%.$O
-
-$BOOTLIB:	${BOOTFILES:%=$BOOTLIB(%)}
-	names=`{membername $newprereq}
-	ar vu $BOOTLIB $names
-	rm $names
-
 $BOOTFILES:	$BOOTDIR/boot.h
 
 %.$O:	$BOOTDIR/%.c
 	$CC -I$BOOTDIR $CFLAGS $BOOTDIR/$stem.c
+
+boot:	$BOOTFILES
+	$LD -o $target $BOOTFILES
+
+BOOTFSPROTO=$BOOTDIR/bootfs.proto
+
+bootfs.paq:	$BOOTFSPROTO \
+		`{disk/mkfs -s / -ax $BOOTFSPROTO >[2]/dev/null \
+			| awk '/^end of archive/{exit}{print $1}' \
+			| while(x=`{read}){test -f $x && echo $x}}
+	mkdir -p bootfs
+	disk/mkfs -s / -d bootfs $BOOTFSPROTO
+	@{
+		cd bootfs/$objtype/bin
+		strip * */* */*/* >[2]/dev/null || status=''
+	}
+	mkpaqfs -o $target bootfs
+	rm -rf bootfs
--- a/sys/src/9/boot/mkboot
+++ /dev/null
@@ -1,33 +1,0 @@
-#!/bin/rc
-#
-#  this file configures a boot program (/boot) for a kernel.
-#
-if(! ~ $#* 1){
-	echo usage: mkboot file >[1=2]
-	exit 1
-}
-
-cat <<'---'
-#include <u.h>
-#include <libc.h>
-#include "../boot/boot.h"
-
----
-
-awk '
-	BEGIN	{ bootprog = "boot"; bootdisk = "/dev/sdC0/"; }
-	$0 ~ "^boot" && $2=="cpu"\
-		{ if(NF == 4 && $3 == "boot")
-			bootdisk = $4
-		}
-	$0 ~ "^boot" && $2=="boot" && NF==3\
-		{ bootdisk = $3 }
-	END 	{ print "char* bootdisk = \"" bootdisk "\";"
-		  print "extern void " bootprog "(int, char**);"
-		  print "void"
-		  print "main(int argc, char **argv)"
-		  print "{"
-		  print "\t" bootprog "(argc, argv);"
-		  print "}"
-		}
-' $1
--- a/sys/src/9/kw/plug
+++ b/sys/src/9/kw/plug
@@ -66,12 +66,8 @@
 	int cpuserver = 1;
 	int i8250freq = 3686000;
 
-boot cpu
-	tcp
-	local
-
 bootdir
-	boot$CONF.out	boot
 	/$objtype/bin/paqfs
 	/$objtype/bin/auth/factotum
 	bootfs.paq
+	boot
--- a/sys/src/9/mtx/mtx
+++ b/sys/src/9/mtx/mtx
@@ -36,11 +36,11 @@
 port
 	int cpuserver = 0;
 
-boot
-	tcp
-
 bootdir
-	bootmtx.out boot
-	/power/bin/ip/ipconfig
-	/power/bin/auth/factotum
+	/$objtype/bin/paqfs
+	/$objtype/bin/auth/factotum
+	bootfs.paq
+	boot
+
+	
 
--- a/sys/src/9/mtx/mtxcpu
+++ b/sys/src/9/mtx/mtxcpu
@@ -36,11 +36,8 @@
 port
 	int cpuserver = 1;
 
-boot cpu
-	tcp
-
 bootdir
-	bootmtxcpu.out boot
-	ipconfig.hack ipconfig
-	factotum.hack factotum
-
+	/$objtype/bin/paqfs
+	/$objtype/bin/auth/factotum
+	bootfs.paq
+	boot
--- a/sys/src/9/omap/beagle
+++ b/sys/src/9/omap/beagle
@@ -69,12 +69,8 @@
 	int cpuserver = 1;
 	int i8250freq = 3686000;
 
-boot cpu
-	tcp
-	local
-
 bootdir
-	boot$CONF.out	boot
 	/$objtype/bin/paqfs
 	/$objtype/bin/auth/factotum
 	bootfs.paq
+	boot
--- a/sys/src/9/omap4/panda
+++ b/sys/src/9/omap4/panda
@@ -66,12 +66,8 @@
 port
 	int cpuserver = 1;
 
-boot cpu
-	tcp
-	local
-
 bootdir
-	boot$CONF.out	boot
 	/$objtype/bin/paqfs
 	/$objtype/bin/auth/factotum
 	bootfs.paq
+	boot
--- a/sys/src/9/pc/pccpuf
+++ b/sys/src/9/pc/pccpuf
@@ -142,12 +142,8 @@
 port
 	int cpuserver = 1;
 
-boot cpu
-	tcp
-	local
-
 bootdir
-	boot$CONF.out	boot
 	/$objtype/bin/paqfs
 	/$objtype/bin/auth/factotum
 	bootfs.paq
+	boot
--- a/sys/src/9/pc/pcf
+++ b/sys/src/9/pc/pcf
@@ -143,12 +143,8 @@
 port
 	int cpuserver = 0;
 
-boot boot
-	tcp
-	local
-
 bootdir
-	boot$CONF.out	boot
 	/$objtype/bin/paqfs
 	/$objtype/bin/auth/factotum
 	bootfs.paq
+	boot
--- a/sys/src/9/pc64/pc64
+++ b/sys/src/9/pc64/pc64
@@ -141,12 +141,8 @@
 port
 	int cpuserver = 0;
 
-boot boot
-	tcp
-	local
-
 bootdir
-	boot$CONF.out	boot
 	/$objtype/bin/paqfs
 	/$objtype/bin/auth/factotum
 	bootfs.paq
+	boot
--- a/sys/src/9/pc64/pccpu64
+++ b/sys/src/9/pc64/pccpu64
@@ -141,12 +141,8 @@
 port
 	int cpuserver = 1;
 
-boot boot
-	tcp
-	local
-
 bootdir
-	boot$CONF.out	boot
 	/$objtype/bin/paqfs
 	/$objtype/bin/auth/factotum
 	bootfs.paq
+	boot
--- a/sys/src/9/port/bootfs.proto
+++ /dev/null
@@ -1,58 +1,0 @@
-$objtype
-	bin
-		9660srv
-		awk
-		auth
-			secstore
-		aux
-			kbdfs
-			wpa
-		bind
-		cat
-		cfs
-		cryptsetup
-		dd
-		disk
-			fdisk
-			prep
-		dossrv
-		echo
-		cwfs64x
-		grep
-		ip
-			ipconfig
-		ls
-		mkdir
-		mntgen
-		mount
-		mv
-		ndb
-			dnsgetip
-		hjfs
-		rc
-		rm
-		sed
-		sleep
-		srv
-		test
-		unmount
-		nusb
-			usbd
-			ether
-			disk
-			kb
-		xd
-rc
-	lib
-		rcmain
-		local.rc 555 sys sys ../boot/local.rc
-		net.rc 555 sys sys ../boot/net.rc
-	bin
-		fstype
-		diskparts
-		nusbrc 555 sys sys ../boot/nusbrc
-		bootrc 555 sys sys ../boot/bootrc
-tmp
-lib
-	firmware
-		+
--- 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 bootfs.paq
+	rm -f *.[$OS] *.i *.root.s *.rootc.c cfs.h fs.h init.h conf.h *.out *.m errstr.h boot bootfs.paq
 	for(i in $CONFLIST $CRAPLIST)
 		mk $i.clean
 
@@ -87,21 +87,3 @@
 devsdp.$O:	../port/thwack.h
 devproc.$O sysproc.$O:	/sys/include/tos.h
 devproc.$O edf.$O proc.$O: /sys/include/trace.h
-
-boot$CONF.out: $CONF printstub.$O $BOOTLIB 
-	$BOOTDIR/mkboot $CONF > boot$CONF.c
-	$CC $CFLAGS boot$CONF.c
-	$LD -o boot$CONF.out boot$CONF.$O printstub.$O $BOOTLIB
-
-bootfs.paq:	../port/bootfs.proto \
-		`{disk/mkfs -s / -ax ../port/bootfs.proto >[2]/dev/null \
-			| awk '/^end of archive/{exit}{print $1}' \
-			| while(x=`{read}){test -f $x && echo $x}}
-	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
--- a/sys/src/9/ppc/blast
+++ b/sys/src/9/ppc/blast
@@ -37,9 +37,6 @@
 port
 	int cpuserver = 1;
 
-boot cpu
-	tcp
-
 bootdir
 	/power/bin/rc
 	/rc/lib/rcmain
--- a/sys/src/9/teg2/ts
+++ b/sys/src/9/teg2/ts
@@ -77,11 +77,8 @@
 	int cpuserver = 1;
 	int i8250freq = 3686000;
 
-boot cpu
-	tcp
-
 bootdir
-	boot$CONF.out	boot
 	/$objtype/bin/paqfs
 	/$objtype/bin/auth/factotum
 	bootfs.paq
+	boot
--- a/sys/src/9/xen/xenpcf
+++ b/sys/src/9/xen/xenpcf
@@ -49,14 +49,10 @@
 port
 	int cpuserver = 0;
 
-boot boot
-	tcp
-	local
-
 bootdir
-	boot$CONF.out	boot
 	/$objtype/bin/paqfs
 	/$objtype/bin/auth/factotum
 	bootfs.paq
+	boot
 	xenstore