dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit 5b28ee7cb542cfe4c24c48898f869c4f0fbd06ef
parent 2a73a534610193d46664a9b52fff12a0e26bd0d6
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Wed, 21 Jun 2023 12:05:29 -0400

rpi: booting from FAT!

Not quite done yet with the booting sequence, but the important parts are there.
More importantly: it works on real hardware!

Mfs/doc/hw/arm/rpi/rpi.txt | 17+++++++++++++++--
Mfs/xcomp/arm/rpi/build.fs | 6+-----
Mfs/xcomp/arm/rpi/glue.fs | 5++++-
Mfs/xcomp/arm/rpi/init.fs | 7++++---
4 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/fs/doc/hw/arm/rpi/rpi.txt b/fs/doc/hw/arm/rpi/rpi.txt @@ -11,12 +11,25 @@ through QEMU's monitor by pressing CTRL-A, then C. From there, you can type ## Deploying on a real machine To deploy on a real machine, you need a SD card with the proper format and -files, such as the one you get when you install Raspbian. Then, copy "rpi.img" -as "kernel.img" and clean up your config.txt a bit. Mine is this: +files, such as the ones you get when you install Raspbian. Dusk OS partitioning +formats support is limited for now, so if you want it to properly pick up the +FAT from the SD card, it needs to be the only partition on the disk. Also, +because FAT32 isn't supported yet, it needs to be a FAT16, which might be a +problem on larger cards. The easiest way to go around is to create yourself a +fake "drive" file with something like "truncate -s128M myfile" and then run +"mkfs.fat" on this file. Then, you can "dd" your file onto your card and it will +have a FAT16 partition that only uses the first 128M of your card. + +You can then mount that partition and copy files from Raspbian's FAT partition +into it. Then, copy "rpi.img" as "kernel.img" and clean up your config.txt a +bit. Mine is this: uart_2ndstage=1 device_tree= +Afterwards, you'll need to mount `rpifat.img` and copy all its contents to the +SD card's FAT. + Then, plug your tty-UART adapter to the proper GPIO pins and power up the device (powering up through the TTY adapter itself works for me). After the 2nd stage boot debug output, you should see the Dusk OS prompt. diff --git a/fs/xcomp/arm/rpi/build.fs b/fs/xcomp/arm/rpi/build.fs @@ -15,13 +15,9 @@ org value kernel kernel kernellen V1 IO :write S" /xcomp/bootlo.fs" V1 spitfile S" /drv/rpi/uart.fs" V1 spitfile - S" /lib/struct.fs" V1 spitfile - S" /sys/io.fs" V1 spitfile - S" /xcomp/arm/rpi/glue.fs" V1 spitfile - S" /lib/fmt.fs" V1 spitfile S" /drv/rpi/emmc.fs" V1 spitfile S" /lib/drivelo.fs" V1 spitfile S" /fs/fatlo.fs" V1 spitfile - S" /sys/rdln.fs" V1 spitfile + S" /xcomp/arm/rpi/glue.fs" V1 spitfile S" /xcomp/arm/rpi/init.fs" V1 spitfile r> IO :flush ; diff --git a/fs/xcomp/arm/rpi/glue.fs b/fs/xcomp/arm/rpi/glue.fs @@ -1,4 +1,7 @@ : require word drop ; \ no FS for now : ?f<< word drop ; -alias uart@ key uart$ +emmc :init +emmc :self FAT :mountvolume ( fs ) structbind FAT bootfs +bootfs :self 0 S" sys" bootfs :child S" file.fs" bootfs :child fload + diff --git a/fs/xcomp/arm/rpi/init.fs b/fs/xcomp/arm/rpi/init.fs @@ -1,7 +1,8 @@ : _:emit ( c self -- ) drop uart! ; ' _:emit ByteWriter :new dup to console writeio to stdio writeio -emmc :init -\ emmc :self FAT :mountvolume ( fs ) structbind FAT bootfs - +f<< /sys/kbd.fs +:realias key? uart@ 1 ; +?f<< /lib/fmt.fs +?f<< /sys/rdln.fs : init ." Dusk OS\n" rdln$ stdio$ quit ; init