# # SPDX-License-Identifier: GPL-2.0 # # Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com # # This file is a part of the Armbian Build Framework # https://github.com/armbian/build/ # ARCH=armhf BOOTSOURCE='https://github.com/hardkernel/u-boot.git' BOOTSCRIPT='boot-odroid-xu4.ini:boot.ini' BOOTDIR='u-boot-odroidxu' BOOTBRANCH='branch:odroidxu4-v2017.05' BOOTPATCHDIR="legacy" UBOOT_TARGET_MAP=';;sd_fuse/bl1.bin.hardkernel sd_fuse/bl2.bin.hardkernel.720k_uboot u-boot-dtb.bin sd_fuse/tzsw.bin.hardkernel' case $BRANCH in current) KERNELSOURCE='https://github.com/hardkernel/linux' declare -g KERNEL_MAJOR_MINOR="5.4" # Major and minor versions of this kernel. declare -g KERNEL_SKIP_MAKEFILE_VERSION="yes" # Armbian patches change the version here, so no use having it in the version string. KERNELBRANCH='branch:odroid-5.4.y' KERNELDIR='linux-odroidxu4' ;; edge) declare -g KERNEL_MAJOR_MINOR="6.1" # Major and minor versions of this kernel. KERNELBRANCH='branch:linux-6.1.y' KERNELDIR='linux-odroidxu4' ;; esac CPUMIN=600000 CPUMAX=2000000 GOVERNOR=ondemand SERIALCON=ttySAC2 # @TODO: is this even needed? Looks like stuff for old HK vendor kernel... function custom_kernel_config__hack_odroidxu4_firmware() { kernel_config_modifying_hashes+=("odroidxu4_firmware") if [[ -f .config ]]; then display_alert "Copying firmware files" "odroidxu4 VENDOR KERNEL" "info" # check $kernel_work_dir is set and exists, or bail [[ -z "${kernel_work_dir}" ]] && exit_with_error "kernel_work_dir is not set" [[ ! -d "${kernel_work_dir}" ]] && exit_with_error "kernel_work_dir does not exist: ${kernel_work_dir}" run_host_command_logged mkdir -pv "${kernel_work_dir}/firmware/edid" run_host_command_logged cp -pv "${SRC}"/packages/blobs/odroidxu4/*.bin "${kernel_work_dir}/firmware/edid" fi } setup_write_uboot_platform() { # this will update u-boot on the device rootfs is located on # in case it's a mmc device, otherwise DEVICE will not be changed # and will default to /dev/mmcblk0 local tmp=$(cat /proc/cmdline) tmp="${tmp##*root=}" tmp="${tmp%% *}" [[ -n $tmp ]] && local part=$(findfs $tmp 2> /dev/null) [[ -n $part ]] && local dev=$(lsblk -n -o PKNAME $part 2> /dev/null) [[ -n $dev && $dev == mmcblk* ]] && DEVICE="/dev/${dev}" } write_uboot_platform() { # handle writing to eMMC on package upgrades # assuming $2 points to a correct device if [[ $2 == /dev/mmcblk* && -b ${2}boot0 ]]; then local device=${2}boot0 echo 0 > /sys/block/$(basename $device)/force_ro local is_emmc=1 signed_bl1_position=0 bl2_position=30 uboot_position=62 else local device=${2} signed_bl1_position=1 bl2_position=31 uboot_position=63 fi if [[ $is_emmc == 1 ]]; then tzsw_position=1502 else tzsw_position=1503 fi env_position=2015 dd if=$1/bl1.bin.hardkernel of=$device seek=$signed_bl1_position conv=fsync > /dev/null 2>&1 dd if=$1/bl2.bin.hardkernel.720k_uboot of=$device seek=$bl2_position conv=fsync > /dev/null 2>&1 dd if=$1/u-boot-dtb.bin of=$device bs=512 seek=$uboot_position conv=fsync > /dev/null 2>&1 dd if=$1/tzsw.bin.hardkernel of=$device seek=$tzsw_position conv=fsync > /dev/null 2>&1 dd if=/dev/zero of=$device seek=$env_position bs=512 count=32 conv=fsync > /dev/null 2>&1 } family_tweaks() { echo "blacklist ina231_sensor" > $SDCARD/etc/modprobe.d/blacklist-odroid.conf } family_tweaks_bsp() { mkdir -p $destination/etc/udev/rules.d cp $SRC/packages/bsp/odroid/90-builtin-net-rps.rules $destination/etc/udev/rules.d mkdir -p $destination/usr/local/bin cp $SRC/packages/bsp/rockchip/hdmi.rules $destination/etc/udev/rules.d install -m 755 $SRC/packages/bsp/rockchip/hdmi-hotplug $destination/usr/local/bin # park HDD heads on shutdown mkdir -p $destination/lib/systemd/system-shutdown install -o root -g root -m 0755 $SRC/packages/bsp/odroid/odroid.shutdown $destination/lib/systemd/system-shutdown/odroid.shutdown }