odroidxu4.conf 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. #
  2. # SPDX-License-Identifier: GPL-2.0
  3. #
  4. # Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com
  5. #
  6. # This file is a part of the Armbian Build Framework
  7. # https://github.com/armbian/build/
  8. #
  9. ARCH=armhf
  10. BOOTSOURCE='https://github.com/hardkernel/u-boot.git'
  11. BOOTSCRIPT='boot-odroid-xu4.ini:boot.ini'
  12. BOOTDIR='u-boot-odroidxu'
  13. BOOTBRANCH='branch:odroidxu4-v2017.05'
  14. BOOTPATCHDIR="legacy"
  15. UBOOT_TARGET_MAP=';;sd_fuse/bl1.bin.hardkernel sd_fuse/bl2.bin.hardkernel.720k_uboot u-boot-dtb.bin sd_fuse/tzsw.bin.hardkernel'
  16. case $BRANCH in
  17. current)
  18. KERNELSOURCE='https://github.com/hardkernel/linux'
  19. export KERNEL_MAJOR_MINOR="5.4" # Major and minor versions of this kernel.
  20. KERNELBRANCH='branch:odroid-5.4.y'
  21. KERNELDIR='linux-odroidxu4'
  22. ;;
  23. edge)
  24. export KERNEL_MAJOR_MINOR="6.1" # Major and minor versions of this kernel.
  25. KERNELBRANCH='branch:linux-6.1.y'
  26. KERNELDIR='linux-odroidxu4'
  27. ;;
  28. esac
  29. CPUMIN=600000
  30. CPUMAX=2000000
  31. GOVERNOR=ondemand
  32. SERIALCON=ttySAC2
  33. # @TODO: is this even needed? Looks like stuff for old HK vendor kernel...
  34. function custom_kernel_config__hack_odroidxu4_firmware() {
  35. kernel_config_modifying_hashes+=("odroidxu4_firmware")
  36. if [[ -f .config ]]; then
  37. display_alert "Copying firmware files" "odroidxu4 VENDOR KERNEL?" "warn"
  38. # check $kernel_work_dir is set and exists, or bail
  39. [[ -z "${kernel_work_dir}" ]] && exit_with_error "kernel_work_dir is not set"
  40. [[ ! -d "${kernel_work_dir}" ]] && exit_with_error "kernel_work_dir does not exist: ${kernel_work_dir}"
  41. run_host_command_logged mkdir -pv "${kernel_work_dir}/firmware/edid"
  42. run_host_command_logged cp -pv "${SRC}"/packages/blobs/odroidxu4/*.bin "${kernel_work_dir}/firmware/edid"
  43. fi
  44. }
  45. setup_write_uboot_platform() {
  46. # this will update u-boot on the device rootfs is located on
  47. # in case it's a mmc device, otherwise DEVICE will not be changed
  48. # and will default to /dev/mmcblk0
  49. local tmp=$(cat /proc/cmdline)
  50. tmp="${tmp##*root=}"
  51. tmp="${tmp%% *}"
  52. [[ -n $tmp ]] && local part=$(findfs $tmp 2> /dev/null)
  53. [[ -n $part ]] && local dev=$(lsblk -n -o PKNAME $part 2> /dev/null)
  54. [[ -n $dev && $dev == mmcblk* ]] && DEVICE="/dev/${dev}"
  55. }
  56. write_uboot_platform() {
  57. # handle writing to eMMC on package upgrades
  58. # assuming $2 points to a correct device
  59. if [[ $2 == /dev/mmcblk* && -b ${2}boot0 ]]; then
  60. local device=${2}boot0
  61. echo 0 > /sys/block/$(basename $device)/force_ro
  62. local is_emmc=1
  63. signed_bl1_position=0
  64. bl2_position=30
  65. uboot_position=62
  66. else
  67. local device=${2}
  68. signed_bl1_position=1
  69. bl2_position=31
  70. uboot_position=63
  71. fi
  72. if [[ $is_emmc == 1 ]]; then
  73. tzsw_position=1502
  74. else
  75. tzsw_position=1503
  76. fi
  77. env_position=2015
  78. dd if=$1/bl1.bin.hardkernel of=$device seek=$signed_bl1_position conv=fsync > /dev/null 2>&1
  79. dd if=$1/bl2.bin.hardkernel.720k_uboot of=$device seek=$bl2_position conv=fsync > /dev/null 2>&1
  80. dd if=$1/u-boot-dtb.bin of=$device bs=512 seek=$uboot_position conv=fsync > /dev/null 2>&1
  81. dd if=$1/tzsw.bin.hardkernel of=$device seek=$tzsw_position conv=fsync > /dev/null 2>&1
  82. dd if=/dev/zero of=$device seek=$env_position bs=512 count=32 conv=fsync > /dev/null 2>&1
  83. }
  84. family_tweaks() {
  85. echo "blacklist ina231_sensor" > $SDCARD/etc/modprobe.d/blacklist-odroid.conf
  86. }
  87. family_tweaks_bsp() {
  88. mkdir -p $destination/etc/udev/rules.d
  89. cp $SRC/packages/bsp/odroid/90-builtin-net-rps.rules $destination/etc/udev/rules.d
  90. mkdir -p $destination/usr/local/bin
  91. cp $SRC/packages/bsp/rockchip/hdmi.rules $destination/etc/udev/rules.d
  92. install -m 755 $SRC/packages/bsp/rockchip/hdmi-hotplug $destination/usr/local/bin
  93. # park HDD heads on shutdown
  94. mkdir -p $destination/lib/systemd/system-shutdown
  95. install -o root -g root -m 0755 $SRC/packages/bsp/odroid/odroid.shutdown $destination/lib/systemd/system-shutdown/odroid.shutdown
  96. }