|
@@ -0,0 +1,401 @@
|
|
|
|
|
+# Orange Pi Zero (original, H2+): mainline U-Boot and kernel
|
|
|
|
|
+
|
|
|
|
|
+Builds mainline U-Boot and a self-contained mainline kernel (no initramfs) for
|
|
|
|
|
+the radio's Orange Pi Zero. The userspace is the existing Armbian (Debian
|
|
|
|
|
+bookworm) root filesystem. Its Armbian boot files (`boot.scr`,
|
|
|
|
|
+`armbianEnv.txt`, `uInitrd`, Armbian overlays) are left in place and are not
|
|
|
|
|
+used: our U-Boot reads `/boot/extlinux/extlinux.conf`.
|
|
|
|
|
+
|
|
|
|
|
+| | Version | Source |
|
|
|
|
|
+|---|---|---|
|
|
|
|
|
+| Kernel | 7.3.4 (stable) | cdn.kernel.org tarball, sha256 checked |
|
|
|
|
|
+| U-Boot | v2026.10 | GitHub tag tarball (ftp.denx.de as fallback) |
|
|
|
|
|
+| xradio (XR819 Wi-Fi, out of tree) | fifteenhex/xradio @ 3ce657ae | GitHub tarball |
|
|
|
|
|
+
|
|
|
|
|
+Versions, toolchain (`armv7a-hardfloat-linux-gnueabi-`) and boot settings are in
|
|
|
|
|
+`config.sh`. Any of them can be overridden from the environment.
|
|
|
|
|
+
|
|
|
|
|
+## Building
|
|
|
|
|
+
|
|
|
|
|
+ ./build-uboot.sh # -> out/u-boot/u-boot-sunxi-with-spl.bin
|
|
|
|
|
+ ./build-kernel.sh # -> out/opi0-kernel-<release>.tar.gz
|
|
|
|
|
+
|
|
|
|
|
+Both scripts download what is missing into `dl/`, unpack into `src/` and build
|
|
|
|
|
+out of tree in `out/`. Without a subcommand they run `all`: configure if there
|
|
|
|
|
+is no `.config` yet, then build (the kernel script also builds the
|
|
|
|
|
+out-of-tree modules and packs the tarball). Subcommands:
|
|
|
|
|
+
|
|
|
|
|
+| | `build-uboot.sh` | `build-kernel.sh` |
|
|
|
|
|
+|---|---|---|
|
|
|
|
|
+| `all` (default) | configure if needed, build | configure if needed, build, `modules`, `package` |
|
|
|
|
|
+| `config` | regenerate `.config` | regenerate `.config` |
|
|
|
|
|
+| `menuconfig` | edit the current `.config` | edit the current `.config` |
|
|
|
|
|
+| `build` | build | kernel, in-tree modules and DTBs only |
|
|
|
|
|
+| `modules` | | only the out-of-tree xradio module |
|
|
|
|
|
+| `package` | | only stage and pack the tarball |
|
|
|
|
|
+| `clean` | remove `out/ubuild`, `out/u-boot` | remove `out/kbuild`, `out/kernel` |
|
|
|
|
|
+
|
|
|
|
|
+A menuconfig change is kept until the next `config`. Put lasting changes in
|
|
|
|
|
+`files/kernel.config` or `files/u-boot.config`. Both `config` commands fail if
|
|
|
|
|
+any option of the fragment did not survive (renamed symbol or missing
|
|
|
|
|
+dependency).
|
|
|
|
|
+
|
|
|
|
|
+### Host tools
|
|
|
|
|
+
|
|
|
|
|
+The scripts check for these and stop if any are missing. They never install
|
|
|
|
|
+anything.
|
|
|
|
|
+
|
|
|
|
|
+- both: `curl`, `tar`, `make`, a host C compiler, the cross compiler
|
|
|
|
|
+ `${CROSS_COMPILE}gcc`, `bison`, `flex`, `bc`, `dtc`
|
|
|
|
|
+- kernel: `xz`, `sha256sum`, `perl`, `depmod` (kmod), `fdtget` (dtc)
|
|
|
|
|
+- U-Boot: `gzip`, `swig`, `python3` with `pyelftools` and `setuptools` (binman
|
|
|
|
|
+ assembles `u-boot-sunxi-with-spl.bin`), and OpenSSL development headers for
|
|
|
|
|
+ the host tools. GnuTLS is not needed: `files/u-boot.config` disables
|
|
|
|
|
+ `mkeficapsule`, the only tool that uses it.
|
|
|
|
|
+
|
|
|
|
|
+The H2+/H3 is 32-bit and boots straight from SPL into U-Boot, so there is no
|
|
|
|
|
+TF-A (ARM Trusted Firmware) or crust to build, unlike the 64-bit sunxi chips.
|
|
|
|
|
+
|
|
|
|
|
+## Installing
|
|
|
|
|
+
|
|
|
|
|
+### Bootloader
|
|
|
|
|
+
|
|
|
|
|
+Card in a reader on this PC, or in the running board:
|
|
|
|
|
+
|
|
|
|
|
+ sudo ./write-uboot.sh /dev/sdX # USB card reader
|
|
|
|
|
+ sudo ./write-uboot.sh /dev/mmcblkN # built-in SD slot
|
|
|
|
|
+ ./write-uboot.sh ssh:root@radio.lo
|
|
|
|
|
+
|
|
|
|
|
+The image goes to 8 KiB, where the boot ROM looks for the SPL, and ends where
|
|
|
|
|
+the image ends (currently about 545 KiB). The partition table and the
|
|
|
|
|
+partitions are not touched; the script refuses an image that would reach the
|
|
|
|
|
+first partition (Armbian's starts at 4 MiB).
|
|
|
|
|
+
|
|
|
|
|
+Before writing, the script saves the area it is about to overwrite (8 KiB up
|
|
|
|
|
+to 1 MiB, or up to the first partition if that is lower) to
|
|
|
|
|
+`out/backup/u-boot-area-<device>-<date>.bin` and prints the restore command:
|
|
|
|
|
+
|
|
|
|
|
+ UBOOT_BIN=out/backup/u-boot-area-sdb-20261114-180000.bin sudo ./write-uboot.sh /dev/sdX
|
|
|
|
|
+
|
|
|
|
|
+That puts back exactly what was there, Armbian U-Boot and old environment
|
|
|
|
|
+included. Without a backup, Armbian's own bootloader is still on the rootfs,
|
|
|
|
|
+under `/usr/lib/linux-u-boot-*/` (package `linux-u-boot-*`). Copy it to the
|
|
|
|
|
+PC and write it the same way (`UBOOT_BIN` is always a file on the PC, also
|
|
|
|
|
+in `ssh:` mode):
|
|
|
|
|
+
|
|
|
|
|
+ scp root@radio.lo:'/usr/lib/linux-u-boot-*/u-boot-sunxi-with-spl.bin' armbian-u-boot.bin
|
|
|
|
|
+ UBOOT_BIN=armbian-u-boot.bin ./write-uboot.sh ssh:root@radio.lo
|
|
|
|
|
+
|
|
|
|
|
+Safety checks for `/dev/…` targets: the device must be a whole disk, must not
|
|
|
|
|
+hold a filesystem this PC is using (`/`, `/boot`, `/usr`, `/var`, `/home`,
|
|
|
|
|
+swap), and must look like an SD card: removable, hotplug, or reported as an SD
|
|
|
|
|
+card by the MMC core. Card readers in laptops (`/dev/mmcblk*`, SDHCI) usually
|
|
|
|
|
+report removable=0, so the last rule is what accepts them; soldered eMMC
|
|
|
|
|
+reports type `MMC` and is refused. `FORCE=1` overrides that check only.
|
|
|
|
|
+
|
|
|
|
|
+In `ssh:` mode the script writes to the disk holding the board's root
|
|
|
|
|
+filesystem (on mainline that is `/dev/mmcblk0`, the SD slot; the XR819 on
|
|
|
|
|
+mmc1 is SDIO and has no block device). `DEV=/dev/mmcblkN` overrides it. The
|
|
|
|
|
+PC-side checks do not apply there; the partition check and the backup do.
|
|
|
|
|
+
|
|
|
|
|
+#### The U-Boot environment and the 544 KiB mark
|
|
|
|
|
+
|
|
|
|
|
+Older sunxi U-Boot, including Armbian's 2019.04, kept its environment raw on
|
|
|
|
|
+the card at 544 KiB (`CONFIG_ENV_OFFSET=0x88000`, 128 KiB), which used to cap
|
|
|
|
|
+U-Boot at 536 KiB. Mainline sunxi U-Boot no longer does: this build has
|
|
|
|
|
+`CONFIG_ENV_IS_IN_MMC` off and keeps the environment in `uboot.env` on the
|
|
|
|
|
+first FAT partition of the boot card (`CONFIG_ENV_IS_IN_FAT`). The image is
|
|
|
|
|
+already a little over 536 KiB, and that is fine:
|
|
|
|
|
+
|
|
|
|
|
+- An environment that an earlier `saveenv` left at 544 KiB is never read by
|
|
|
|
|
+ the new U-Boot, so its old `bootcmd`/distro-boot variables cannot leak into
|
|
|
|
|
+ bootstd. Writing the new U-Boot also overwrites the start of it, so it is
|
|
|
|
|
+ dead; the backup keeps a copy.
|
|
|
|
|
+- Armbian's rootfs has no FAT partition, so the new U-Boot always starts with
|
|
|
|
|
+ its built-in default environment and `saveenv` fails. That is intended:
|
|
|
|
|
+ everything boot-related is in `extlinux.conf`. There is no stale
|
|
|
|
|
+ environment to clear with `env default -a`.
|
|
|
|
|
+- `write-uboot.sh` reads the build's `.config`: if `CONFIG_ENV_IS_IN_MMC` is
|
|
|
|
|
+ ever turned on in `files/u-boot.config`, it refuses an image that would
|
|
|
|
|
+ reach `CONFIG_ENV_OFFSET`.
|
|
|
|
|
+
|
|
|
|
|
+The SPI NOR flash on the board also has an environment slot
|
|
|
|
|
+(`CONFIG_ENV_IS_IN_SPI_FLASH`), but only for SPI boot. The boot ROM tries the
|
|
|
|
|
+SD card first, so it is not used.
|
|
|
|
|
+
|
|
|
|
|
+### Kernel
|
|
|
|
|
+
|
|
|
|
|
+Into the card's root partition mounted on this PC, or over ssh:
|
|
|
|
|
+
|
|
|
|
|
+ sudo ./install-kernel.sh /mnt/root
|
|
|
|
|
+ ./install-kernel.sh ssh:root@radio.lo
|
|
|
|
|
+
|
|
|
|
|
+This installs `out/opi0-kernel-<release>.tar.gz` for the release of the last
|
|
|
|
|
+build (`out/kernel-release`); `RELEASE=<release>` picks another tarball still
|
|
|
|
|
+in `out/`. The kernel, DTBs and overlays go to `/boot/opi0/<release>/` and
|
|
|
|
|
+the modules to `/lib/modules/<release>/`. `modules.dep` is generated at build
|
|
|
|
|
+time (`depmod -b <stage> <release>`) and is in the tarball, so nothing runs
|
|
|
|
|
+on the target. Then `/boot/extlinux/extlinux.conf` is regenerated (the
|
|
|
|
|
+previous copy is kept as `.bak`).
|
|
|
|
|
+
|
|
|
|
|
+When installing into a mounted card, the script never writes through an
|
|
|
|
|
+absolute symlink (or a `..` link out of the mount): bookworm's merged-/usr
|
|
|
|
|
+`lib -> usr/lib` is relative and fine, but `lib -> /usr/lib` would resolve to
|
|
|
|
|
+this PC's own `/usr/lib`, so the script stops instead.
|
|
|
|
|
+
|
|
|
|
|
+Every release in `/boot/opi0/` gets a menu entry, highest version first. The
|
|
|
|
|
+order is `sort -V` on the release name, not file dates, and the highest is
|
|
|
|
|
+the default. Root is given as `root=PARTUUID=…`, which the script finds
|
|
|
|
|
+itself; without an initramfs, `UUID=` would not work. The default setup
|
|
|
|
|
+generates:
|
|
|
|
|
+
|
|
|
|
|
+ menu title Orange Pi Zero
|
|
|
|
|
+ timeout 20
|
|
|
|
|
+ default 7.3.4-opi0
|
|
|
|
|
+
|
|
|
|
|
+ label 7.3.4-opi0
|
|
|
|
|
+ kernel /boot/opi0/7.3.4-opi0/zImage
|
|
|
|
|
+ fdt /boot/opi0/7.3.4-opi0/sun8i-h2-plus-orangepi-zero-radio.dtb
|
|
|
|
|
+ append root=PARTUUID=<partuuid> rootfstype=ext4 rootwait rw console=tty1 fbcon=font:6x8 vt.default_red=… vt.default_grn=… vt.default_blu=… console=ttyS0,115200 panic=10 consoleblank=0 usb-storage.quirks=0x2537:0x1066:u,0x2537:0x1068:u
|
|
|
|
|
+
|
|
|
|
|
+`timeout 20` is in tenths of a second: the menu waits 2 s on the serial
|
|
|
|
|
+console. Root is mounted `rw` directly; there is no initramfs to fsck it
|
|
|
|
|
+first, and Armbian's fstab remounts it with its own options anyway.
|
|
|
|
|
+`panic=10` reboots 10 s after a panic.
|
|
|
|
|
+
|
|
|
|
|
+To delete an old release, remove it on the target and reinstall, so the menu
|
|
|
|
|
+is regenerated:
|
|
|
|
|
+
|
|
|
|
|
+ ssh root@radio.lo 'rm -r /boot/opi0/7.2.9-opi0 /lib/modules/7.2.9-opi0'
|
|
|
|
|
+ ./install-kernel.sh ssh:root@radio.lo
|
|
|
|
|
+
|
|
|
|
|
+Do not remove the release that is running or the only one that is known to
|
|
|
|
|
+boot.
|
|
|
|
|
+
|
|
|
|
|
+#### If a new kernel does not boot
|
|
|
|
|
+
|
|
|
|
|
+The highest release always boots by default, and only the serial console
|
|
|
|
|
+(UART header, 115200) can pick another entry. A kernel that panics reboots
|
|
|
|
|
+after 10 s into the same entry again. On the unattended radio, the way back is
|
|
|
|
|
+the card: mount it on the PC, delete the bad `/boot/opi0/<release>/` and run
|
|
|
|
|
+`install-kernel.sh` on the mount again, or edit `default` in `extlinux.conf`.
|
|
|
|
|
+An automatic fallback (U-Boot bootcount with the watchdog) is not set up yet;
|
|
|
|
|
+see `NOTES.md`.
|
|
|
|
|
+
|
|
|
|
|
+### Going back to the Armbian kernel
|
|
|
|
|
+
|
|
|
|
|
+With the **old** U-Boot still on the card: the Armbian U-Boot (2019.04) also
|
|
|
|
|
+prefers `extlinux.conf` over `boot.scr`, so once the kernel is installed the
|
|
|
|
|
+board boots it even before the new U-Boot is written. Remove or rename
|
|
|
|
|
+`/boot/extlinux/extlinux.conf` and it boots Armbian's `boot.scr` again.
|
|
|
|
|
+
|
|
|
|
|
+That old U-Boot predates `fdtoverlays` support in extlinux (added in U-Boot
|
|
|
|
|
+2021.01), so it ignores the `fdtoverlays` line: anything in `BOOT_OVERLAYS` is
|
|
|
|
|
+silently left out until the new U-Boot is written. The board DTB itself does
|
|
|
|
|
+not depend on overlays.
|
|
|
|
|
+
|
|
|
|
|
+With the **new** U-Boot: without `extlinux.conf` it falls back to the
|
|
|
|
|
+distro-boot script scan and runs Armbian's `/boot/boot.scr`. Nobody has tested
|
|
|
|
|
+whether that script (written for 2019.04 and Armbian's environment) works
|
|
|
|
|
+under 2026.10. The reliable way back is to restore the old bootloader from
|
|
|
|
|
+the backup (see above) *and* remove `extlinux.conf`.
|
|
|
|
|
+
|
|
|
|
|
+### Armbian packages on the rootfs
|
|
|
|
|
+
|
|
|
|
|
+Some Armbian packages can undo this setup. `install-kernel.sh` warns about
|
|
|
|
|
+them, but changes nothing:
|
|
|
|
|
+
|
|
|
|
|
+- `linux-image-*`, `linux-dtb-*`, `linux-u-boot-*`: put them on hold (or
|
|
|
|
|
+ remove them), otherwise an upgrade refreshes Armbian's boot files and,
|
|
|
|
|
+ depending on the package version, writes its own U-Boot back to the card:
|
|
|
|
|
+
|
|
|
|
|
+ apt-mark hold linux-image-current-sunxi linux-dtb-current-sunxi linux-u-boot-orangepizero-current
|
|
|
|
|
+
|
|
|
|
|
+ (`dpkg -l 'linux-*'` shows the exact names).
|
|
|
|
|
+- `armbian-firmware` provides `/lib/firmware/xr819/*`. Keep it: without it the
|
|
|
|
|
+ XR819 Wi-Fi does not come up.
|
|
|
|
|
+- `u-boot-menu` must not be installed: it rewrites
|
|
|
|
|
+ `/boot/extlinux/extlinux.conf` on every kernel package change.
|
|
|
|
|
+- `armbian-zram-config` sets the compression from `SWAP_ALGORITHM` in
|
|
|
|
|
+ `/etc/default/armbian-zram-config`. The kernel has lzo, lzo-rle, lz4 (the
|
|
|
|
|
+ default) and zstd for zram; anything else must be added to
|
|
|
|
|
+ `files/kernel.config`.
|
|
|
|
|
+
|
|
|
|
|
+## What is in the build
|
|
|
|
|
+
|
|
|
|
|
+`files/dts/sun8i-h2-plus-orangepi-zero-radio.dts` (the DTB used to boot)
|
|
|
|
|
+includes the mainline board file and adds:
|
|
|
|
|
+
|
|
|
|
|
+- analog codec (line out/mic on the 13-pin header), USB host 2 and 3: the
|
|
|
|
|
+ former Armbian overlays `analog-codec`, `usbhost2`, `usbhost3`
|
|
|
|
|
+- i2c1 (PA18/PA19) at 400 kHz: the former `i2c1` and `i2c1-400k` overlays.
|
|
|
|
|
+ An `i2c1` alias keeps it at `/dev/i2c-1` (without one it would be `i2c-0`).
|
|
|
|
|
+ 400 kHz relies on the pull-ups on the panel board: no SoC pull-up is enabled
|
|
|
|
|
+ on these pins, and the internal ones would be too weak for that speed.
|
|
|
|
|
+- the radio panel `panel@74` (`k4be,s1d13700-tca9539`) on i2c1. `k4be` is not
|
|
|
|
|
+ a registered vendor prefix, so `make dtbs_check` warns about this node;
|
|
|
|
|
+ that is expected.
|
|
|
|
|
+- the key expander U2 `gpio@76` (`ti,tca9539`) on i2c1, INT on PA6/PWM1
|
|
|
|
|
+ (level low, SoC pull-up on), and a `gpio-keys` device named `radio-keys`
|
|
|
|
|
+ with the 13 keys. s1d13700-tca's `dts/radio-panel.dts` has the same table.
|
|
|
|
|
+ It avoids `#include` so that it also works with `armbian-add-overlay`, so
|
|
|
|
|
+ the two files cannot share a `.dtsi`. Instead `build-kernel.sh` compares the
|
|
|
|
|
+ compiled tables (label, U2 pin, flags, key code) and stops if they differ.
|
|
|
|
|
+- `compatible = "xradio,xr819"` and the PG10 host-wake interrupt, which the
|
|
|
|
|
+ xradio driver needs. U-Boot sets the Wi-Fi MAC from the SoC ID through the
|
|
|
|
|
+ `ethernet1` alias.
|
|
|
|
|
+
|
|
|
|
|
+Kernel: `sunxi_defconfig` plus `files/kernel.config`. This adds systemd needs
|
|
|
|
|
+(cgroups, namespaces, autofs…), zram, NFS, nftables (with the compat layer for
|
|
|
|
|
+iptables-nft), cfg80211/mac80211, the H3 codec, USB host/gadget (g_serial,
|
|
|
|
|
+configfs), USB storage, serial adapters and audio. It drops the HDMI/GPU/video
|
|
|
|
|
+drivers: this board has no display output. Built in and checked by `config`:
|
|
|
|
|
+
|
|
|
|
|
+- the sunxi MMC driver and ext4: there is no initramfs to load them from
|
|
|
|
|
+- cpufreq-dt with the GPIO regulator for the CPU supply (PL6, already in the
|
|
|
|
|
+ mainline board file) and sun8i-thermal: the H2+ runs hot, so it must be able
|
|
|
|
|
+ to scale down
|
|
|
|
|
+- the sunxi watchdog and the sun6i RTC
|
|
|
|
|
+- `FONT_6x8` for `fbcon=font:6x8`
|
|
|
|
|
+
|
|
|
|
|
+### Drivers for the radio panel (`$PANEL_DIR`, default `/home/k4be/git/radio/s1d13700-tca`)
|
|
|
|
|
+
|
|
|
|
|
+The panel driver and its overlay come from the s1d13700-tca repository. The
|
|
|
|
|
+application on the board, radio-ui (`/home/k4be/git/radio/radio-ui`, with
|
|
|
|
|
+s1d13700-tca as a submodule), is not built here.
|
|
|
|
|
+
|
|
|
|
|
+- `s1d13700-tca` DRM driver: copied from `$PANEL_DIR/driver` into
|
|
|
|
|
+ `drivers/gpu/drm/tiny/s1d13700-tca/` on every build and **built in**, so
|
|
|
|
|
+ fbcon shows the boot log on the panel (40×20 characters). When
|
|
|
|
|
+ `radio-ui drm` starts, it takes over the display. Module parameters become
|
|
|
|
|
+ kernel arguments, e.g. `s1d13700_tca.tcr=162` in `KERNEL_CMDLINE_EXTRA`.
|
|
|
|
|
+- gpio-pca953x (TCA9539, with IRQ) and gpio-keys, built in. `radio-ui drm`
|
|
|
|
|
+ finds the `radio-keys` evdev device by itself.
|
|
|
|
|
+- i2c-dev, i2c-tiny-usb, gpio-keys-polled, evdev, uinput, backlight class
|
|
|
|
|
+- s1d13700-tca's `dts/*.dts` overlays are compiled into
|
|
|
|
|
+ `/boot/opi0/<release>/overlay/` and can be enabled with `BOOT_OVERLAYS`.
|
|
|
|
|
+ They aren't needed: the board DTB already has everything. `radio-panel`
|
|
|
|
|
+ would add a second panel and U2 on i2c0.
|
|
|
|
|
+
|
|
|
|
|
+The driver also registers the panel's backlight as
|
|
|
|
|
+`/sys/class/backlight/radio-backlight` (brightness 0 or 1, on at boot), and
|
|
|
|
|
+`radio-ui drm` switches it off after 30 s without a key press. The sysfs file
|
|
|
|
|
+is `root:root 0644` and radio-ui runs as an ordinary user, so the write fails.
|
|
|
|
|
+radio-ui ignores that error and the backlight just stays on. A udev rule on the
|
|
|
|
|
+target gives the `video` group write access, e.g.
|
|
|
|
|
+`/etc/udev/rules.d/70-radio-backlight.rules`:
|
|
|
|
|
+
|
|
|
|
|
+ ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="radio-backlight", RUN+="/bin/chgrp video /sys%p/brightness", RUN+="/bin/chmod g+w /sys%p/brightness"
|
|
|
|
|
+
|
|
|
|
|
+The user needs to be in `video` (Armbian's default user is). Likewise,
|
|
|
|
|
+`/dev/input/event*` is `root:input 0660`, so reading `radio-keys` (radio-ui,
|
|
|
|
|
+`evtest`) needs the `input` group: `usermod -aG input <user>`.
|
|
|
|
|
+
|
|
|
|
|
+Because the kernel owns 0x74 and 0x76, the i2c-dev frontends (`radio-ui i2c`,
|
|
|
|
|
+the polling U2 code, most `hw_test.sh` modes) refuse to run on the target
|
|
|
|
|
+until the drivers are unbound. Unbind gpio-keys first, since it holds U2's
|
|
|
|
|
+GPIOs, then the expander, then the panel:
|
|
|
|
|
+
|
|
|
|
|
+ echo radio-keys > /sys/bus/platform/drivers/gpio-keys/unbind
|
|
|
|
|
+ echo 1-0076 > /sys/bus/i2c/drivers/pca953x/unbind
|
|
|
|
|
+ echo 1-0074 > /sys/bus/i2c/drivers/s1d13700-tca/unbind
|
|
|
|
|
+
|
|
|
|
|
+Bind them again in reverse order (`…/bind`), or reboot.
|
|
|
|
|
+
|
|
|
|
|
+Kernel 7.3 renamed `struct drm_atomic_state` to `struct drm_atomic_commit`.
|
|
|
|
|
+The radio sources use the old name, only as the argument type of the atomic
|
|
|
|
|
+hooks, and are not modified. Instead, the generated in-tree Makefile forces a
|
|
|
|
|
+generated `s1d13700_compat.h` into `s1d13700_drm.c` only (`-include`). For
|
|
|
|
|
+kernels ≥ 7.3 that header first includes the DRM headers the driver uses, and
|
|
|
|
|
+only then maps the old name to the new one. So the rename applies to the
|
|
|
|
|
+driver's own code and never inside a kernel header. It also checks that
|
|
|
|
|
+`struct drm_atomic_commit` really is the complete new type. If the driver
|
|
|
|
|
+starts using renamed helper functions (`drm_atomic_state_*` →
|
|
|
|
|
+`drm_atomic_commit_*`), they need their own lines in that header (in
|
|
|
|
|
+`build-kernel.sh`).
|
|
|
|
|
+
|
|
|
|
|
+## Consoles and boot logging
|
|
|
|
|
+
|
|
|
|
|
+The kernel command line has `console=tty1` (the panel, through fbcon)
|
|
|
|
|
+followed by `console=ttyS0,115200`. Kernel messages go to both. The last
|
|
|
|
|
+`console=` becomes `/dev/console`, which is where init's output, the systemd
|
|
|
|
|
+`[ OK ]` status lines, and the emergency/rescue shell go. So systemd's boot
|
|
|
|
|
+output only appears on the serial port. Serial comes last on purpose: the
|
|
|
|
|
+panel has keys but no keyboard, so a shell or a "Give root password" prompt
|
|
|
|
|
+there would be useless, while the UART header is an emergency console when ssh
|
|
|
|
|
+does not work. If `KERNEL_CONSOLE` is overridden, `install-kernel.sh` moves
|
|
|
|
|
+its `console=ttyS*` entry to the end, and warns if there is none.
|
|
|
|
|
+
|
|
|
|
|
+The panel driver maps white to "pixel off", the light background of the
|
|
|
|
|
+LCD, so fbcon's usual light grey on black would look inverted.
|
|
|
|
|
+`KERNEL_CONSOLE` therefore also sets `vt.default_red/grn/blu`: the VGA
|
|
|
|
|
+palette inverted, with the background (entry 0) white and normal and bold
|
|
|
|
|
+text (7 and 15) black. Other colours stay distinct gray levels. This only
|
|
|
|
|
+affects text VTs, not radio-ui.
|
|
|
|
|
+
|
|
|
|
|
+Armbian's `console-setup` loads the font from `/etc/default/console-setup`
|
|
|
|
|
+(`FONTFACE="Fixed"`, `FONTSIZE="8x16"`) about 10 s into boot, from
|
|
|
|
|
+`console-setup.service` and from a udev rule. That replaces the kernel's 6×8
|
|
|
|
|
+font and leaves 10 lines on the panel. To keep the kernel font (40×20), on
|
|
|
|
|
+the target clear both settings:
|
|
|
|
|
+
|
|
|
|
|
+ sed -i 's/^FONTFACE=.*/FONTFACE=""/; s/^FONTSIZE=.*/FONTSIZE=""/' /etc/default/console-setup
|
|
|
|
|
+
|
|
|
|
|
+With both empty, `setupcon` leaves the font alone and still sets up the
|
|
|
|
|
+keymap and charmap. To use a font from the rootfs instead,
|
|
|
|
|
+`FONTFACE="Terminus"` with `FONTSIZE="6x12"` (width×height; the file is
|
|
|
|
|
+`Terminus12x6`) gives 40×13 and better Unicode coverage than the kernel's
|
|
|
|
|
+CP437 font.
|
|
|
|
|
+
|
|
|
|
|
+For a userspace log on the panel too, the usual workaround is journald on the
|
|
|
|
|
+rootfs: `ForwardToConsole=yes`, `TTYPath=/dev/tty1`, `MaxLevelConsole=info`
|
|
|
|
|
+in a drop-in under `/etc/systemd/journald.conf.d/`. That prints journal lines
|
|
|
|
|
+like "Started X.service" rather than the `[ OK ]` status lines, and on a
|
|
|
|
|
+40×20 screen it scrolls by fast. It may also be possible to switch
|
|
|
|
|
+`/dev/console` to the panel just after init starts, but that is not tested
|
|
|
|
|
+either.
|
|
|
|
|
+
|
|
|
|
|
+Once `radio-ui drm` runs, it is the DRM master and fbcon output is no longer
|
|
|
|
|
+pushed to the panel, but tty1 is still a text VT underneath. systemd starts
|
|
|
|
|
+`getty@tty1` there, and the journald forwarding above would keep writing to
|
|
|
|
|
+it. That is invisible while radio-ui holds the display, but it flashes up
|
|
|
|
|
+whenever radio-ui exits or restarts. To keep tty1 quiet, on the target:
|
|
|
|
|
+
|
|
|
|
|
+ systemctl mask getty@tty1.service
|
|
|
|
|
+
|
|
|
|
|
+and optionally add `vt.global_cursor_default=0` to `KERNEL_CMDLINE_EXTRA` to
|
|
|
|
|
+hide the text cursor. The proper fix belongs in radio-ui: switching the VT to
|
|
|
|
|
+`KD_GRAPHICS` while it owns the display (see `NOTES.md`).
|
|
|
|
|
+
|
|
|
|
|
+## Other systems
|
|
|
|
|
+
|
|
|
|
|
+The same Orange Pi Zero board is also used in the two solar monitoring
|
|
|
|
|
+systems (`solar1.lo` and `solar2.lo`), which have no radio panel. They can
|
|
|
|
|
+run the same kernel and U-Boot. The question is which DTB they boot.
|
|
|
|
|
+
|
|
|
|
|
+The radio DTB works there, with harmless side effects:
|
|
|
|
|
+
|
|
|
|
|
+- The panel driver logs "expander not responding" and gives up.
|
|
|
|
|
+- The key expander at 0x76 fails to probe, so radio-keys stays deferred.
|
|
|
|
|
+- PA18, PA19 and PA6 on the header are claimed, but nothing on the solar
|
|
|
|
|
+ boards uses them.
|
|
|
|
|
+- An unused analog sound card appears.
|
|
|
|
|
+- `console=tty1` points at no display, which does no harm.
|
|
|
|
|
+
|
|
|
|
|
+Alternatively, install with `BOOT_DTB=sun8i-h2-plus-orangepi-zero.dtb` (the
|
|
|
|
|
+plain mainline board file, also in `/boot/opi0/<release>/`). That loses USB
|
|
|
|
|
+2/3 on the 13-pin header and the xradio binding, so no Wi-Fi. A dedicated
|
|
|
|
|
+solar DTS is planned (see `NOTES.md`).
|
|
|
|
|
+
|
|
|
|
|
+## Layout
|
|
|
|
|
+
|
|
|
|
|
+| Path | What |
|
|
|
|
|
+|---|---|
|
|
|
|
|
+| `config.sh` | versions, toolchain, paths, boot settings, shared helpers |
|
|
|
|
|
+| `build-kernel.sh`, `build-uboot.sh` | download, configure, build |
|
|
|
|
|
+| `write-uboot.sh`, `install-kernel.sh` | put the results on a card or board |
|
|
|
|
|
+| `files/kernel.config`, `files/u-boot.config` | config fragments |
|
|
|
|
|
+| `files/dts/` | board device tree |
|
|
|
|
|
+| `NOTES.md` | planned changes and open questions |
|
|
|
|
|
+| `dl/`, `src/`, `out/` | downloads, sources, build output (all regenerable) |
|
|
|
|
|
+| `out/backup/` | bootloader areas saved by `write-uboot.sh` (**not** regenerable) |
|