Working with Hardware and SoC Layer
Understanding the Role of DTS (Device Tree Source)
Role:
- Describes hardware components (e.g., CPU, memory, GPIOs) in a
.dts
file. - Compiled into a Device Tree Blob (DTB) for kernel and U-Boot.
- Enables hardware abstraction across SoCs.
Integrating Vendor SDKs and Drivers
Process:
- Vendor SDKs provide drivers and firmware for SoCs (e.g., MediaTek, Qualcomm).
- Integrated via OpenWRT’s build system (
make menuconfig
). - Challenges include proprietary blobs and GPL compliance.
Flash Layout and MTD Subsystem
MTD (Memory Technology Device):
- Manages flash storage (e.g., NOR, NAND).
- Partitions include kernel, rootfs, and overlay.
- Supports JFFS2, UBIFS for writable storage.
GPIO, UART, and Other Peripheral Interfaces
Interfaces:
- GPIO: Controlled via
/sys/class/gpio
or device-specific drivers. - UART: Used for serial console access.
- Others: I2C, SPI, and USB supported via kernel drivers.
Memory and CPU Optimization for Low-End Devices
Optimizations:
- Kernel configured for minimal footprint (e.g., disabled unused modules).
musl
libc reduces memory usage.- Swap support on external storage for low-RAM devices.
Case Study: Porting OpenWRT to a New Board
Steps:
- Create a DTS file for the new board.
- Integrate vendor SDK and drivers.
- Configure build system for the target SoC.
- Test via QEMU or physical hardware.