Actions

EmSys

Difference between revisions of "Build Linux Kernel For BeagleBone Black"

From EdWiki

m
m (Build Linux Kernel for BeagleBone Black)
 
Line 3: Line 3:
 
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 [https://github.com/beagleboard/linux BeagleBoard github repo] and can be "checked out" using Git with the following command - note that this does take a good while:
 
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 [https://github.com/beagleboard/linux BeagleBoard github repo] and can be "checked out" using Git with the following command - note that this does take a good while:
  
  cd ~/bbb_linux/
+
   
 +
cd ~/bbb_linux/
 
  git clone git://github.com/beagleboard/linux.git
 
  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.
 
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
 
  cd linux
  git checkout am33x-rt-v5.4 -b am33x-rt-v5.4
+
  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'''.
 
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'''.
  
  armmake bb.org_defconfig
+
   
 +
armmake bb.org_defconfig
 +
 
  
 
If we need to fine-tune this configuration we can do so using 'menuconfig' i.e. we simply run:
 
If we need to fine-tune this configuration we can do so using 'menuconfig' i.e. we simply run:
 +
  
 
  armmake menuconfig
 
  armmake menuconfig
 +
  
 
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:
 
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
 
  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:
 
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:
 +
  
 
  armmake modules
 
  armmake modules
 +
  
 
That is it!
 
That is it!

Latest revision as of 18:16, 28 November 2020

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:


cd ~/bbb_linux/

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.


armmake bb.org_defconfig


If we need to fine-tune this configuration we can do so using 'menuconfig' i.e. we simply run:


armmake menuconfig


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:


armmake modules


That is it!