User:Minou/Arm64/Beaglebone-AI64
From Gentoo Wiki
< User:Minou | Arm64
Jump to:navigation
Jump to:search
Left to do = Test the SD image
I still have issue with the display, apparently I am not the only one. I need to figure out how to get the HDMI display to be recognized.
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
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 public directory
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 $
mkdir deploy
user $
mkdir deploy/tmp
user $
git clone https://github.com/SuzieLinux/Linux-Files.git
user $
mv Linux-Files/getKernel.sh ./
user $
./getKernel.sh
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
We need to install the newly compiled kernel
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
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
Create Image
With fdisk create a 128MB partition for the boot partition and an ext4 partition for the rootfs su to root (not "su -" so it won't change the directory)
user $
su
root #
fdisk /dev/sdd
Bienvenue dans fdisk (util-linux 2.40.2).
Les modifications resteront en mémoire jusqu'à écriture.
Soyez prudent avant d'utiliser la commande d'écriture.
Commande (m pour l'aide) : p
Disque /dev/sdd : 59,48 GiB, 63864569856 octets, 124735488 secteurs
Modèle de disque : Mass-Storage
Unités : secteur de 1 × 512 = 512 octets
Taille de secteur (logique / physique) : 512 octets / 512 octets
taille d'E/S (minimale / optimale) : 512 octets / 512 octets
Type d'étiquette de disque : dos
Identifiant de disque : 0xc1078c06
Périphérique Amorçage Début Fin Secteurs Taille Id Type
/dev/sdd1 * 2048 264191 262144 128M c W95 FAT32 (LBA)
/dev/sdd2 264192 124735487 124471296 59,4G 83 Linux
root #
mkfs.vfat -F 16 /dev/sdd1 -n FIRMWARE
root #
mkfs.ext4 /dev/sdd2 -L rootfs
root #
exit
Create empty directories for boot and rootfs and mount the partitions
root #
cd $HOME/travail/arm64/beaglebone-AI-64/
root #
mkdir boot
root #
mkdir rootfs
root #
sudo mount /dev/sdd1 boot
root #
sudo mount /dev/sdd2 rootfs
root #
cd public
root #
cp sysfw.itb ../boot
root #
cp tiboot3.bin ../boot
root #
cp tispl.bin ../boot
root #
cp u-boot.img ../boot
root #
cp sysfw.itb ../boot
root #
cp tee-pager_v2.bin boot
root #
cp ../kernel/deploy/Image boot
root #
cp -Rp /usr/src/arm64/rootfs-beaglebone-AI-64 rootfs
root #
sync
root #
cp ../kernel/deploy/Image boot
root #
cp -Rp ../kernel/deploy/tmp/ti rootfs
root #
cp -Rp ../kernel/deploy/tmp/lib/modules rootfs/lib
root #
exit
Create extlinux.conf in boot partition, this is what tell u-boot what to load…
FILE
boot/extlinux/extlinux.conf
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
Just Starting
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 We get the latest stable kernel
user $
cd $HOME/travail/arm64
user $
mkdir rpi5
user $
cd rpi5
user $
tar xvf stable_20250127.tar.gz linux-20250127
user $
mkdir boot
user $
mkdir boot/overlays
Compile kernel
user $
export CC=aarch64-unknown-linux-gnu-
user $
cd linux-20250127
user $
export KERNEL=kernel_2712
user $
make ARCH=arm64 CROSS_COMPILE=${CC} distclean
user $
make ARCH=arm64 CROSS_COMPILE=${CC} bcm2712_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 $
cp arch/arm64/boot/Image ../boot/$KERNEL.img
user $
cp arch/arm64/boot/dts/broadcom/*.dtb ../boot/
user $
cp arch/arm64/boot/dts/overlays/*.dtb* ../boot/overlays/
user $
cp arch/arm64/boot/dts/overlays/README ../boot/overlays/
user $
cp arch/arm64/boot/dts/broadcom/*.dtb ../boot/
user $
cp arch/arm64/boot/dts/overlays/*.dtb* ../boot/overlays/
user $
cp arch/arm64/boot/dts/overlays/README ../boot/overlays/
If the rootfs is not already created do this
root #
cd /usr/src/arm64
root #
mkdir rootfs-rpi5
root #
cd rootfs-rpi5
root #
tar xvf ../rootfs-arm64-20250129.tar.gz --strip-components 1
We need to install the kernel modules
user $
sudo make ARCH=arm64 CROSS_COMPILE=aarch64-unknown-linux-gnu- modules_install INSTALL_MOD_PATH=/usr/src/arm64/rootfs-rpi5