| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- # Shared settings for the Orange Pi Zero (H2+, original version) build.
- # Sourced by the other scripts; override any of these from the environment.
- TOP="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
- # ---- versions ---------------------------------------------------------------
- : "${KERNEL_VERSION:=7.3.4}"
- : "${UBOOT_VERSION:=v2026.10}"
- # Out-of-tree XR819 Wi-Fi driver (not in mainline). Pinned commit; see README.
- : "${XRADIO_REPO:=fifteenhex/xradio}"
- : "${XRADIO_COMMIT:=3ce657ae533e2213f6fda2297da1598fa11d7a03}"
- # ---- toolchain --------------------------------------------------------------
- : "${CROSS_COMPILE:=armv7a-hardfloat-linux-gnueabi-}"
- : "${JOBS:=$(nproc)}"
- export ARCH=arm CROSS_COMPILE
- # ---- board ------------------------------------------------------------------
- UBOOT_DEFCONFIG=orangepi_zero_defconfig
- KERNEL_DTB=sun8i-h2-plus-orangepi-zero.dtb
- # sunxi boot ROM loads the SPL from 8 KiB on the card.
- UBOOT_SEEK_KIB=8
- # ---- extlinux.conf (install-kernel.sh) --------------------------------------
- # Device tree U-Boot hands to the kernel (built from files/dts/).
- : "${BOOT_DTB:=sun8i-h2-plus-orangepi-zero-radio.dtb}"
- # Extra overlays from boot/opi0/<release>/overlay/, space separated, no .dtbo.
- : "${BOOT_OVERLAYS:=}"
- # Kernel messages go to every console= listed, but only the LAST one becomes
- # /dev/console: init's output, systemd's emergency/rescue shell and the
- # "Give root password" prompt. The serial port goes last so it is a usable
- # emergency console when ssh is not (tty1, fbcon on the radio panel, has no
- # keyboard). install-kernel.sh moves a console=ttyS* entry to the end anyway.
- # The panel driver maps white to "pixel off" (the light background), so fbcon's
- # light-grey-on-black looks inverted there. This VT palette is the VGA one
- # inverted, with entry 0 (background) white and 7/15 (normal/bold text) black.
- # Only text VTs use it; radio-ui draws through DRM and is not affected.
- VT_PALETTE="vt.default_red=0xff,0x55,0xff,0x55,0xff,0x55,0xff,0x00,0xaa,0x00,0xaa,0x00,0xaa,0x00,0xaa,0x00"
- VT_PALETTE+=" vt.default_grn=0xff,0xff,0x55,0xaa,0xff,0xff,0x55,0x00,0xaa,0xaa,0x00,0x00,0xaa,0xaa,0x00,0x00"
- VT_PALETTE+=" vt.default_blu=0xff,0xff,0xff,0xff,0x55,0x55,0x55,0x00,0xaa,0xaa,0xaa,0xaa,0x00,0x00,0x00,0x00"
- : "${KERNEL_CONSOLE:=console=tty1 fbcon=font:6x8 $VT_PALETTE console=ttyS0,115200}"
- # usb-storage quirks carried over from the Armbian setup (armbianEnv.txt).
- : "${KERNEL_CMDLINE_EXTRA:=usb-storage.quirks=0x2537:0x1066:u,0x2537:0x1068:u}"
- # ---- directories ------------------------------------------------------------
- DL="$TOP/dl" # downloaded tarballs
- SRC="$TOP/src" # extracted sources
- OUT="$TOP/out" # build results
- FILES="$TOP/files" # config fragments, overlays, boot config templates
- PANEL_DIR="${PANEL_DIR:-/home/k4be/git/radio/s1d13700-tca}" # s1d13700-tca: panel driver, overlay
- KEYBOARD_DIR="${KEYBOARD_DIR:-/home/k4be/git/radio/radio-keyboard-tca}" # radio-keyboard-tca: key overlay
- KSRC="$SRC/linux-$KERNEL_VERSION"
- USRC="$SRC/u-boot-${UBOOT_VERSION#v}"
- XSRC="$SRC/xradio"
- KOUT="$OUT/kernel" # staging: boot/ and lib/modules/
- UOUT="$OUT/u-boot"
- die() { echo "ERROR: $*" >&2; exit 1; }
- info() { echo ">>> $*"; }
- # Fail early if a required program is missing; don't install anything.
- need_tools() {
- local t missing=()
- for t in "$@"; do command -v "$t" >/dev/null 2>&1 || missing+=("$t"); done
- [ ${#missing[@]} -eq 0 ] || die "missing tools: ${missing[*]} (install them and re-run)"
- }
- # check_fragment FRAGMENT DOTCONFIG
- # Every option in a config fragment must have survived olddefconfig; a renamed
- # symbol or a missing dependency silently drops options otherwise.
- check_fragment() {
- local frag="$1" dotconfig="$2" bad=0 line sym want have
- while IFS= read -r line; do
- case "$line" in
- CONFIG_*=*) sym="${line%%=*}"; want="${line#*=}" ;;
- "# CONFIG_"*" is not set") sym="${line#\# }"; sym="${sym%% *}"; want=n ;;
- *) continue ;;
- esac
- have="$(grep -E "^$sym=" "$dotconfig" | cut -d= -f2- || true)"
- [ -n "$have" ] || have=n
- if [ "$have" != "$want" ]; then
- echo " config: $sym wanted $want, got $have" >&2
- bad=1
- fi
- done < "$frag"
- [ $bad -eq 0 ] || die ".config does not match ${frag#"$TOP"/} (see above)"
- info "config check passed (${frag#"$TOP"/})"
- }
- # fetch URL DEST [fallback URL...]
- fetch() {
- local dest="$1"; shift
- [ -s "$dest" ] && return 0
- mkdir -p "$(dirname "$dest")"
- local url
- for url in "$@"; do
- info "downloading $url"
- if curl -fL --connect-timeout 20 --retry 2 -o "$dest.part" "$url"; then
- mv "$dest.part" "$dest"
- return 0
- fi
- done
- rm -f "$dest.part"
- die "could not download $(basename "$dest")"
- }
|