Ax5soc Build linux image from scratch
From Terasic Wiki
(Difference between revisions)
Line 39: | Line 39: | ||
make -j $(nproc) PLAT=agilex5 bl31 | make -j $(nproc) PLAT=agilex5 bl31 | ||
cd .. | cd .. | ||
- | |||
- | |||
- | |||
</pre> | </pre> | ||
+ | The following files is created: | ||
+ | * $TOP_FOLDER/arm-trusted-firmware/build/agilex5/release/bl31.bin (to used for u-boot.itb generation) | ||
+ | |||
+ | |||
'''3. Build U-Boot''' | '''3. Build U-Boot''' | ||
Line 55: | Line 56: | ||
ln -s ../arm-trusted-firmware/build/agilex5/release/bl31.bin | ln -s ../arm-trusted-firmware/build/agilex5/release/bl31.bin | ||
make -j $(nproc) | make -j $(nproc) | ||
- | |||
- | |||
- | |||
- | |||
</pre> | </pre> | ||
+ | The following files is created: | ||
+ | * $TOP_FOLDER/u-boot-socfpga/u-boot.itb | ||
+ | * $TOP_FOLDER/u-boot-socfpga/spl/u-boot-spl-dtb.hex | ||
+ | |||
'''4. Creating the Boot Script''' | '''4. Creating the Boot Script''' |
Revision as of 10:17, 18 October 2024
reference: rocket https://www.rocketboards.org/foswiki/Documentation/BuildingBootloaderForAgilex5
OS: Ubuntu-22.04 (PC or Windows WLS)
1. Setting Up Environment
- Install the required packages on Ubuntu:
sudo apt-get update sudo apt-get upgrade sudo apt install make bison flex python3-dev libssl-dev swig sudo apt install u-boot-tools sudo apt install qemu-user-static
- Create top folder:
mkdir ATUM_A5_V1.2.sdmmc cd ATUM_A5_V1.2.sdmmc export TOP_FOLDER=`pwd`
- Download and setup the the toolchain as follows:
cd $TOP_FOLDER wget https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel\ /gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.xz tar xf gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.xz rm -f gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.xz export PATH=`pwd`/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu/bin:$PATH export ARCH=arm64 export CROSS_COMPILE=aarch64-none-linux-gnu-
2. Build Arm Trusted Firmware
cd $TOP_FOLDER rm -rf arm-trusted-firmware git clone -b QPDS24.1_REL_AGILEX5_GSRD_PR https://github.com/altera-opensource/arm-trusted-firmware arm-trusted-firmware cd arm-trusted-firmware make -j $(nproc) PLAT=agilex5 bl31 cd ..
The following files is created:
- $TOP_FOLDER/arm-trusted-firmware/build/agilex5/release/bl31.bin (to used for u-boot.itb generation)
3. Build U-Boot
cd $TOP_FOLDER rm -rf u-boot-socfpga git clone -b atuma5_v1.1 https://github.com/terasic/u-boot-socfpga u-boot-socfpga cd u-boot-socfpga make mrproper cp atuma5.config .config # link to ATF ln -s ../arm-trusted-firmware/build/agilex5/release/bl31.bin make -j $(nproc)
The following files is created:
- $TOP_FOLDER/u-boot-socfpga/u-boot.itb
- $TOP_FOLDER/u-boot-socfpga/spl/u-boot-spl-dtb.hex
4. Creating the Boot Script
cd $TOP_FOLDER rm -rf uboot-script && mkdir uboot-script && cd uboot-script wget https://releases.rocketboards.org/2023.12/qspi/agilex5/agilex5_uboot.txt wget https://releases.rocketboards.org/2021.11/uboot-script/agilex/uboot_script.its mv agilex5_uboot.txt uboot.txt nano uboot.txt # content see bloew mkimage -f uboot_script.its boot.scr.uimg cd ..
uboot.txt
echo "Trying to boot Linux from device ${target}"; if test ${target} = "mmc0"; then echo "Found kernel in mmc0"; mmc rescan; fatload mmc 0:1 ${kernel_addr_r} Image; fatload mmc 0:1 ${fdt_addr_r} socfpga_agilex5_terasic.dtb; setenv bootargs "console=ttyS0,115200 root=${mmcroot} rw rootwait"; booti ${kernel_addr_r} - ${fdt_addr_r}; exit; fi
The following files is created: $TOP_FOLDER/uboot-script/boot.scr.uimg Edit </pre>
5. Build Linux Kernel
cd $TOP_FOLDER rm -rf linux-socfpga git clone --filter=tree:0 -b atuma5_v1.2 https://github.com/terasic/linux-socfpga linux-socfpga cd linux-socfpga cp atuma5.config .config make -j $(nproc) Image && make intel/socfpga_agilex5_atuma5.dtb make -j $(nproc) modules make -j $(nproc) modules_install INSTALL_MOD_PATH=modules_install rm -rf modules_install/lib/modules/*/build rm -rf modules_install/lib/modules/*/source
The following files is created:
- $TOP_FOLDER/linux-socfpga/arch/arm64/boot/Image
- $TOP_FOLDER/linux-socfpga/arch/arm64/boot/dts/intel/socfpga_agilex5_atuma5.dtb
Edit