Updating Debian SD With Cross-Compiled Kernel

591 views
Skip to first unread message

jalod...@gmail.com

unread,
Jul 7, 2015, 1:43:34 PM7/7/15
to beagl...@googlegroups.com
I have a new BeagleBone Black (rev C) and got it booting from SD with the Debian 4GB SD image from 2015-03-01

My goal is to cross compile a custom kernel on my Linux PC and update the necessary items on the Debian SD card.

So.... I got the 4.1.1 Linux kernel from here:

  git clone git://github.com/beagleboard/linux.git


And then built the new kernel like this from what I gleaned on the web:

  make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- bb.org_defconfig
  make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage am335x-boneblack.dtb LOADADDR=0x80008000
  make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules
  mkdir MODULES
  make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules_install INSTALL_MOD_PATH=./MODULES
  cd MODULES
  tar czf target_modules.tgz lib

Success! Compiled with no errors. Now I have a uImage, a dtb, and a tarball of the modules to move the SD card.
BUT, when I look at the /boot dir on the Debian SD it seems to need vmlinuz and and initrd?

Can someone please advise on either how to use what I have built, or how to build what I need to update the SD card.
I'm not looking for an automated solution, I would rather understand the details at this point.

Regards,
Jalodi

Robert Nelson

unread,
Jul 7, 2015, 2:03:15 PM7/7/15
to Beagle Board
On Tue, Jul 7, 2015 at 12:43 PM, <jalod...@gmail.com> wrote:
> I have a new BeagleBone Black (rev C) and got it booting from SD with the
> Debian 4GB SD image from 2015-03-01
>
> My goal is to cross compile a custom kernel on my Linux PC and update the
> necessary items on the Debian SD card.
>
> So.... I got the 4.1.1 Linux kernel from here:
>
> git clone git://github.com/beagleboard/linux.git
>
>
> And then built the new kernel like this from what I gleaned on the web:
>
> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- bb.org_defconfig
> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage am335x-boneblack.dtb
> LOADADDR=0x80008000

We no longer use uImage, just build zImage

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- zImage


> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules
> mkdir MODULES
> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules_install
> INSTALL_MOD_PATH=./MODULES
> cd MODULES
> tar czf target_modules.tgz lib

you need the *.dtb's:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- dtbs
mkdir DTBS
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- dtbs_install
INSTALL_DTBS_PATH=./DTBS

> Success! Compiled with no errors. Now I have a uImage, a dtb, and a tarball
> of the modules to move the SD card.
> BUT, when I look at the /boot dir on the Debian SD it seems to need vmlinuz
> and and initrd?

> Can someone please advise on either how to use what I have built, or how to
> build what I need to update the SD card.
> I'm not looking for an automated solution, I would rather understand the
> details at this point.

Grab the kernel version from: cat include/generated/utsrelease.h | awk
'{print $3}' | sed 's/\"//g'

This will be "uname_r"

copy zimage as /boot/vmlinuz-$(uname_r)
copy *.dtbs as /boot/dtbs/$(uname_r)/*.dtb

copy modules as /lib/modules/$(uname_r)

boot and run, to generate the initrd...

sudo update-initramfs -ck `uname -r`

Regards,

--
Robert Nelson
https://rcn-ee.com/

Robert Nelson

unread,
Jul 7, 2015, 2:05:31 PM7/7/15
to Beagle Board
btw, there's an even easier method to build/install:

make ARCH=arm LOCALVERSION=-r1 CROSS_COMPILE=arm-linux-gnueabi-
KDEB_PKGVERSION=1cross deb-pkg

Then from your bbb, just "sudo dpkg -i linux-image*.deb ; sudo reboot"

g...@novadsp.com

unread,
Jul 7, 2015, 2:09:08 PM7/7/15
to beagl...@googlegroups.com
Hello.

> My goal is to cross compile a custom kernel on my Linux PC and update the necessary items on the Debian SD card.

> So.... I got the 4.1.1 Linux kernel from here:

> git clone git://github.com/beagleboard/linux.git

The following is very instructive and will also play nicer with the existing installation:

https://github.com/RobertCNelson/bb-kernel/tree/am33x-v4.1

Specifically this file for starters:

https://github.com/RobertCNelson/bb-kernel/blob/am33x-v4.1/build_kernel.sh

HTH.


jalod...@gmail.com

unread,
Jul 8, 2015, 12:45:17 PM7/8/15
to beagl...@googlegroups.com

Thanks all for the detailed replies. Also, the dpkg build is very nice - a guy could get used to it ;-)

-J

Prankur Chauhan

unread,
Aug 3, 2016, 8:01:15 AM8/3/16
to BeagleBoard

Hi Robert,

I was able to follow your steps and cross compile the kernel (3.8.13-xenomai-r79) and also copied the necessary modules and zimage and dtb files.

steps followed:
host$ git clone https://github.com/RobertCNelson/bb-kernel.git
host$ cd bb-kernel
host$ git tag  (This shows what versions can be checked out.)
host$ git checkout 3.8.13-xenomai-r79

host$ ./build_kernel.sh
after that I copied the zImage , *.dtb and modules ( also you have not seperately made a build directory , the build directory in lib/modules contains the linux source files also)

The kernel is up and running in BBB , but when I am trying to build a kernel module it is throwing me error
make[1]: Entering directory `/lib/modules/3.8.13-xenomai-r79/build'

  WARNING: Symbol version dump /lib/modules/3.8.13-xenomai-r79/build/Module.symvers
           is missing; modules will have no dependencies and modversions.

  CC [M]  /root/openvlc/reed_solomon.o
scripts/genksyms/genksyms: 1: scripts/genksyms/genksyms: Syntax error: "(" unexpected

As i can figure out there is no symversions table for the modules. There was none after running the build_kernel.sh script.
I am also supposing that the genksyms is trying to generate the symbol version information but fails to do so

Can you point out what I am doing wrong.

Regards
Prankur
Reply all
Reply to author
Forward
0 new messages