diff options
| author | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-05-19 18:48:06 +0200 |
|---|---|---|
| committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-05-19 18:48:06 +0200 |
| commit | 225b573624549303609411ab87a6e923964a50c1 (patch) | |
| tree | aa001b956939e20a622750dbfc48ae440a399290 | |
| parent | c911310a8b731d20a603d7710003e44b7ff7c8b8 (diff) | |
| download | plan9front-225b573624549303609411ab87a6e923964a50c1.tar.xz | |
9boot: add iso hybrid loader 9boothyb
| -rw-r--r-- | sys/src/boot/pc/iso.c | 19 | ||||
| -rw-r--r-- | sys/src/boot/pc/mkfile | 28 |
2 files changed, 42 insertions, 5 deletions
diff --git a/sys/src/boot/pc/iso.c b/sys/src/boot/pc/iso.c index 48caadc69..e6a483902 100644 --- a/sys/src/boot/pc/iso.c +++ b/sys/src/boot/pc/iso.c @@ -39,6 +39,23 @@ struct Dir int readsect(ulong drive, ulong lba, void *buf); +#ifdef FAT +int +readsect4(ulong drive, ulong lba, void *buf) +{ + int i; + + lba *= Sectsz/512; + for(i = 0; i<Sectsz/512; i++){ + if(readsect(drive, lba++, buf)) + return -1; + buf = (uchar*)buf + 512; + } + return 0; +} +#define readsect readsect4 +#endif + void unload(void) { @@ -145,6 +162,7 @@ start(void *sp) /* drive passed in DL */ drive = ((ushort*)sp)[5] & 0xFF; +#ifndef FAT /* * load full bootblock as only the frist 2K get * loaded from bios. the code is specially arranged @@ -159,6 +177,7 @@ start(void *sp) } readn(&ex, origin, ex.len); close(&ex); +#endif if(isowalk(f = &ex, drive, "/cfg/plan9.ini")){ print("no config\n"); diff --git a/sys/src/boot/pc/mkfile b/sys/src/boot/pc/mkfile index 1fbc90223..c5b00d246 100644 --- a/sys/src/boot/pc/mkfile +++ b/sys/src/boot/pc/mkfile @@ -2,11 +2,11 @@ objtype=386 </$objtype/mkfile BIN=/386 -TARG=9bootiso 9bootpxe 9bootfat mbr pbs +TARG=9bootiso 9bootpxe 9bootfat 9boothyb mbr pbs HFILES=mem.h fns.h x16.h -all: 9bootiso 9bootpxe 9bootfat mbr pbs +all: 9bootiso 9bootpxe 9bootfat 9boothyb mbr pbs clean:V: rm -rf $TARG *.$O test.* tmp @@ -20,6 +20,12 @@ lpxe.$O: l.s lfat.$O: l.s $AS -DFAT -o $target l.s +lhyb.$O: l.s + $AS -DFAT -o $target l.s + +hyb.$O: iso.c + $CC $CFLAGS -DFAT -o $target iso.c + %.$O: %.s $AS $stem.s @@ -50,8 +56,7 @@ install:V: $BIN/%: % cp $stem $BIN/$stem - -test.iso: 9bootiso +test.iso: 9bootiso 9boothyb 9bootfat mbr pbs rm -fr tmp $target mkdir tmp mkdir tmp/386 @@ -60,7 +65,20 @@ test.iso: 9bootiso cp /386/9pcf tmp/386 cp /sys/lib/dist/cfg/plan9.ini tmp/cfg/plan9.ini echo wait >>tmp/cfg/plan9.ini - disk/mk9660 -B 386/9bootiso -p /sys/lib/sysconfig/proto/allproto -s tmp $target + disk/mk9660 -B 386/9bootiso -p <{echo +} -s tmp $target + @{rfork n + bind 9boothyb 9bootfat + dd -if /dev/zero -bs 512 -count 4096 >> $target + disk/partfs -m /n/partfs $target + disk=/n/partfs/sdXX + disk/mbr -m mbr $disk/data + @{echo a p1 '$-1' '$' + echo t p1 FAT16 + echo A p1 + echo w + echo q} | disk/fdisk -b $disk/data + disk/format -b pbs -d -r 1 $disk/dos 9bootfat + } rm -fr tmp test.dsk: 9bootfat mbr pbs test.iso |
