kernel: reorganize bootfs.paq generation

We do not want to unconditionally pull in all of
/lib/firmware, when we dont have the driver for it.

So group the files into separate proto-files
and make boot/bootmkfile simply checks that the basename
of a proto file matches the basename in $OBJ to be
considered.

This way, we can also avoid including user-space usb
daemon when the kernel lacks the usb driver.

Same for machines without devsd, devfs or devusb,
theres no disk so no reason to include disk file
servers.

The bootfs.paq file is specific to the configuration,
so give it a unique name. (Just using bootfs.paq
is fine as long as theres only a single configuration,
but i want to avoid future mistakes as people copy-paste
the kernel configuration).
This commit is contained in:
cinap_lenrek 2024-11-16 17:49:28 +00:00
parent a1b80da11f
commit d58ba675e7
27 changed files with 117 additions and 105 deletions

View file

@ -46,7 +46,7 @@ misc
port
int cpuserver = 0;
bootdir
boot
/$objtype/bin/paqfs
/$objtype/bin/auth/factotum
bootfs.paq
boot
$CONF.bootfs.paq bootfs.paq

View file

@ -55,7 +55,7 @@ port
int cpuserver = 0;
bootdir
boot
/$objtype/bin/paqfs
/$objtype/bin/auth/factotum
bootfs.paq
boot
$CONF.bootfs.paq bootfs.paq

View file

@ -55,7 +55,7 @@ port
int cpuserver = 0;
bootdir
boot
/$objtype/bin/paqfs
/$objtype/bin/auth/factotum
bootfs.paq
boot
$CONF.bootfs.paq bootfs.paq

View file

@ -61,7 +61,7 @@ port
int cpuserver = 0;
bootdir
boot
/$objtype/bin/paqfs
/$objtype/bin/auth/factotum
bootfs.paq
boot
$CONF.bootfs.paq bootfs.paq

View file

@ -66,7 +66,7 @@ port
int cpuserver = 0;
bootdir
boot
/$objtype/bin/paqfs
/$objtype/bin/auth/factotum
bootfs.paq
boot
$CONF.bootfs.paq bootfs.paq

View file

@ -1,6 +1,5 @@
$objtype
bin
9660srv
awk
auth
secstore
@ -12,15 +11,7 @@ $objtype
cfs
chmod
dd
disk
cryptsetup
edisk
fdisk
prep
dossrv
echo
cwfs64x
gefs
grep
ip
ipconfig
@ -31,7 +22,6 @@ $objtype
mv
ndb
dnsgetip
hjfs
rc
rm
sed
@ -40,24 +30,15 @@ $objtype
test
tlsclient
unmount
nusb
usbd
ether
disk
kb
xd
rc
lib
rcmain
reboot.rc 555 sys sys ../boot/reboot.rc
local.rc 555 sys sys ../boot/local.rc
net.rc 555 sys sys ../boot/net.rc
bin
fstype
diskparts
ethermultilink
srvtls
nusbrc 555 sys sys ../boot/nusbrc
bootrc 555 sys sys ../boot/bootrc
tmp
sys
@ -66,4 +47,3 @@ sys
+
lib
firmware
+

View file

@ -4,19 +4,26 @@ boot.$O: ../boot/boot.c
boot: boot.$O
$LD -o $target $prereq
# look for proto file in order:
# look for main proto file in order:
# 1) $CONF.bootfs.proto (config specific)
# 2) bootfs.proto (kernel specific)
# 3) ../boot/bootfs.proto (default generic)
#
BOOTFSPROTO=`{for(i in $CONF.bootfs.proto bootfs.proto ../boot/bootfs.proto) test -r $i && echo $i && exit}
# add driver specific proto files:
# ../boot/disk.proto (if the kernel has devsd, devfs or devusb driver)
# ../boot/*.proto (if the proto basename matches in $OBJ)
#
BOOTFSPROTOS=\
`{for(i in $CONF.bootfs.proto bootfs.proto ../boot/bootfs.proto) test -r $i && echo $i && exit} \
`{if(~ devfs.$O $OBJ || ~ devsd.$O $OBJ || ~ devusb.$O $OBJ) echo ../boot/disk.proto} \
`{for(j in ../boot/*.proto){~ `{basename $j .proto}^.$O $OBJ && echo $j}}
bootfs.paq: $BOOTFSPROTO `{disk/mkfs -aos / $BOOTFSPROTO >[2]/dev/null}
mkdir -p bootfs
disk/mkfs -s / -d bootfs $BOOTFSPROTO
$CONF.bootfs.paq bootfs.paq:D: $BOOTFSPROTOS `{disk/mkfs -aos / $BOOTFSPROTOS >[2]/dev/null}
mkdir -p $CONF.bootfs
disk/mkfs -s / -d $CONF.bootfs $BOOTFSPROTOS
@{
cd bootfs/$objtype/bin
cd $CONF.bootfs/$objtype/bin
#strip * */* */*/* >[2]/dev/null || status=''
}
mkpaqfs -9 -b 65536 -o $target bootfs
rm -rf bootfs
mkpaqfs -9 -b 65536 -o $target $CONF.bootfs
rm -rf $CONF.bootfs

View file

@ -0,0 +1,10 @@
$objtype
bin
nusb
usbd
ether
disk
kb
rc
bin
nusbrc 555 sys sys ../boot/nusbrc

19
sys/src/9/boot/disk.proto Normal file
View file

@ -0,0 +1,19 @@
$objtype
bin
9660srv
cfs
cwfs64x
disk
cryptsetup
edisk
fdisk
prep
dossrv
gefs
hjfs
rc
lib
local.rc 555 sys sys ../boot/local.rc
bin
fstype
diskparts

View file

@ -0,0 +1,19 @@
lib
firmware
bcmdhd.cal.40181
bcmdhd.cal.40183.26MHz
fw_bcm40183b1.bin
fw_bcm40183b2.bin
fw_bcm40181a0.bin
fw_bcm40181a2.bin
brcmfmac43430-sdio.bin
brcmfmac43430-sdio.txt
brcmfmac43436-sdio.bin
brcmfmac43436-sdio.txt
brcmfmac43436-sdio.clm_blob
brcmfmac43455-sdio.bin
brcmfmac43455-sdio.txt
brcmfmac43455-sdio.clm_blob
brcmfmac43456-sdio.bin
brcmfmac43456-sdio.txt
brcmfmac43456-sdio.clm_blob

View file

@ -0,0 +1,13 @@
lib
firmware
iwm-8265-34
iwm-9260-34
iwn-1000
iwn-4965
iwn-5000
iwn-5150
iwn-6000
iwn-6005
iwn-6030
iwn-6050
iwn-license

View file

@ -0,0 +1,3 @@
lib
firmware
ral-rt2860

View file

@ -0,0 +1,3 @@
lib
firmware
wpi-3945abg

View file

@ -51,7 +51,7 @@ port
int cpuserver = 0;
bootdir
boot
/$objtype/bin/paqfs
/$objtype/bin/auth/factotum
boot
bootfs.paq
$CONF.bootfs.paq bootfs.paq

View file

@ -60,7 +60,7 @@ misc
port
int cpuserver = 0;
bootdir
boot
/$objtype/bin/paqfs
/$objtype/bin/auth/factotum
bootfs.paq
boot
$CONF.bootfs.paq bootfs.paq

View file

@ -68,7 +68,7 @@ port
int i8250freq = 3686000;
bootdir
boot
/$objtype/bin/paqfs
/$objtype/bin/auth/factotum
bootfs.paq
boot
$CONF.bootfs.paq bootfs.paq

View file

@ -45,7 +45,7 @@ misc
port
int cpuserver = 0;
bootdir
boot
/$objtype/bin/paqfs
/$objtype/bin/auth/factotum
bootfs.paq
boot
$CONF.bootfs.paq bootfs.paq

View file

@ -50,8 +50,7 @@ port
int cpuserver = 0;
bootdir
boot
/$objtype/bin/paqfs
/$objtype/bin/auth/factotum
bootfs.paq
boot
# nvram
$CONF.bootfs.paq bootfs.paq

View file

@ -70,7 +70,7 @@ port
int i8250freq = 3686000;
bootdir
boot
/$objtype/bin/paqfs
/$objtype/bin/auth/factotum
bootfs.paq
boot
$CONF.bootfs.paq bootfs.paq

View file

@ -168,7 +168,7 @@ port
int cpuserver = 0;
bootdir
boot
/$objtype/bin/paqfs
/$objtype/bin/auth/factotum
bootfs.paq
boot
$CONF.bootfs.paq bootfs.paq

View file

@ -165,7 +165,7 @@ port
int cpuserver = 0;
bootdir
boot
/$objtype/bin/paqfs
/$objtype/bin/auth/factotum
bootfs.paq
boot
$CONF.bootfs.paq bootfs.paq

View file

@ -30,7 +30,7 @@ all:V:
mk 'CONF='$i
clean:V:
rm -f *.[$OS] *.i *.root.s *.rootc.c cfs.h fs.h conf.h *.out *.m errstr.h init.h reboot.h boot bootfs.paq
rm -f *.[$OS] *.i *.root.s *.rootc.c cfs.h fs.h conf.h *.out *.m errstr.h init.h reboot.h boot *.bootfs.paq bootfs.paq
for(i in $CONFLIST $CRAPLIST)
mk $i.clean

View file

@ -1,40 +0,0 @@
$objtype
bin
awk
auth
secstore
aux
kbdfs
bind
cat
chmod
dd
echo
grep
ip
ipconfig
ls
mkdir
mntgen
mount
mv
ndb
dnsgetip
ps
rc
rm
sed
sleep
srv
test
tlsclient
unmount
xd
rc
lib
rcmain
net.rc 555 sys sys ../boot/net.rc
bin
srvtls
bootrc 555 sys sys ../boot/bootrc
tmp

View file

@ -44,7 +44,7 @@ port
int cpuserver = 0;
bootdir
boot
/$objtype/bin/paqfs
/$objtype/bin/auth/factotum
boot
bootfs.paq
$CONF.bootfs.paq bootfs.paq

View file

@ -79,7 +79,7 @@ port
int i8250freq = 3686000;
bootdir
boot
/$objtype/bin/paqfs
/$objtype/bin/auth/factotum
bootfs.paq
boot
$CONF.bootfs.paq bootfs.paq

View file

@ -51,9 +51,8 @@ port
int cpuserver = 0;
bootdir
boot
/$objtype/bin/paqfs
/$objtype/bin/auth/factotum
bootfs.paq
boot
$CONF.bootfs.paq bootfs.paq
xenstore

View file

@ -53,7 +53,7 @@ port
int cpuserver = 0;
bootdir
boot
/$objtype/bin/paqfs
/$objtype/bin/auth/factotum
boot
bootfs.paq
$CONF.bootfs.paq bootfs.paq