.github | ||
LICENSE | ||
README.md |
Apache NuttX RTOS for Pine64 Ox64 64-bit RISC-V SBC (BouffaloLab BL808)
Will Apache NuttX RTOS boot on Ox64 BL808?
Let's examine the Linux Kernel Image for Ox64, and we replicate the same format for NuttX.
We download... bl808-linux-pine64_ox64_full_defconfig.tar.gz
From the latest release...
openbouffalo/buildroot_bouffalo/releases/tag/v1.0.1
Unzip and mount the SD Card Image.
→ ls -l /Users/Luppy/ox64/sdcard-pine64_ox64_full_defconfig
total 25744
-rwxrwxrwx@ 1 Luppy staff 13154816 Mar 6 2023 Image
-rwxrwxrwx@ 1 Luppy staff 4012 Mar 6 2023 bl808-pine64-ox64.dtb
-rwxrwxrwx@ 1 Luppy staff 4106 Mar 6 2023 bl808-sipeed-m1s.dtb
-rwxrwxrwx@ 1 Luppy staff 350 Mar 6 2023 boot-m1s.scr
-rwxrwxrwx@ 1 Luppy staff 352 Mar 6 2023 boot-pine64.scr
-rwxrwxrwx@ 1 Luppy staff 352 Mar 6 2023 boot.scr
drwxrwxrwx@ 3 Luppy staff 96 Mar 6 2023 extlinux
Dump the Image
as hex...
→ hexdump /Users/Luppy/ox64/sdcard-pine64_ox64_full_defconfig/Image | mor
e
0000000 4d 5a 6f 10 20 08 01 00 00 00 20 00 00 00 00 00
0000010 00 80 cd 00 00 00 00 00 00 00 00 00 00 00 00 00
0000020 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0000030 52 49 53 43 56 00 00 00 52 53 43 05 40 00 00 00
0000040 50 45 00 00 64 50 02 00 00 00 00 00 00 00 00 00
0000050 00 00 00 00 a0 00 06 02 0b 02 02 14 00 f0 5f 00
0000060 00 80 6d 00 00 00 00 00 3e 2a 42 00 00 10 00 00
0000070 00 00 00 00 00 00 00 00 00 10 00 00 00 02 00 00
0000080 00 00 00 00 01 00 01 00 00 00 00 00 00 00 00 00
0000090 00 80 cd 00 00 10 00 00 00 00 00 00 0a 00 00 00
00000a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
The Linux Kernel Image will begin with this RISC-V Linux Image Header...
Here are the decoded bytes...
-
code0: Executable code
(4 bytes, offset
0x00
)4d 5a 6f 10
-
code1: Executable code
(4 bytes, offset
0x04
)20 08 01 00
-
text_offset: Image load offset, little endian
(8 bytes, offset
0x08
)00 00 20 00 00 00 00 00
-
image_size: Effective Image size, little endian
(8 bytes, offset
0x10
)00 80 cd 00 00 00 00 00 aaaa 00 C0 56 01 00 00 00 00
-
flags: Kernel flags, little endian
(8 bytes, offset
0x18
)00 00 00 00 00 00 00 00
-
version: Version of this header (MinL MinM
.
MajL MajM)(4 bytes, offset
0x20
)02 00 00 00
-
res1: Reserved
(4 bytes, offset
0x24
)00 00 00 00
-
res2: Reserved
(8 bytes, offset
0x28
)00 00 00 00 00 00 00 00
-
magic: Magic number, little endian, "RISCV\x00\x00\x00"
(8 bytes, offset
0x30
)52 49 53 43 56 00 00 00
-
magic2: Magic number 2, little endian, "RSC\x05"
(4 bytes, offset
0x38
)52 53 43 05
-
res3: Reserved for PE COFF offset
(4 bytes, offset
0x3C
)40 00 00 00
Our NuttX Kernel shall recreate this RISC-V Linux Image Header. (Total 0x40
bytes)
(Or U-Boot Bootloader might refuse to boot NuttX)
Header Values are exactly the same as Star64. (Except the Executable Code, since the Jump Address is different)
TODO