User:Minou/Arm64/Beaglebone-AI-64
From Gentoo Wiki
< User:Minou | Arm64
Jump to:navigation
Jump to:search
Left to do = Test the SD image
Build u-boot
Here it is assumed that the directory travail already exists We create a beaglebone-AI-64 directory The following is based on the script build_u-boot.sh from Robert Nelson
user $
cd $HOME/travail/arm64
user $
mkdir beaglebone-AI-64
user $
cd beaglebone-AI-64
user $
chmod a+x 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 sysfw.itb 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 $
git clone https://github.com/SuzieLinux/Linux-Files.git
user $
mv Linux-Files/getKernel.sh ./
user $
./getKernel.sh
user $
mkdir deploy
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
Create gentoo rootfs
We will be using an already created rootfs
root #
cd /usr/src/arm64
root #
mkdir rootfs-beaglebone-AI-64
root #
cd rootfs-beaglebone-AI-64
root #
tar xvf ../rootfs-arm64-20250129.tar.gz --strip-components 1
chroot in rootfs directory
root #
arch-chroot /usr/src/arm64/rootfs-beaglebone-AI-64
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
root #
exit
We need to install the newly compiled kernel
user $
cd $HOME/travail/arm64/beaglebone-AI-64
user $
sudo make ARCH=arm64 CROSS_COMPILE=aarch64-unknown-linux-gnu- modules_install INSTALL_MOD_PATH=/usr/src/arm64/rootfs-beaglebone-AI-64
user $
sudo make ARCH=arm64 CROSS_COMPILE=aarch64-unknown-linux-gnu- dtbs_install INSTALL_DTBS_PATH=/usr/src/arm64/rootfs-beaglebone-AI-64
user $
cp arch/arm64/boot/Image ../deploy
Create Image
Here we'll assume that the micro SD will be on /dev/sdd Change it to what yours is on
user $
sudo sfdisk ${DISK} <<-__EOF__
user $
1M,128M,0xC,*
user $
!129M,,,-
user $
__EOF__
user $
sudo mkfs.vfat -F 16 /dev/sdd1 -n FIRMWARE
user $
sudo mkfs.ext4 /dev/sdd2 -L rootfs
user $
mkdir boot
user $
mkdir rootfs
user $
sudo mount /dev/sdd1 boot
user $
sudo mount /dev/sdd2 rootfs
user $
cp deploy/sysfw.itb boot
user $
cp deploy/tiboot3.bin boot
user $
cp deploy/tispl.bin boot
user $
cp deploy/u-boot.img boot
user $
cp deploy/sysfw.itb boot
user $
cp deploy/tee-pager_v2.bin boot
user $
cp ../kernel/arch/arm64/boot/Image boot
user $
sudo cp -Rp /usr/src/arm64/rootfs-beaglebone-AI-64 rootfs
user $
sudo sync
Create extlinux.conf in boot partition, this is what tell u-boot what to load…
label Linux microSD
kernel /Image
append console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000 root=/dev/mmcblk1p2 ro rootfstype=ext4 rootwait net.ifnames=0
fdtdir /
user $
sudo umount rootfs
user $
sudo umount boot