Skip to content

Commit

Permalink
U-Boot: Meson AXG and Gateway GZ80X fixups
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Yavitz <[email protected]>
  • Loading branch information
Patrick Yavitz authored and pyavitz committed Aug 13, 2024
1 parent 7e9b85f commit 81456d3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 52 deletions.
9 changes: 9 additions & 0 deletions config/boards/gateway-gz80x.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ SRC_EXTLINUX="yes"
SRC_CMDLINE="console=ttyAML0,115200n8 clk_ignore_unused loglevel=7"
HAS_VIDEO_OUTPUT="no"

function post_config_uboot_target__extra_configs_for_bananapi_f3() {
display_alert "u-boot for ${BOARD}" "u-boot: enabling extra configs" "info"

run_host_command_logged scripts/config --enable CONFIG_SD_BOOT
run_host_command_logged scripts/config --enable CONFIG_EXT4_WRITE
run_host_command_logged scripts/config --enable CONFIG_FS_BTRFS
run_host_command_logged scripts/config --enable CONFIG_CMD_BTRFS
}

function post_family_tweaks_bsp__gateway_gz80x_udev() {
run_host_command_logged mkdir -p "${destination}"/etc/udev/rules.d
display_alert "$BOARD" "Install zwave udev rule" "info"
Expand Down
52 changes: 0 additions & 52 deletions config/sources/families/meson-axg.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
# shellcheck source=config/sources/families/include/meson64_common.inc
source "${BASH_SOURCE%/*}/include/meson64_common.inc"

UBOOT_TARGET_MAP="u-boot-dtb.img;;u-boot.bin.sd.bin:u-boot.bin u-boot.bin:u-boot.nosd.bin u-boot-dtb.img"

uboot_custom_postprocess() {
if [[ "$BOARD" == "gateway-gz80x" ]]; then
uboot_axg_postprocess_ng "$SRC/cache/sources/amlogic-boot-fip/jethub-j100"
Expand All @@ -20,53 +18,3 @@ uboot_custom_postprocess() {
exit 1
fi
}

write_uboot_platform() {
local unable_install_uboot="Unable to install U-Boot."
local method=0

if [[ "$2" == *mmcblk* ]]; then
local mmcblk_prefix
mmcblk_prefix=$(echo "$2" | grep -Po "mmcblk\d")
logger "${FUNCNAME[0]}(): mmcblk_prefix = $mmcblk_prefix"

if [[ -n "$mmcblk_prefix" ]]; then
local mmc_boot=${mmcblk_prefix}boot
local of_boot0=/dev/${mmc_boot}0
local of_boot1=/dev/${mmc_boot}1
if [[ -e $of_boot0 ]]; then
method=1
logger "${FUNCNAME[0]}(): use install in boot emmc partitions"
fi
else
logger "${FUNCNAME[0]}(): mmcblk_prefix is empty. $unable_install_uboot"
return 1
fi
else
logger "${FUNCNAME[0]}(): use standard u-boot install."
fi

dd if="$1/u-boot.bin" of="$2" bs=1 count=442 conv=fsync > /dev/null 2>&1
dd if="$1/u-boot.bin" of="$2" bs=512 skip=1 seek=1 conv=fsync > /dev/null 2>&1

if [[ $method == 1 ]]; then
logger "${FUNCNAME[0]}(): of_boot0 = $of_boot0"
logger "${FUNCNAME[0]}(): of_boot1 = $of_boot1"

# unset force-read-only flag
echo 0 > "/sys/block/${mmc_boot}0/force_ro"
echo 0 > "/sys/block/${mmc_boot}1/force_ro"
logger "${FUNCNAME[0]}(): /sys/block/${mmc_boot}0/force_ro value after unsetting read-only flag: $(< "/sys/block/${mmc_boot}0/force_ro")"
logger "${FUNCNAME[0]}(): /sys/block/${mmc_boot}1/force_ro value after unsetting read-only flag: $(< "/sys/block/${mmc_boot}1/force_ro")"

local uboot_name=u-boot.bin
local uboot_size_in_kbytes=$(($(stat --printf "%s" "$1/$uboot_name") / 1024))
local uboot_offset=1 # 512 bytes in dd
logger "${FUNCNAME[0]}(): uboot_size_in_kbytes = $uboot_size_in_kbytes"
logger "${FUNCNAME[0]}(): uboot_offset = $uboot_offset"
dd if="$1/u-boot.bin" of="$of_boot0" bs=512 skip=1 conv=fsync > /dev/null 2>&1
dd if="$1/u-boot.bin" of="$of_boot1" bs=512 skip=1 conv=fsync > /dev/null 2>&1
fi

logger "${FUNCNAME[0]}(): U-Boot successfully installed"
}

0 comments on commit 81456d3

Please sign in to comment.