Running Linux Kernel for Development on PocketBeagle 2
Hello everyone. In this post, I will go over the setup I use when doing Linux Kernel development. I will be using PocketBeagle 2 in this post, but the same instructions should work with most other BeagleBoard.org Boards.
Setup
The first step is to fetch the kernel repo. I am going to use linux-next in this post, but the instructions stay the same for other kernel forks.
- Clone the repo
- Since we are cross-compiling here, we need to set some environment variables. I personally use direnv, so I set them in the
.envrc
file:
# The CROSS_COMPILE binary might be different on Ubuntu based systems. I am using Fedora.
- Create default config.
- (Optional) Use menu config to enable more config options.
Building
Build the kernel.
Copying to SD Card
The partitions on SD Card are mounted at /run/media/ayush/
.
- Copy Kernel
- Install kernel modules into SD Card.
- Add entry to extlinux.conf
- (Optional) It is possible to use a custom devicetree along with the kernel. Just copy the devicetree to
/run/media/ayush/BOOT/ti/k3-am6232-pocketbeagle2-dev.dtb
and uncomment the fdt line in the above entry.
Eject the SD Card.
Booting into the new kernel
U-Boot will now show a menu to select the kernDev
boot entry during boot. It is also possible to set the kernDev
entry be the default boot entry in extlinux.conf
Once boot up is successful, the running kernel can be checked using uname -r
.
Ending Thoughts
That is all for this post. Hopefully, this helps people get an idea regarding running custom kernels without replacing the default one. There are also ways like network booting, which can be specially useful for development, but I will leave those for some other time.
Consider supporting me if you like my work.