User:Minou/Arm64/BeagleY-AI

From Gentoo Wiki
< User:Minou‎ | Arm64
Jump to:navigation Jump to:search

Left to do = Create SD image

Build u-boot

Here it is assumed that the directory travail already exists
We create a beagley-ai directory
The following is based on the script build_u-boot.sh from Robert Nelson
user $cd $HOME/travail/arm64
user $mkdir beagley-ai
user $cd beagley-ai
user $chmod a+x build_u-boot.sh
FILE build_u-boot.sh
change CC64=aarch64-linux-gnu- to CC64=aarch64-unknown-linux-gnu-
   In the line to compile trusted-firmware-a add ENABLE_PIE=0 
   It will fail compiling on gentoo unless that is done
   make -C ./trusted-firmware-a/ -j4 CROSS_COMPILE=$CC64 CFLAGS= LDFLAGS= ARCH=aarch64 PLAT=k3 SPD=opteed $TFA_EXTRA_ARGS TARGET_BOARD=${TFA_BOARD} ENABLE_PIE=0 all
user $./build_u-boot.sh
The generated files can be found on the directory public:
bl31.bin
tee-pager_v2.bin  
tiboot3.bin
tispl.bin
u-boot.img

Linux Kernel

We will cross compile the kernel
It takes too long in chroot and we need a kernel to boot the image
We should be able to recompile later once we have a working image
user $cd $HOME/travail/arm64
user $mkdir kernel
user $cd kernel
user $mv Linux-Files/getKernel.sh ./
user $./getKernel.sh
user $mkdir deploy
user $mkdir deploy/tmp
Compile kernel
user $export CC=aarch64-unknown-linux-gnu-
user $cd linux-6.12-ti-arm64-r13
user $make ARCH=arm64 CROSS_COMPILE=${CC} distclean
user $make ARCH=arm64 CROSS_COMPILE=${CC} bb.org_defconfig
If you want to modify the default .config use menuconfig
You may want to adjust the number of cores to use
If you use too many cores you won't be able to do anything else
user $make -j8 ARCH=arm64 CROSS_COMPILE=${CC} menuconfig
user $make -j8 ARCH=arm64 CROSS_COMPILE=${CC} Image modules
user $make -j8 ARCH=arm64 CROSS_COMPILE=${CC} dtbs
If it compiles correctly we copy the files on the deploy directory
user $make ARCH=arm64 CROSS_COMPILE=aarch64-unknown-linux-gnu- modules_install INSTALL_MOD_PATH=../deploy/tmp
user $make ARCH=arm64 CROSS_COMPILE=aarch64-unknown-linux-gnu- dtbs_install INSTALL_DTBS_PATH=../deploy/tmp
user $cp arch/arm64/boot/Image ../deploy/cp

Create gentoo rootfs

We will be using an already created rootfs

root #cd /usr/src/arm64
root #mkdir rootfs-beagley-ai
root #cd rootfs-beagley-ai
root #tar xvf ../rootfs-arm64-20250129.tar.gz --strip-components 1

chroot in rootfs directory

root #arch-chroot /usr/src/arm64/rootfs-beagley-ai
root #env-update
root #export PS1="(chroot) $PS1"
root #source /etc/profile
root #emerge --sync

update system

Don't forget to Create a root password
Just in case the original rootfs is a few days or weeks old
it would be a good idea to do a system update
 If glibc or ncurses are reemerged this could take a while
root #emerge -avuDN @world