TunaCici / WesterOS

Hobbyist ARM64 operating system /w microkernel design. Includes a kernel written in C and user land apps in C++.
MIT License
4 stars 1 forks source link

ARCH: Device Tree Blob Parser #4

Open TunaCici opened 7 months ago

TunaCici commented 7 months ago

Currently (as of Feb 11, 2024) the OS/Kernel setup is done statically; or in other words: everything is hard coded. There is no device discovery OR enumeration OR drivers.

Each day, I'm moving closer into the peripherals, devices and I/O territory. Before I can fully commit myself, I should implement a device discovery & driver matching system. To do that, naturally, I need a parser for a Device Tree Blobs.

Device Tree is a specification and has two important aspects:

QEMU can dump the *.dtb file via the -machine dumpdtb=<out_file>.dtb CLI option. It can be useful when debugging.

QEMU automatically loads the *.dtb into main memory. The following specifies it's base address and related info:

/* Device Tree Blob (DTB) */
#define DTB_START       0x40000000
#define DTB_SIZE        0x00100000      /* 1 MiB */
#define DTB_END         (DTB_START + DTB_SIZE) 

Good luck working on this! There are lots of good resources out there; I'm sure they will be helpful. ☆