[beagleboard] Need clarification on instructions for Ubuntu on BeagleBone

Hi Dave,

I followed the instructions at
BeagleBoardUbuntu - eLinux.org and built the kernel and then
the userspace. I installed the files on my SD card and everything worked on
the Bone as expected. Thank you so much for that helpful page and all the
wonderful scripts.

However, I'm not sure exactly what happened under the hood and I bet I'm
going to need to understand this going forward.

When I followed these first steps under "Advanced Users" for building a
BeagleBone kernel:

git clone git://github.com/RobertCNelson/linux-dev.git
cd linux-dev
git checkout origin/am33x-v3.2 -b am33x-v3.2
./build_kernel.sh

I built a kernel from source. I get that.

So, then I continued down the page under the "Userspace, used in the these
demo images" and cloned GitHub - RobertCNelson/omap-image-builder: omap image builder
and ran

./build_image.sh

This is where I'm a little confused. Did that use my kernel at all or did
that just pull a bunch of binary packages (including kernels for each Ubuntu
release)?

No, the "build_kernel.sh" by default WILL NOT use some random kernel
(unless you tell it to so...)... The "build_image.sh" script pulls a
known working kernel and packages it up with a snapshot of
ubuntu/debian userspace... It's then completely up to you to then use
the "armel-rootfs-*.tgz" file under deploy and build your own sd card
image with your own Kernel Image that you build from the "linux-dev"
repo...

I guess what I'm really trying to understand is how do I go about modifying
the kernel or building do new modules? Can I work with the kernel in the
./linux-stable/ directory and copy that onto my SD card in place of the
kernel that's there?

For example, can I modify my kernel .config or add modules?

You can do whatever you want, the default config/patchset (in
linux-dev), is just that a default working config/patchset, it's
stored in git, so it's very easy to quickly see changes..

Regards,

No, the “build_kernel.sh” by default WILL NOT use some random kernel
(unless you tell it to so…)… The “build_image.sh” script pulls a
known working kernel and packages it up with a snapshot of
ubuntu/debian userspace… It’s then completely up to you to then use
the “armel-rootfs-*.tgz” file under deploy and build your own sd card
image with your own Kernel Image that you build from the “linux-dev”
repo…

I guess what I’m really trying to understand is how do I go about modifying
the kernel or building new modules? Can I work with the kernel in the
./linux-stable/ directory and copy that onto my SD card in place of the
kernel that’s there?

For example, can I modify my kernel .config?

You can do whatever you want, the default config/patchset (in
linux-dev), is just that: a default working config/patchset, it’s
stored in git, so it’s very easy to quickly see changes…

Okay, let me see if I understand what you have said here and what I learned after more digging.

Please tell me what is right and wrong here:

  1. ‘build_image.sh’ will use the ‘ref_omap2plus_config’ to configure the kernel.
  2. ‘build_image.sh’ will traverse the ‘patches’ directory to bring in numerous patches, some specific to BeagleBone, some not (as well as any I add later).
  3. ‘build_image.sh’ can build a kernel suitable to run on the Beaglebone with the Ubuntu userspace on top.
  4. To accomplish #3, I need to make sure everything in ‘system.sh’ is correct for OMAP, include the RELADDR.
  5. I can uncomment ‘BUILD_UIMAGE=1’ in ‘system.sh’ in order to build a uImage. The resulting uImage replace the uImage that was created using ‘omap_image_builder.sh.’ and ‘setup_sd_card.sh’
  6. Instead of performing step #5, I can use tools/load_image.sh to install my zImage onto the SD card as a uImage.

Thanks so much.
Dave …

Will the initrd work as is?

First off, I had very critical typo in this message that I fixed inline. In #1-#3, I originally wrote “build_image.sh”, but the script is actually called “build_kernel.sh”.

I followed my own advice in #4 and #5, and copied the uImage directly onto the flash card in place of the old one and everything worked using the existing Ubuntu userspace.

I made my own version of the ‘build_kernel.sh’ script that skips the git_kernel, patch_kernel, and copy_defconfig steps. (I just commented out those function calls in the main function). Now, starting with my patched and configured kernel tree, the script takes me through ‘make menuconfig’ and then builds me a working ‘uImage.’ I have used this multiple times with different kernel configs and things continued to work. The script is probably not really necessary anymore. Since it’s easier than typing all of the commands, I’ll probably keep using it except when I need to do something more specific than the script allows.

Thanks again, Robert, for your help. I hope I can help some newbie in the future.

Hi Dave,

(i'd forgot about this thread..)

1. 'build_kernel.sh' will use the 'ref_omap2plus_config' to configure the
kernel.

actually "./patches/defconfig" is used for all kernel builds..
"./patches/ref_omap2plus_config" is just used for comparison
purposes..

2. 'build_kernel.sh' will traverse the 'patches' directory to bring in
numerous patches, some specific to BeagleBone, some not (as well as any I
add later).
3. 'build_kernel.sh' can build a kernel suitable to run on the Beaglebone
with the Ubuntu userspace on top.

4. To accomplish #3, I need to make sure everything in 'system.sh' is
correct for OMAP, include the RELADDR.
5. I can uncomment 'BUILD_UIMAGE=1' in 'system.sh' in order to build a
uImage. The resulting uImage replaces the uImage that was created using
'omap_image_builder.sh.' and 'setup_sd_card.sh'

6. Instead of performing step #5, I can use tools/load_image.sh to install
my zImage onto the SD card as a uImage.

First off, I had very critical typo in this message that I fixed inline. In
#1-#3, I originally wrote "build_image.sh", but the script is actually
called "build_kernel.sh".

I followed my own advice in #4 and #5, and copied the uImage directly onto
the flash card in place of the old one and everything worked using the
existing Ubuntu userspace.

I made my own version of the 'build_kernel.sh' script that skips the
git_kernel, patch_kernel, and copy_defconfig steps. (I just commented out
those function calls in the main function). Now, starting with my patched
and configured kernel tree, the script takes me through 'make menuconfig'
and then builds me a working 'uImage.' I have used this multiple times with
different kernel configs and things continued to work. The script is
probably not really necessary anymore. Since it's easier than typing all of
the commands, I'll probably keep using it except when I need to do something
more specific than the script allows.

That's exactly what the "./tools/rebuild.sh" script does.. :wink:

"./build_kernel.sh" is ment to be used for setting up the initial git
tree/patchset and building the kernel.. But once the git directory is
setup with a particular kernel, you can use the "./tools/rebuild.sh"
script to just rebuild that tree, so very useful when adding new
patches/config tweaks.. :wink:

Regards,

Much thanks, Robert.

If you would like, I can try to elaborate on some of the documentation on the Beagleboard Ubuntu based on some of things we discussed. I know it’s currently neat, tidy and concise right now. It’s more like a reference manual than a tutorial.