* [9front] rpi inst patch
@ 2022-05-12 4:13 Eli Cohen
0 siblings, 0 replies; only message in thread
From: Eli Cohen @ 2022-05-12 4:13 UTC (permalink / raw)
To: 9front
[-- Attachment #1: Type: text/plain, Size: 145 bytes --]
I have changed inst to work for rpi, as people seem to ask about that
a lot. another change it might need is to have /386/mbr present for
fdisk.
[-- Attachment #2.1: Type: text/plain, Size: 385 bytes --]
from postmaster@9front:
The following attachment had content that we can't
prove to be harmless. To avoid possible automatic
execution, we changed the content headers.
The original header was:
Content-Type: text/x-patch; charset="US-ASCII"; name="rpi.inst.diff"
Content-Disposition: attachment; filename="rpi.inst.diff"
Content-Transfer-Encoding: base64
Content-ID: <f_l32hx9tg0>
[-- Attachment #2.2: rpi.inst.diff.suspect --]
[-- Type: application/octet-stream, Size: 6715 bytes --]
diff f84cf1e60427675514fb056cc1723e45da01e043 uncommitted
--- a/rc/bin/inst/bootsetup
+++ b/rc/bin/inst/bootsetup
@@ -4,7 +4,7 @@
# prereq: copydist
fats=()
-for(i in /dev/sd*/9fat){
+for(i in /dev/sd*/9fat /dev/sd*/dos){
if(test -f $i)
fats=($fats $i)
}
@@ -19,7 +19,10 @@
case go
echo
- echo 'Setup Plan 9 FAT boot partition (9fat)'
+ if(~ $objtype 386 amd64)
+ echo 'Setup Plan 9 FAT boot partition (9fat)'
+ if not
+ echo 'Setup Plan 9 pidos boot partition'
echo
if(~ $#fats 1)
@@ -30,82 +33,130 @@
9fat=$rd
export 9fat
- bootfile=`{basename $bootfile}
+ if(~ $objtype 386 amd64){
+ bootfile=`{basename $bootfile}
- if(! test -f /tmp/plan9.ini) {
- @{
- echo 'bootfile='^$bootfile
- echo 'bootargs=local!'^$fs' '$"fsflags
- if(~ $#nvram 1)
- echo 'nvram='^$nvram
- echo 'mouseport='^$mouseport
- echo 'monitor='^$monitor
- echo 'vgasize='^$vgasize
- cd '#ec'
- for(i in *){
- echo -n $"i'='
- cat $i
- echo
- } | grep -v '(apm0|e820|bootfile|bootargs|bootscreen|nvram|mouseport|monitor|vgasize|cdboot)'
- } >/tmp/plan9.ini
- }
+ if(! test -f /tmp/plan9.ini) {
+ @{
+ echo 'bootfile='^$bootfile
+ echo 'bootargs=local!'^$fs' '$"fsflags
+ if(~ $#nvram 1)
+ echo 'nvram='^$nvram
+ echo 'mouseport='^$mouseport
+ echo 'monitor='^$monitor
+ echo 'vgasize='^$vgasize
+ cd '#ec'
+ for(i in *){
+ echo -n $"i'='
+ cat $i
+ echo
+ } | grep -v '(apm0|e820|bootfile|bootargs|bootscreen|nvram|mouseport|monitor|vgasize|cdboot)'
+ } >/tmp/plan9.ini
+ }
- # clean state
- rm -f /tmp/oldplan9.ini /tmp/pbs.bak
- unmount /n/9fat >[2]/dev/null
+ # clean state
+ rm -f /tmp/oldplan9.ini /tmp/pbs.bak
+ unmount /n/9fat >[2]/dev/null
- if(! test -f /srv/dos)
- dossrv
+ if(! test -f /srv/dos)
+ dossrv
- need9fatformat=yes
- if(~ `{fstype $9fat} dos){
- if(mount /srv/dos /n/9fat $9fat >[2]/dev/null){
- if(cp /n/9fat/plan9.ini /tmp/oldplan9.ini >[2]/dev/null)
- need9fatformat=no
- unmount /n/9fat >[2]/dev/null
+ need9fatformat=yes
+ if(~ `{fstype $9fat} dos){
+ if(mount /srv/dos /n/9fat $9fat >[2]/dev/null){
+ if(cp /n/9fat/plan9.ini /tmp/oldplan9.ini >[2]/dev/null)
+ need9fatformat=no
+ unmount /n/9fat >[2]/dev/null
- # make sure dossrv is gone
- sleep 1
+ # make sure dossrv is gone
+ sleep 1
+ }
}
- }
- # always make backup of old bootsector
- logprog dd -bs 512 -count 1 -if $9fat -of /tmp/pbs.bak
+ # always make backup of old bootsector
+ logprog dd -bs 512 -count 1 -if $9fat -of /tmp/pbs.bak
- if(~ $need9fatformat yes){
- log Initializing Plan 9 FAT partition.
- logprog disk/format -r 2 -d -b /n/newfs/386/pbs -l PLAN9 $9fat
- }
- if not {
- log Updating bootsector.
- logprog disk/format -b /n/newfs/386/pbs $9fat
- }
+ if(~ $need9fatformat yes){
+ log Initializing Plan 9 FAT partition.
+ logprog disk/format -r 2 -d -b /n/newfs/386/pbs -l PLAN9 $9fat
+ }
+ if not {
+ log Updating bootsector.
+ logprog disk/format -b /n/newfs/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)
+ logprog rm -f /n/9fat/^(9bootfat plan9.ini $bootfile)
- logprog cp /n/newfs/386/9bootfat /n/9fat/9bootfat
- # make file continous on disk
- logprog chmod +al /n/9fat/9bootfat
+ logprog cp /n/newfs/386/9bootfat /n/9fat/9bootfat
+ # make file continous on disk
+ logprog chmod +al /n/9fat/9bootfat
- # copy config
- logprog cp /tmp/plan9.ini /n/9fat/plan9.ini
+ # copy config
+ logprog cp /tmp/plan9.ini /n/9fat/plan9.ini
- # copy kernel
- logprog cp /n/newfs/$cputype/$bootfile /n/9fat/
+ # copy kernel
+ logprog cp /n/newfs/$cputype/$bootfile /n/9fat/
- # copy efi bootloader
- logprog mkdir -p /n/9fat/efi/boot
- logprog cp /386/^(bootia32.efi bootx64.efi) /n/9fat/efi/boot
+ # copy efi bootloader
+ logprog mkdir -p /n/9fat/efi/boot
+ logprog cp /386/^(bootia32.efi bootx64.efi) /n/9fat/efi/boot
- # copy in backups
- if(test -f /tmp/oldplan9.ini)
- logprog cp /tmp/oldplan9.ini /n/9fat
- if(test -f /tmp/pbs.bak)
- logprog cp /tmp/pbs.bak /n/9fat
+ # copy in backups
+ if(test -f /tmp/oldplan9.ini)
+ logprog cp /tmp/oldplan9.ini /n/9fat
+ if(test -f /tmp/pbs.bak)
+ logprog cp /tmp/pbs.bak /n/9fat
- logprog unmount /n/9fat
+ logprog unmount /n/9fat
+ }
+ if not if(~ $objtype arm){
+ bootcode=/sys/src/boot/bcm/^(bootcode.bin fixup_cd.dat start_cd.elf LICENCE.broadcom)
+ kernels=/$objtype/^(9pi 9pi2)
+ > /env/config.txt {
+ echo '[pi0]'
+ echo 'kernel=9pi'
+ echo '[pi1]'
+ echo 'kernel=9pi'
+ echo '[pi2]'
+ echo 'kernel=9pi2'
+ echo '[pi3]'
+ echo 'kernel=9pi2'
+ echo 'core_freq=250'
+ echo '[all]'
+ echo 'gpu_mem=16'
+ echo 'enable_uart=1'
+ echo 'boot_delay=1'
+ }
+ > /env/cmdline.txt {
+ echo 'console=0'
+ }
+ }
+ if not if(~ $objtype arm64){
+ bootcode=/sys/src/boot/bcm/^(bootcode.bin fixup_cd.dat start_cd.elf fixup4cd.dat start4cd.elf bcm2711-rpi-4-b.dtb LICENCE.broadcom)
+ kernels=/$objtype/^(9pi3 9pi4)
+ > /env/config.txt {
+ echo '[pi4]'
+ echo 'kernel=9pi4'
+ echo 'arm_64bit=1'
+ echo '[pi3]'
+ echo 'kernel=9pi3'
+ echo 'arm_64bit=1'
+ echo '[all]'
+ echo 'gpu_mem=16'
+ echo 'core_freq=250'
+ echo 'enable_uart=1'
+ echo 'boot_delay=1'
+ }
+ > /env/cmdline.txt {
+ echo 'console=0'
+ }
+ }
+ if(~ $objtype arm arm64){
+ fatfiles=(/env/config.txt /env/cmdline.txt $bootcode $kernels)
+ disk/format -d $9fat $fatfiles
+ }
disk=`{basename `{basename -d $9fat}}
if(./bootplan9){
--- a/rc/bin/inst/partdisk
+++ b/rc/bin/inst/partdisk
@@ -52,6 +52,15 @@
}
}
+ if(~ $objtype arm arm64){
+ {
+ echo a p1 0 .+100M
+ echo t p1 FAT32
+ echo w
+ echo q
+ } | $diskedit /dev/sdM0/data
+ }
+
echo
echo 'This is '$diskedit'; use it to create a Plan 9 partition.'
echo 'If there is enough room, a Plan 9 partition will be'
--- a/rc/bin/inst/prepdisk
+++ b/rc/bin/inst/prepdisk
@@ -4,17 +4,22 @@
# prereq: partdisk
fn autotype {
+ d='-a 9fat -a nvram'
+ if(~ $objtype arm arm64)
+ d='-a nvram'
+
switch($fstype){
case cwfs cwfs64 cwfs64x
- echo -a 9fat -a nvram -a fscache -a fsworm -a other
+ echo $d -a fscache -a fsworm -a other
case hjfs
- echo -a 9fat -a nvram -a fs
+ echo $d -a fs
}
}
switch($1) {
case checkready
- if(! test -f /dev/sd*/plan9*){
+ p=/dev/sd*/plan9*
+ if(! test -f $p(1) ){
prepdisk=notdone
export prepdisk
}
@@ -43,7 +48,8 @@
disk/prep -p $disk >`{basename -d $disk}^/ctl >[2]/dev/null
case checkdone
- if(! test -f /dev/sd*/9fat)
+ p=/dev/sd*/plan9*
+ if(! test -f $p(1) )
prepdisk=ready
if(! ~ $prepdisk ready)
prepdisk=done
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-12 4:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 4:13 [9front] rpi inst patch Eli Cohen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).