User:Minou/Arm64/BeaglePlay
From Gentoo Wiki
< User:Minou | Arm64
Jump to:navigation
Jump to:search
Gentoo applications required
Install the applications that have not been installed already
root #
emerge --ask dev-python/cryptography
root #
emerge --ask dev-python/pyelftools
root #
emerge --ask dev-util/yamllint
root #
emerge --ask dev-python/jsonschema
root #
emerge --ask gnutls
root #
emerge --ask flex
root #
emerge --ask sys-devel/bc
root #
emerge --ask bison
root #
emerge --ask swig
root #
emerge --ask dosfstools
root #
emerge --ask genimage
root #
emerge --ask mtool
root #
emerge --ask arch-chroot
Most work is done as a user
user $
cd ~
user $
mkdir -p travail
user $
mkdir -p travail/arm64
user $
mkdir -p travail/arm64/beagleplay
Download toolchains
Somehow u-boot doesn't work using the latest toolchains so we get on older one from the net If not allready installed
user $
cd $HOME
user $
mkdir -p toolchains
user $
cd toolchains
user $
wget -c https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/11.5.0/x86_64-gcc-11.5.0-nolibc-arm-linux-gnueabi.tar.xz
user $
tar-xf x86_64-gcc-11.5.0-nolibc-arm-linux-gnueabi.tar.xz
user $
wget -c https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/11.5.0/x86_64-gcc-11.5.0-nolibc-aarch64-linux.tar.xz
user $
tar -xf x86_64-gcc-11.5.0-nolibc-aarch64-linux.tar.xz
Build u-boot
user $
cd $work_directory
Comment out these two lines : CC32=arm-linux-gnueabihf- CC64=aarch64-linux-gnu-
user $
chmod a+x build_u-boot.sh
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
Linux Kernel
For the kernel we will use the compiler created on gentoo
user $
export CC64=riscv64-linux-gnu-
user $
cd $work_directory
user $
git clone https://github.com/SuzieLinux/Linux-Files.git
user $
mv Linux-Files/getKernel.sh ./
user $
chmod a+x getKernel.sh
user $
./getKernel.sh
user $
mkdir deploy
user $
mkdir deploy/tmp
user $
cd linux-6.12-ti-arm64-r13
user $
make ARCH=arm64 CROSS_COMPILE=${CC64} distclean
user $
make ARCH=arm64 CROSS_COMPILE=${CC64} bb.org_defconfig
If you want to modify the default .config use menuconfig You may want to adjust the number of cores to use
user $
make -j16 ARCH=arm64 CROSS_COMPILE=${CC64} menuconfig
user $
make -j16 ARCH=arm64 CROSS_COMPILE=${CC64} Image modules
user $
make -j16 ARCH=arm64 CROSS_COMPILE=${CC64} dtbs
user $
make ARCH=arm64 CROSS_COMPILE=${CC64} modules_install INSTALL_MOD_PATH=../deploy/tmp
user $
make ARCH=arm64 CROSS_COMPILE=${CC64} dtbs_install INSTALL_DTBS_PATH=../deploy/tmp
user $
cp arch/arm64/boot/Image ../deploy
Create extlinux.conf file
user $
echo 'label Linux' > extlinux.conf
user $
echo 'kernel /Image' >> extlinux.conf
user $
echo 'fdtdir /' >> extlinux.conf
user $
echo 'append console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000 root=/dev/mmcblk1p2 ro
user $
rootfstype=ext4 rootwait net.ifnames=0' >> extlinux.conf
Copy kernel and u-boot files
The reason for this is that I could later create Archlinux, SuSE or Fedora using the same kernel and u-boot With menuconfig I set the local to suzie
user $
echo 'label Linux' > extlinux.conf
user $
echo 'kernel /Image' >> extlinux.conf
user $
echo 'fdtdir /' >> extlinux.conf
user $
echo 'append console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000 root=/dev/mmcblk1p2 ro rootfstype=ext4 rootwait net.ifnames=0' >> extlinux.conf
user $
mkdir input
user $
cd input
user $
cp -Rp ../deploy/tmp/lib/modules ./
user $
cp ../linux-6.12-ti-arm64-r13/.config config-$kernel_version
user $
su
It will prompt for the root password
root #
chown root:root -R modules
root #
cd modules/$kernel_version
root #
rm build
root #
ln -s /usr/src/linux build
root #
cd $work_directory/input
root #
tar cvfJ modules-$kernel_version.tar.xz modules
root #
chown $USER:$USER modules-$kernel_version.tar.xz
root #
rm -rf modules
root #
cp -Rp ../linux-6.12-ti-arm64-r13 ./
root #
sync
root #
chown root:root -R linux-6.12-ti-arm64-r13
root #
cd linux-6.12-ti-arm64-r13
root #
make mrproper
root #
rm -rf .git
root #
cd ..
root #
tar cvfJ linux-$kernel_version-source.tar.xz linux-6.12-ti-arm64-r13
root #
chown $USER:$USER linux-$kernel_version-source.tar.xz
root #
rm -rf linux-6.12-ti-arm64-r13
root #
exit
user $
cp ../deploy/tmp/ti/k3-am625-beagleplay.dtb ./
user $
cp ../deploy/Image ./
user $
cp ../public/u-boot.img ./
user $
cp ../public/tiboot3.bin ./
user $
cp ../public/tispl.bin ./
user $
cd ../
user $
tar cvfJ beagleplay_misc-boot-files.tar.xz input genimage.cfg
FILE
$work_directory/genimage.cfg
image boot.vfat {
vfat {
files = {
"tispl.bin",
"u-boot.img",
"Image",
"tiboot3.bin",
"k3-am625-beagleplay.dtb"
}
file extlinux/extlinux.conf {
image = extlinux.conf
}
}
size = 256M
}
image sdcard.img {
hdimage {
}
partition u-boot {
partition-type = 0xC
bootable = "true"
image = "boot.vfat"
}
partition rootfs {
partition-type = 0x83
image = "arch_rootfs.ext4"
}
}
chroot in gentoo rootfs
user $
cd $work_directory
user $
su
Here it is assumed that the rootfs was created and compressed
root #
tar xvf /usr/src/rootfs-arm64-20250129.tar.gz rootfs-arm64
root #
arch-chroot rootfs-arm64
root #
env-update
root #
export PS1="(chroot) $PS1"
root #
source /etc/profile
root #
emerge --sync
Don't forget to Create a root password as well as a user and user 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 Any updates should be done with chroot if you have a powerful computer. Doing it on the target will take a long time. Updates can take a long time as well in chroot but not as much
root #
emerge -avuDN @world
root #
exit
root #
cd
root #
tar cvfJ ../gentoo-beagleplay-rootfs.xz *
root #
exit
Create rootfs.ext4
FILE
$work_directory/mk_gentoo_rootfs.sh
grep ^totals
user $
cd $work_directory
user $
sudo ./mk_gentoo_rootfs.sh
user $
sudo chown $USER:$USER input/rootfs.ext4
Create image file and flash to micro SD Card
{{Cmd |genimage --rootpath `mktemp` --config genimage.cfg }
If the image is created then it can be flashed onto the micro sd
user $
cd images
user $
su
Replace sdd with whatever your micro sd is After it is done remove the device and plug it back Use gparted to expand the partition
root #
dd if=/dev/sdd of=sdcard.img status=progress iflag=direct
root #
exit