During my review of xv6 implementations in ARM world I find that the armv6 port for Raspberry Pi doesn’t boot my Pi.
Even after make it boot, in my own release, I still don’t know exactly why it don’t boot. I just guess that something change in the world of gcc after the code release on github.
This version complete all the usertests, including the sbrktest.
My version xv6-armv6-rpi is available on github:
https://github.com/inaciose/xv6-armv6-rpi
What I have done to make xv6 to work in Rasperry pi B.
The original build (Makefile and kernel.ld) use entry.s to include the binary files (fs.img & initcode) and the libs (libcsud.a), set the stackpointer at 0x3000 call mmuinit0() (on mmu.c) to configure and enable the mmu, it also zero all the memory between 0x2000 to 0x8000, return (if it can because stack corruption) to entry.s to relocate the stackpointer, and only initialize the uart after jump to cmain (high memory).
In my version:
The binary are not included in entry.s, the fs.img and initcode are included by the by the linker, and the font1.bin is included in a new file wrapper.s.
Also in the entry.s file just before the call to cmain, the sp is copied to r0 (it prevents garbage in first line of sh).
Moved the uart inititialization to _uart_init() to the mmu.c and add some functions to output debug information.
In same file, mmu.c, at begining of mmuinit0() add a call to _uart_init() and then output a starting message.
In same file, mmu.c, on mmuinit0() after disable the mmu, change the starting address of the zeroing loop from 0x2000 to 0x3000
In same file, mmu.c, at end of mmuinit0() flush the all tlb after mmu is enabled.
In file main.c changed the declaration of cmain to: int cmain( uint r0)
In file uart.c changed the content of uartinit() to omit the uart initialization (code commented out), and just keep the call to enableirqminiuart() (we cannot double initialize a uart, it hangs and it also affect output start early on code).
Summary of changed files and directories on the initial commit (from zhiyihuang/xv6_rpi_port).
There was change in directory structure:
– The files on include directory was moved to project root (include directory deleted)
– The files on source directory was moved to project root (source directory deleted)
– The uprogs directory renamed to usr
– A new directory tools is created and mkfs.c is moved from usr directory to tools
There are some changed files:
– Makefile
– entry.s
– kernel.ld
– main.c
– mmu.c
– uart.c
There is also two new files
– wrapper.c
– tools/Makefile