Build Linux Kernel For BeagleBone Black
Build Linux Kernel for BeagleBone Black
Our host should now be ready to cross-compile a kernel, all that is required is to download the kernel. There are a number of ways we can do this for the BeagleBone platform but here we will concentrate on the official kernel release which can be found on the BeagleBoard github repo and can be "checked out" using Git with the following command - note that this does take a good while:
git clone git://github.com/beagleboard/linux.git
Once complete change to the newly checked out directory. This kernel should feature the latest configuration files and patches for the various BeagleBone Black platforms. Now, we need to configure the kernel, then build it and finally deploy it. Let's start with the configuration.
cd linux git checkout 5.4.70-ti-rt-r19 -b 5.4.70-ti-rt-r19
Since we have cloned the official BeagleBoard source, we can call the default configuration straight from the sources. The following command initialises the kernel sources by copying the default BeagleBoard kernel configuration to the base directory of the kernel sources - and renames it .config.
If we need to fine-tune this configuration we can do so using 'menuconfig' i.e. we simply run:
Now the sources are configured, we should be able to build the kernel. As with the configuration command we also specify the ARCH and CROSS_COMPILE flags but also we need to tell the build system the target kernel image type required - uImage along with specifying the address that the kernel should be located with the LOADADDR argument. We also specify that we want the device tree to be compiled too, as follows:
armmake uImage dtbs modules LOADADDR=0x80008000
We have now built a kernel for the BeagleBoard platform and if we intend to make any changes to the kernel modules, we need to build these modules by simply adding the arguments to the 'make modules' command as follows:
That is it!