inst: make bootsetup work for on pc architectures

This commit is contained in:
cinap_lenrek 2022-07-17 16:27:15 +00:00
parent c147614656
commit 23620b2e70
2 changed files with 58 additions and 28 deletions

View file

@ -22,16 +22,18 @@ if(~ $#p9part 0){
exit '' exit ''
} }
echo if(test -f /386/mbr){
echo 'If you use the Windows NT/2000/XP master boot record' echo
echo 'or a master boot record from a Unix clone (e.g., LILO or' echo 'If you use the Windows NT/2000/XP master boot record'
echo 'FreeBSD bootmgr), it is probably safe to continue using' echo 'or a master boot record from a Unix clone (e.g., LILO or'
echo 'that boot record rather than install the Plan 9 boot record.' echo 'FreeBSD bootmgr), it is probably safe to continue using'
echo echo 'that boot record rather than install the Plan 9 boot record.'
prompt 'Install the Plan 9 master boot record' yes no echo
switch($rd) { prompt 'Install the Plan 9 master boot record' yes no
case yes switch($rd) {
case yes
disk/mbr -m /386/mbr /dev/$disk/data disk/mbr -m /386/mbr /dev/$disk/data
}
} }
prompt 'Mark the Plan 9 partition active' yes no prompt 'Mark the Plan 9 partition active' yes no

View file

@ -30,16 +30,26 @@ case go
9fat=$rd 9fat=$rd
export 9fat export 9fat
if(~ $#bootfile 1){
bootfile=`{basename $bootfile} bootfile=`{basename $bootfile}
}
if(! ~ $#bootfile 1 || ! test -f /$cputype/$bootfile) {
bootfile=()
}
if(! test -f /tmp/plan9.ini) { if(! test -f /tmp/plan9.ini) {
@{ @{
if(~ $#bootfile 1)
echo 'bootfile='^$bootfile echo 'bootfile='^$bootfile
if(~ $#fs 1)
echo 'bootargs=local!'^$fs' '$"fsflags echo 'bootargs=local!'^$fs' '$"fsflags
if(~ $#nvram 1) if(~ $#nvram 1)
echo 'nvram='^$nvram echo 'nvram='^$nvram
if(~ $#mouseport 1)
echo 'mouseport='^$mouseport echo 'mouseport='^$mouseport
if(~ $#monitor 1)
echo 'monitor='^$monitor echo 'monitor='^$monitor
if(~ $#vgasize 1)
echo 'vgasize='^$vgasize echo 'vgasize='^$vgasize
cd '#ec' cd '#ec'
for(i in *){ for(i in *){
@ -72,32 +82,50 @@ case go
# always make backup of old bootsector # always make backup of old bootsector
logprog dd -bs 512 -count 1 -if $9fat -of /tmp/pbs.bak logprog dd -bs 512 -count 1 -if $9fat -of /tmp/pbs.bak
if (! test -f /386/pbs) {
if(~ $need9fatformat yes){ if(~ $need9fatformat yes){
log Initializing Plan 9 FAT partition. log Initializing Plan 9 FAT partition.
logprog disk/format -r 2 -d -b /n/newfs/386/pbs -l PLAN9 $9fat logprog disk/format -r 2 -d -l PLAN9 $9fat
}
}
if not {
if(~ $need9fatformat yes){
log Initializing Plan 9 FAT partition.
logprog disk/format -r 2 -d -b /386/pbs -l PLAN9 $9fat
} }
if not { if not {
log Updating bootsector. log Updating bootsector.
logprog disk/format -b /n/newfs/386/pbs $9fat logprog disk/format -b /386/pbs $9fat
}
} }
logprog mount -c /srv/dos /n/9fat $9fat logprog mount -c /srv/dos /n/9fat $9fat
logprog rm -f /n/9fat/^(9bootfat plan9.ini $bootfile) if(test -f /386/9bootfat) {
logprog rm -f /n/9fat/9bootfat
logprog cp /386/9bootfat /n/9fat/9bootfat
logprog cp /n/newfs/386/9bootfat /n/9fat/9bootfat
# make file continous on disk # make file continous on disk
logprog chmod +al /n/9fat/9bootfat logprog chmod +al /n/9fat/9bootfat
}
# copy config # copy config
logprog rm -f /n/9fat/plan9.ini
logprog cp /tmp/plan9.ini /n/9fat/plan9.ini logprog cp /tmp/plan9.ini /n/9fat/plan9.ini
# copy kernel # copy kernel
logprog cp /n/newfs/$cputype/$bootfile /n/9fat/ if(~ $#bootfile 1){
logprog rm -f /n/9fat/$bootfile
logprog cp /$cputype/$bootfile /n/9fat/$bootfile
}
# copy efi bootloader # copy efi bootloader
for(i in /386/*.efi){
if(test -f $i) {
logprog mkdir -p /n/9fat/efi/boot logprog mkdir -p /n/9fat/efi/boot
logprog cp /386/^(bootia32.efi bootx64.efi) /n/9fat/efi/boot logprog cp $i /n/9fat/efi/boot/
}
}
# copy in backups # copy in backups
if(test -f /tmp/oldplan9.ini) if(test -f /tmp/oldplan9.ini)