diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-11-29 22:17:13 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-11-29 22:17:13 +0100 |
| commit | d51665904faa31c39106e4b2afa7541615072e72 (patch) | |
| tree | 01c355472bcca04f59980d961dca0bc46c9b429b /README.md | |
| parent | 010888de490ab1fafc0200c37cd09d57a0ff1e9f (diff) | |
| download | fbos-d51665904faa31c39106e4b2afa7541615072e72.tar.gz fbos-d51665904faa31c39106e4b2afa7541615072e72.zip | |
Allow the kernel to run as a Linux image
In order to run on real hardware, it's actually easier to re-use
workflows from existing bootloaders than loading things in memory
manually. In order to achieve this two things had to be settled:
1. The image has to have a Linux header as defined in the RISC-V port.
This header will be taken into consideration by bootloaders in order to
know where to jump, the image offset, the endianness of the image, etc.
2. The image cannot just be an ELF executable. Rather, we must translate
it into binary form via `objcopy`.
With all of this at hand, I was able to make the kernel run on a
Starfive VisionFive 2 board, and I have recorded an example so it's
available as documentation.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 44 |
1 files changed, 37 insertions, 7 deletions
@@ -8,11 +8,9 @@ are unaware of each other and it's up to the kernel to schedule them by using the timer interrupts as given by openSBI (`fizz` on % 3 seconds, `buzz` on % 5 seconds, and `fizzbuzz` on % 15 seconds). -This kernel provides just one system call, `write_and_block`, which allows any -program to pass the string to be written into the serial port and wait for the -kernel to re-schedule it. - - +This kernel provides just one system call, `write`, which allows any program to +pass the string to be written into the serial port and wait for the kernel to +re-schedule it. ## Build @@ -75,8 +73,12 @@ $ make qemu This will open up QEMU in `-nographic` mode (hence the serial output will be simply redirected to stdout), and you will be able to see the whole thing -working. Moreover, the `qemu` target can be paired with the `DEBUG` parameter -that you can pass to make. Hence, you can also call it like so: +working. Just like this: + + + +Moreover, the `qemu` target can be paired with the `DEBUG` parameter that you +can pass to make. Hence, you can also call it like so: ``` $ make qemu DEBUG=1 @@ -106,6 +108,34 @@ $ make gdb GDB_EXTRA_FLAGS="-tui" And now you have started a GDB session with a nice TUI interface. +### VisionFive 2 + +This kernel can also be run on real hardware. In particular, I have tested it +with the Starfive VisionFive 2 board. I have tested this with an existing Linux +installation. In there, I have modified the bootloader configuration so I have +now this entry: + +``` +label l6 + menu label FizzBuzz OS + linux /fbos + initrd /initramfs.cpio + fdtdir /dtbs/<versioned directory> +``` + +In order to get the needed files, you can use the `archive` make target: + +``` +make archive +``` + +Copy this tarball to your board and then place the `fbos` binary image and the +`initramfs.cpio` file into `/boot`. When you reset your board, you will get the +new entry from U-Boot and you will be able to run the kernel from there. Like +this: + + + ## Requirements We do not want to support a myriad of different scenarios, but we want to keep |
