94 lines
2.8 KiB
Plaintext
94 lines
2.8 KiB
Plaintext
#
|
|
# 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
|
|
SERIALCON='ttyPS0'
|
|
LINUXFAMILY=zynq
|
|
|
|
KERNELSOURCE='https://github.com/Xilinx/linux-xlnx.git'
|
|
declare -g KERNEL_MAJOR_MINOR="5.4" # Major and minor versions of this kernel. See https://github.com/Xilinx/linux-xlnx/blob/xilinx-v2020.2/Makefile
|
|
KERNELBRANCH='tag:xilinx-v2020.2'
|
|
KERNELDIR='linux-xlnx'
|
|
KERNELPATCHDIR='zynq-'$BRANCH
|
|
|
|
BOOTSOURCE='https://github.com/Xilinx/u-boot-xlnx.git'
|
|
BOOTBRANCH='tag:xilinx-v2020.2'
|
|
BOOTCONFIG="xilinx_zynq_virt_defconfig"
|
|
BOOTDIR='u-boot-xlnx'
|
|
BOOTSCRIPT='boot-zynq.cmd:boot.cmd'
|
|
BOOTENV_FILE='zynq.txt'
|
|
UBOOT_TARGET_MAP=';;u-boot.elf'
|
|
|
|
family_tweaks() {
|
|
true
|
|
}
|
|
|
|
# @TODO: rpardini: this is leaking into the host system (/usr/local), let's not
|
|
compile_xilinx_bootgen() {
|
|
# Source code checkout
|
|
fetch_from_repo "https://github.com/Xilinx/bootgen.git" "xilinx-bootgen" "branch:master"
|
|
|
|
pushd "${SRC}"/cache/sources/xilinx-bootgen || exit
|
|
|
|
# Compile and install only if git commit hash changed
|
|
# need to check if /usr/local/bin/bootgen to detect new Docker containers with old cached sources
|
|
if [[ ! -f .commit_id || $(git rev-parse @ 2> /dev/null) != $(< .commit_id) || ! -f /usr/local/bin/bootgen ]]; then
|
|
display_alert "Compiling" "xilinx-bootgen" "info"
|
|
make -s clean > /dev/null
|
|
make -s -j$(nproc) bootgen > /dev/null
|
|
mkdir -p /usr/local/bin/
|
|
install bootgen /usr/local/bin > /dev/null 2>&1
|
|
git rev-parse @ 2> /dev/null > .commit_id
|
|
fi
|
|
|
|
popd
|
|
}
|
|
|
|
uboot_custom_postprocess() {
|
|
# Precompiled first stage bootloader
|
|
(fetch_from_repo "https://github.com/tparys/xilinx-fsbl-blobs" "xilinx-fsbl" "branch:master")
|
|
cp ${SRC}/cache/sources/xilinx-fsbl/zynq/fsbl.elf .
|
|
|
|
# Compile Xilinx bootgen to make boot image
|
|
compile_xilinx_bootgen
|
|
|
|
# Create a bootgen build instruction file
|
|
cat > build.bif << EOF
|
|
the_ROM_image : {
|
|
[bootloader]fsbl.elf
|
|
u-boot.elf
|
|
}
|
|
EOF
|
|
|
|
# Regenerate boot.bin
|
|
rm -f boot.bin
|
|
bootgen -image build.bif -o i boot.bin
|
|
|
|
# And a simple README for users
|
|
cat > README << EOF
|
|
# Regenerate Zynq boot.bin from fsbl.elf, u-boot.elf
|
|
bootgen -image build.bif -o i boot.bin
|
|
EOF
|
|
|
|
# Package build components into u-boot lib dir
|
|
cp fsbl.elf "$uboottempdir/${uboot_name}/usr/lib/${uboot_name}/${f_dst}"
|
|
cp build.bif "$uboottempdir/${uboot_name}/usr/lib/${uboot_name}/${f_dst}"
|
|
cp README "$uboottempdir/${uboot_name}/usr/lib/${uboot_name}/${f_dst}"
|
|
|
|
# Package boot.bin as a u-boot "config file", so package manager
|
|
# won't fight end users who update this themselves ...
|
|
mkdir -p "$uboottempdir/${uboot_name}/boot"
|
|
cp boot.bin "$uboottempdir/${uboot_name}/boot"
|
|
mkdir -p "$uboottempdir/${uboot_name}/DEBIAN"
|
|
echo "/boot/boot.bin" > "$uboottempdir/${uboot_name}/DEBIAN/conffiles"
|
|
}
|
|
|
|
write_uboot_platform() {
|
|
:
|
|
}
|