sudo apt update
sudo apt upgradeGparted :
sudo apt-get install gpartedMinicom :
sudo apt-get install minicomMkImage :
sudo apt-get install uboot-toolsInstall:
sudo apt install git bc bison flex libssl-dev make libc6-dev libncurses5-dev
sudo apt install crossbuild-essential-armhfTo check if it is correctly installed and the version:
arm-linux-gnueabihf-gcc --version U-boot is an open source universal bootloader for Linux systems. It supports features like TFTP, DHCP, NFS etc… In order to boot the kernel, a valid kernel image (uImage) is required.
It is not possible to explain u-boot here, as it is beyond the scope of this post. So, we will see how to produce a bootable image using U-boot. You can either follow the below steps to compile your own U-boot image or you could just get a prebuilt image.
Download:
mkdir -p ~/Beaglebone
cd ~/Beaglebone
git clone -b v2022.04 https://github.com/u-boot/u-boot --depth=1Compile :
cd u-boot
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am335x_evm_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-cd ~/Beaglebone
git clone https://github.com/beagleboard/linux.gitGo to the linux directory and ensure that you have cloned the correct repo by executing the following command :
cd linux/
git remote -v -
You should get this below output
origin https://github.com/beagleboard/linux.git (fetch) origin https://github.com/beagleboard/linux.git (push)
Default Configuration ;
sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- omap2plus_defconfigCompile the kernel :
sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage dtbs LOADADDR=0x80008000 -j8sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j8 modulessudo gparted-
Insert your sd card by means of card reader and open Gparted. Select your sd card from the top right corner. it will be something like this, “/dev/sdb”
-
Right click on the rectangular area showing your sd card name and select unmount as we need to unmount the existing partitions.
-
Then, delete the existing partitions by again right clicking and selecting “delete”. This will delete all your files in sd card.
-
We need two partitions in order to boot the kernel, one is for storing the bootable images and another one is for storing the minimal RFS(Root File System).
- Click Add button. Then, create partition for storing BOOT by entering the options below
New size: 1024 MB
File System: FAT32
Label: BOOT- Click Add button. Then, create another partition for storing rootfs by entering the options below
New Size: (Remaining)
File System: EXT4
Label: rootfs- Finally, click the green tick mark at the menu bar.
sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/media/$USER/rootfs/ modules_installClone the Root file system :
cd ~/Beaglebone
git clone https://github.com/Saishivareddy/Rootfs/
cd Rootfs/Copy the files into the partition in SD Card ;
sudo tar -xvf rootfs.tar.xz -C /media/$USER/rootfs/
cd /media/$USER/rootfs/rootfs/
sudo mv ./* ../
cd ../
sudo rmdir rootfscd ~\Beaglebone/linux/
cp arch/arm/boot/uImage /media/$USER/BOOT
cp arch/arm/boot/dts/am335x-boneblack.dtb /media/$USER/BOOTvim /media/$USER/BOOT/uEnv.txt- Copy the below code into that
console=ttyS0,115200n8
netargs=setenv bootargs console=ttyO0,115200n8 root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait debug earlyprintk mem=512M
netboot=echo Booting from microSD ...; setenv autoload no ; load mmc 0:1 ${loadaddr} uImage ; load mmc 0:1 ${fdtaddr} am335x-boneblack.dtb ; run netargs ; bootm ${loadaddr} - ${fdtaddr}
uenvcmd=run netboot- After completing the above steps you can find the following files in BOOT partition of sd card.
- uImage
- am335x-boneblack.dtb
- uEnv.txt