zynq.conf 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. SERIALCON='ttyPS0'
  11. LINUXFAMILY=zynq
  12. KERNELSOURCE='https://github.com/Xilinx/linux-xlnx.git'
  13. export KERNEL_MAJOR_MINOR="5.4" # Major and minor versions of this kernel. See https://github.com/Xilinx/linux-xlnx/blob/xilinx-v2020.2/Makefile
  14. KERNELBRANCH='tag:xilinx-v2020.2'
  15. KERNELDIR='linux-xlnx'
  16. KERNELPATCHDIR='zynq-'$BRANCH
  17. BOOTSOURCE='https://github.com/Xilinx/u-boot-xlnx.git'
  18. BOOTBRANCH='tag:xilinx-v2020.2'
  19. BOOTCONFIG="xilinx_zynq_virt_defconfig"
  20. BOOTDIR='u-boot-xlnx'
  21. BOOTSCRIPT='boot-zynq.cmd:boot.cmd'
  22. BOOTENV_FILE='zynq.txt'
  23. UBOOT_TARGET_MAP=';;u-boot.elf'
  24. family_tweaks() {
  25. true
  26. }
  27. # @TODO: rpardini: this is leaking into the host system (/usr/local), let's not
  28. compile_xilinx_bootgen() {
  29. # Source code checkout
  30. fetch_from_repo "https://github.com/Xilinx/bootgen.git" "xilinx-bootgen" "branch:master"
  31. pushd "${SRC}"/cache/sources/xilinx-bootgen || exit
  32. # Compile and install only if git commit hash changed
  33. # need to check if /usr/local/bin/bootgen to detect new Docker containers with old cached sources
  34. if [[ ! -f .commit_id || $(git rev-parse @ 2> /dev/null) != $(< .commit_id) || ! -f /usr/local/bin/bootgen ]]; then
  35. display_alert "Compiling" "xilinx-bootgen" "info"
  36. make -s clean > /dev/null
  37. make -s -j$(nproc) bootgen > /dev/null
  38. mkdir -p /usr/local/bin/
  39. install bootgen /usr/local/bin > /dev/null 2>&1
  40. git rev-parse @ 2> /dev/null > .commit_id
  41. fi
  42. popd
  43. }
  44. uboot_custom_postprocess() {
  45. # Precompiled first stage bootloader
  46. (fetch_from_repo "https://github.com/tparys/xilinx-fsbl-blobs" "xilinx-fsbl" "branch:master")
  47. cp ${SRC}/cache/sources/xilinx-fsbl/zynq/fsbl.elf .
  48. # Compile Xilinx bootgen to make boot image
  49. compile_xilinx_bootgen
  50. # Create a bootgen build instruction file
  51. cat > build.bif << EOF
  52. the_ROM_image : {
  53. [bootloader]fsbl.elf
  54. u-boot.elf
  55. }
  56. EOF
  57. # Regenerate boot.bin
  58. rm -f boot.bin
  59. bootgen -image build.bif -o i boot.bin
  60. # And a simple README for users
  61. cat > README << EOF
  62. # Regenerate Zynq boot.bin from fsbl.elf, u-boot.elf
  63. bootgen -image build.bif -o i boot.bin
  64. EOF
  65. # Package build components into u-boot lib dir
  66. cp fsbl.elf "$uboottempdir/${uboot_name}/usr/lib/${uboot_name}/${f_dst}"
  67. cp build.bif "$uboottempdir/${uboot_name}/usr/lib/${uboot_name}/${f_dst}"
  68. cp README "$uboottempdir/${uboot_name}/usr/lib/${uboot_name}/${f_dst}"
  69. # Package boot.bin as a u-boot "config file", so package manager
  70. # won't fight end users who update this themselves ...
  71. mkdir -p "$uboottempdir/${uboot_name}/boot"
  72. cp boot.bin "$uboottempdir/${uboot_name}/boot"
  73. mkdir -p "$uboottempdir/${uboot_name}/DEBIAN"
  74. echo "/boot/boot.bin" > "$uboottempdir/${uboot_name}/DEBIAN/conffiles"
  75. }
  76. write_uboot_platform() {
  77. :
  78. }