mirror of
git://git.9front.org/plan9front/plan9front
synced 2025-01-12 11:10:06 +00:00
d76c9642e0
Currently we place efi boot binaries on to the 9fat and hope that the firmware will look in more places than just the esp. Based on user reports we've found that it is quite common for firmware to only search the esp.
83 lines
2.1 KiB
Bash
Executable file
83 lines
2.1 KiB
Bash
Executable file
#!/bin/rc
|
|
|
|
# desc: edit partition tables (e.g., to create a plan 9 partition)
|
|
# prereq: configfs
|
|
|
|
switch($1){
|
|
case go
|
|
disks=`{ls /dev/sd*/data >[2]/dev/null | sed 's!/dev/(sd.*)/data!\1!'}
|
|
if(~ $#disks 0) {
|
|
echo 'No disk devices were found on your system.'
|
|
echo 'The installation process cannot continue.'
|
|
exit giveup
|
|
}
|
|
|
|
echo 'The following disk devices were found.'
|
|
echo
|
|
for(i in $disks) {
|
|
desc=`{cat /dev/$i/ctl | sed 1q | sed 's/inquiry //'}
|
|
echo $i '-' $desc
|
|
@{disk/edisk -r /dev/$i/data
|
|
||disk/fdisk -r /dev/$i/data} </dev/null >[2]/dev/null | grep -v '^ mbr'
|
|
echo
|
|
}
|
|
|
|
okay=no
|
|
defdisk=$disks(1)
|
|
|
|
if(~ $#disks 1)
|
|
default=(-d $disks)
|
|
if not
|
|
default=()
|
|
prompt $default 'Disk to partition' $disks
|
|
disk=$rd
|
|
|
|
diskedit=disk/fdisk
|
|
if(disk/edisk -p /dev/$disk/data >/dev/null >[2=1])
|
|
diskedit=disk/edisk
|
|
|
|
if(~ $diskedit disk/fdisk && ! ./hasmbr /dev/$disk/data) {
|
|
echo 'The disk you selected HAS NO master boot record on its first sector.'
|
|
echo '(Perhaps it is a completely blank disk.)'
|
|
echo 'Shall we create a blank EFI partition table (GPT)'
|
|
echo 'or install traditional DOS partition table (MBR)?'
|
|
echo
|
|
prompt 'Install mbr or gpt' mbr gpt
|
|
switch($rd) {
|
|
case mbr
|
|
disk/mbr -m /386/mbr /dev/$disk/data
|
|
case gpt
|
|
disk/edisk -bw /dev/$disk/data
|
|
diskedit=disk/edisk
|
|
}
|
|
}
|
|
|
|
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'
|
|
echo 'suggested; you can probably just type ''w'' and then ''q''.'
|
|
echo
|
|
$diskedit -a /dev/$disk/data
|
|
$diskedit -p /dev/$disk/data >/dev/$disk/ctl >[2]/dev/null
|
|
for(i in /dev/sd*/plan9*){
|
|
if(test -f $i){
|
|
d=`{basename -d $i}
|
|
disk/prep -p $i >$d/ctl >[2]/dev/null
|
|
}
|
|
}
|
|
|
|
case checkdone
|
|
# we want at least one disk that is both bootable and contains a Plan 9 partition
|
|
bootandplan9=0
|
|
disks=`{ls /dev/sd*/plan9 >[2]/dev/null | sed 's!/dev/(sd.*)/plan9!\1!'}
|
|
for(disk in $disks) {
|
|
if(test -f /dev/$disk/esp)
|
|
bootandplan9=1
|
|
if not if(./hasmbr /dev/$disk/data)
|
|
bootandplan9=1
|
|
}
|
|
if(~ $bootandplan9 0){
|
|
partdisk=notdone
|
|
export partdisk
|
|
}
|
|
}
|