lede/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
Daniel Golle 08aaf074b9 mediatek: add support for BananaPi BPI-R4 board
Hardware
--------
SOC:    MediaTek MT7988A (4x Cortex-A73)
RAM:    4 GiB DDR4
Flash:  128 MiB Winbond SPI-NAND
MMC:    8 GiB eMMC *or* microSD (cannot be used both)
ETH:    4x 1GE (1x WAN, 3x LAN)
        2x SFP+ (10G, 5G, 2.5G, 1G)
USB:    on-board USB 3.2 4-port hub
        1x USB 3.2 port (type A connector)
        1x M.2 for 4G/5G modem
        2x mPCIe for additional modems
WiFi:   optional MediaTek MT7996 Wi-Fi 7 module
        (using 2x PCIe gen3 x2 on the mPCIe slots and 12V power)

Installation
------------
1. Decompress and write the sdcard image to a micro SD card and use that
to boot the R4 (both dip switches in upper position).

2. Use the bootloader menu accessible via the serial console to install
to SPI-NAND.

3. Switch to boot from SPI-NAND and install to eMMC.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2024-07-01 13:36:10 +08:00

115 lines
1.8 KiB
Bash
Executable File

REQUIRE_IMAGE_METADATA=1
asus_initial_setup()
{
# initialize UBI if it's running on initramfs
[ "$(rootfs_type)" = "tmpfs" ] || return 0
ubirmvol /dev/ubi0 -N rootfs
ubirmvol /dev/ubi0 -N rootfs_data
ubirmvol /dev/ubi0 -N jffs2
ubimkvol /dev/ubi0 -N jffs2 -s 0x3e000
}
platform_do_upgrade() {
local board=$(board_name)
case "$board" in
asus,tuf-ax4200)
CI_UBIPART="UBI_DEV"
CI_KERNPART="linux"
nand_do_upgrade "$1"
;;
bananapi,bpi-r3|\
bananapi,bpi-r4|\
bananapi,bpi-r4-poe)
local rootdev="$(cmdline_get_var root)"
rootdev="${rootdev##*/}"
rootdev="${rootdev%p[0-9]*}"
case "$rootdev" in
mmc*)
CI_ROOTDEV="$rootdev"
CI_KERNPART="production"
emmc_do_upgrade "$1"
;;
mtdblock*)
PART_NAME="fit"
default_do_upgrade "$1"
;;
ubiblock*)
CI_KERNPART="fit"
nand_do_upgrade "$1"
;;
esac
;;
cmcc,rax3000m-emmc|\
glinet,gl-mt2500|\
glinet,gl-mt6000|\
jdcloud,re-cs-05)
CI_KERNPART="kernel"
CI_ROOTPART="rootfs"
emmc_do_upgrade "$1"
;;
*)
nand_do_upgrade "$1"
;;
esac
}
PART_NAME=firmware
platform_check_image() {
local board=$(board_name)
local magic="$(get_magic_long "$1")"
[ "$#" -gt 1 ] && return 1
case "$board" in
bananapi,bpi-r3|\
bananapi,bpi-r4|\
bananapi,bpi-r4-poe)
[ "$magic" != "d00dfeed" ] && {
echo "Invalid image type."
return 1
}
return 0
;;
*)
nand_do_platform_check "$board" "$1"
return $?
;;
esac
return 0
}
platform_copy_config() {
case "$(board_name)" in
bananapi,bpi-r3|\
bananapi,bpi-r4|\
bananapi,bpi-r4-poe)
case "$(cmdline_get_var root)" in
/dev/mmc*)
emmc_copy_config
;;
esac
;;
cmcc,rax3000m-emmc|\
glinet,gl-mt2500|\
glinet,gl-mt6000|\
jdcloud,re-cs-05)
emmc_copy_config
;;
esac
}
platform_pre_upgrade() {
local board=$(board_name)
case "$board" in
asus,tuf-ax4200)
asus_initial_setup
;;
esac
}