# Board type: Banana Pi M2 Berry / M2 Ultra (Allwinner V40 / R40), the two # Gentoo servers marlena (192.168.2.1, DT "M2-Ultra") and banana-backup # (192.168.2.150, DT "M2 Berry"). Most likely the same hardware: one kernel and # one U-Boot for both, one DTB per board until that is confirmed (see # BANANA-V40-notes.md). Sourced by config.sh; everything here can be overridden # from the environment. BOARD_NAME="Banana Pi M2 Berry/Ultra (Allwinner V40/R40)" # install-kernel.sh and write-uboot.sh refuse an ssh target whose # /proc/device-tree/compatible lacks this. BOARD_DT_COMPAT="allwinner,sun8i-r40" # ---- versions --------------------------------------------------------------- # udev from systemd-utils 260 needs >= 5.10 (>= 5.14 recommended). : "${KERNEL_VERSION:=7.3.4}" : "${UBOOT_VERSION:=v2026.10}" # ---- toolchain -------------------------------------------------------------- # The CHOST of both boards after the Gentoo 23.0 migration. : "${CROSS_COMPILE:=armv7a-unknown-linux-gnueabihf-}" # ---- U-Boot ----------------------------------------------------------------- # Berry and Ultra defconfigs differ only in the U-Boot DT and the eMMC slot # (MMC_SUNXI_SLOT_EXTRA=2): same DRAM settings. Neither board has eMMC (marlena's # mmc2 host finds no card), so the Berry one serves both. UBOOT_DEFCONFIG=bananapi_m2_berry_defconfig UBOOT_SEEK_KIB=8 UBOOT_OLD_RAW_ENV_KIB= # The boot commands are a hand-written environment in uboot.env on the FAT # /boot partition (mmc 0:1). write-uboot.sh checks that the new U-Boot will # accept that file (size and CRC against CONFIG_ENV_SIZE) before writing. UBOOT_ENV_FAT=1 UBOOT_ENV_FILE=uboot.env # ---- kernel ----------------------------------------------------------------- # Legacy uImage, started by "bootm 0x47000000 - 0x43000000" from the # environment; the kernel runs at 0x40008000. KERNEL_IMAGE=uImage UIMAGE_LOADADDR=0x40008000 # Our device trees from files/bpi-m2/dts/: mainline board file + DS1307 RTC, # rtc0 alias, LED triggers. Built with symbols (-@) for marlena's overlay. BOARD_DTBS="sun8i-r40-bananapi-m2-ultra-k4be.dtb sun8i-v40-bananapi-m2-berry-k4be.dtb" # ---- installation: U-Boot environment (lib/install-ubootenv.sh) -------------- INSTALL_SCHEME=ubootenv # Every release is kept in /boot/bpi-m2// (FAT); the one booted is # copied to the fixed names the environment loads (uImage, ). BOOT_SUBDIR=bpi-m2 # Which of our DTBs replaces the file the target's environment loads # (load_dt): "pattern:our-dtb", first match wins. BOOT_DTB= overrides. BOOT_DTB_MAP="*m2-ultra*:sun8i-r40-bananapi-m2-ultra-k4be.dtb *m2-berry*:sun8i-v40-bananapi-m2-berry-k4be.dtb" : "${BOOT_DTB:=}" # Overlay sources (files/bpi-m2/overlay/*.dts) compiled into overlay/ and # test-applied to this DTB at build time: marlena's environment applies # sun8i-r40-bananapi-m2-ultra-led.dtbo, and a failing "fdt apply" can leave the # tree in memory broken. OVERLAY_TEST_DTB=sun8i-r40-bananapi-m2-ultra-k4be.dtb # ============================================================================= # Hooks called by build-kernel.sh # ============================================================================= # board_package BOOTDIR: extra files for boot/bpi-m2// board_package() { local boot="$1" d o need_tools fdtoverlay fdtget mkdir -p "$boot/overlay" for d in "$BFILES"/overlay/*.dts; do [ -e "$d" ] || continue o="$boot/overlay/$(basename "${d%.dts}").dtbo" dtc -q -@ -I dts -O dtb -o "$o" "$d" fdtoverlay -i "$boot/$OVERLAY_TEST_DTB" -o "$OUT/overlay-test.dtb" "$o" || die "overlay $(basename "$o") does not apply to $OVERLAY_TEST_DTB" info "overlay $(basename "$o") applies to $OVERLAY_TEST_DTB" done rm -f "$OUT/overlay-test.dtb" # The DS1307 must be rtc0 (hwclock, RTC_HCTOSYS) in every DTB. for d in $BOARD_DTBS; do [ "$(fdtget -t s "$boot/$d" /aliases rtc0 2>/dev/null)" = /soc/i2c@1c2b400/rtc@68 ] || die "$d: rtc0 alias does not point to the DS1307" done info "rtc0 is the DS1307 in all DTBs" # vdd-cpu must not start below the vendor's 1008 MHz voltage (see the dtsi). local p for d in $BOARD_DTBS; do p="$(fdtget -t s "$boot/$d" /__symbols__ reg_dcdc2)" || die "$d: no reg_dcdc2 symbol" [ "$(fdtget -t u "$boot/$d" "$p" regulator-min-microvolt)" = 1160000 ] || die "$d: vdd-cpu minimum is not 1160000 uV" done info "vdd-cpu minimum is 1.16 V in all DTBs" ls -la "$boot/overlay" }