Hitchhikers Guide to the BeagleBoard xM

From Sabayon Wiki
Jump to: navigation, search

Where to start

The first Sabayon ARM port has been worked out on a BeagleBone, and its wiki entry is actually covering all the chroot setup. So, if you're interested in how to bootstrap an ARMv7 system, just have a look at Hitchhikers Guide to the BeagleBone (and ARMv7a). In this section instead, we just cover some useful information that can help you to get Sabayon running on the BeagleBoard xM. At the moment, there are complete Sabayon ARMv7 images for the BeagleBoard xM, compiled with -mfpu-abi=hardfp (so, as long as TI doesn't release updated PowerVR libraries that work on hardfp, if you're looking for 3D, you'll be out of luck here).

Booting

Booting on the BeagleBoard xM is similar to booting on the BeagleBone, with the difference that we need to have a MLO and u-boot.img suited for this hardwared. A vfat filesystem at the beginning of the MMC is used as a boot partition. So, this is what we actually need to have on the BeagleBoard xM vfat partition:

  1. The MLO image (contains the x-loader code that starts u-boot -- like grub stage1 crap).
  2. The boot parameters file (uEnv.txt file)
  3. The u-boot image file (u-boot.img)

The kernel (uImage) and initramfs (uInitrd) will be loaded directly from the system partition (the second one), which is just ext3 (ext4 is not yet supported -- it's actually not supported by *all* the u-boot implementations).

MLO (Mmc LOader)

You could compile your own MLO, but why? Usually, BeagleBoard people at least, provide their own MLO and there isn’t much need to cook your own off x-loader crap.

So, just grab it from molecules.git repo here and place inside the vfat partition (the boot partition).

If you are interested in building it, have a look at http://gitorious.org/x-load-omap3 . But anyway, the u-boot repo listed in the u-boot.img chapter contains the buildsystem for MLO (it actually builds the MLO).

uEnv.txt

In this configuration, we want to load the kernel image (uImage) directly from the root filesystem. This way we can control the kernel version without touching the boot partition any further.

For the BeagleBoard xM, the uEnv.txt file is quite simple and you can find it here.

Just copy it over to the vfat partition (the boot partition).

u-boot.img

The same about MLO applies to u-boot.img, but this is easier to get working. Also, have a look at the patch below if you need initramfs support working out of the box with Sabayon stuff.

If you go ahead reading this, take into account that you need a cross compiler that is able to chew ARM.

In our case, with the BeagleBoard, it’s just a matter of using the official u-boot git repo at git://git.denx.de/u-boot.git and at least u-boot 2011.12:

git clone git://git.denx.de/u-boot.git
make ARCH=arm CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi- omap3_beagle_config
make -j8 ARCH=arm CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi-
make -j8 ARCH=arm CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi- u-boot.img

This will generate a final u-boot.img file that you need to copy to the vfat partition (the boot partition).

You may need the following patch in order to boot Sabayon ARM images (expecting /boot/uImage and /boot/uInitrd for kernel and ramdisk files on the rootfs):

diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h
index 91af8a0..07e48eb 100644
--- a/include/configs/omap3_beagle.h
+++ b/include/configs/omap3_beagle.h
@@ -217,7 +217,6 @@
 	"optargs=\0" \
 	"camera=none\0" \
 	"vram=12M\0" \
-	"dvimode=640x480MR-16@60\0" \
 	"defaultdisplay=dvi\0" \
 	"mmcdev=0\0" \
 	"mmcroot=/dev/mmcblk0p2 rw\0" \
@@ -232,7 +231,6 @@
 		"buddy=${buddy} "\
 		"camera=${camera} "\
 		"vram=${vram} " \
-		"omapfb.mode=dvi:${dvimode} " \
 		"omapdss.def_disp=${defaultdisplay} " \
 		"root=${mmcroot} " \
 		"rootfstype=${mmcrootfstype}\0" \
@@ -242,7 +240,6 @@
 		"buddy=${buddy} "\
 		"camera=${camera} "\
 		"vram=${vram} " \
-		"omapfb.mode=dvi:${dvimode} " \
 		"omapdss.def_disp=${defaultdisplay} " \
 		"root=${nandroot} " \
 		"rootfstype=${nandrootfstype}\0" \
@@ -255,16 +252,19 @@
 		"mpurate=${mpurate} " \
 		"buddy=${buddy} "\
 		"vram=${vram} " \
-		"omapfb.mode=dvi:${dvimode} " \
 		"omapdss.def_disp=${defaultdisplay} " \
 		"root=${ramroot} " \
 		"rootfstype=${ramrootfstype}\0" \
 	"loadramdisk=fatload mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \
 	"loaduimagefat=fatload mmc ${mmcdev} ${loadaddr} uImage\0" \
 	"loaduimage=ext2load mmc ${mmcdev}:2 ${loadaddr} /boot/uImage\0" \
+	"loaduinitrd=ext2load mmc ${mmcdev}:2 ${rdaddr} /boot/uInitrd\0" \
 	"mmcboot=echo Booting from mmc ...; " \
 		"run mmcargs; " \
 		"bootm ${loadaddr}\0" \
+	"mmcbootrd=echo Booting from mmc (+uInitrd)...; " \
+		"run mmcargs; " \
+		"bootm ${loadaddr} ${rdaddr}\0" \
 	"nandboot=echo Booting from nand ...; " \
 		"run nandargs; " \
 		"nand read ${loadaddr} 280000 400000; " \
@@ -288,7 +288,11 @@
 			"run uenvcmd;" \
 		"fi;" \
 		"if run loaduimage; then " \
-			"run mmcboot;" \
+			"if run loaduinitrd; then " \
+				"run mmcbootrd;" \
+			"else " \
+				"run mmcboot;" \
+			"fi;" \
 		"fi;" \
 	"fi;" \
 	"run nandboot;" \

uImage

We offer a "known to be good enough" kernel and its sources via our Portage overlay and Entropy repository. If you're looking for them, just get:

  1. sys-kernel/linux-beagle (kernel binary, modules and initramfs)
  2. sys-kernel/beagle-sources (source code from where sys-kernel/linux-beagle has been compiled from)

Serial console

As explained in the Tips and tricks chapter, the first source of info when something goes wrong at boot is the serial console.

But, in order to make it work and allow login, you need to tweak /etc/inittab.

For the BeagleBone the following line should be edited (changing the current s0:... line):

s0:12345:respawn:/sbin/agetty 115200 ttyO2 vt100

And of course, add ttyO2 to /etc/securetty.

Fstab and other stuff

For the remaining tasks, you can just have a look at the BeagleBone guide mentioned at the beginning of this page.

The Graphics Stack (ouch)

The BeagleBoard xM uses Imagination PowerVR chips. The company, through Texas Instruments, provides GLES libraries and a kernel driver, which is already available inside the kernel for this board (sys-kernel/linux-beagle). Unfortunately, as of today, our systems are compiled with the hardfp stack parameters convention ABI (the new and faster one), while the proprietary libraries are only shipped using the softfp ABI, which ABI is going die soon and even faster once Ubuntu will move over (and forse TI to move).

So, for now, and unless Sabayon is going to provide softfp environments, you can only use the framebuffer driver with no OpenGL acceleration (sorry!). Once you install xorg-server and xf86-video-omapfb you should be up and running, no need to write a xorg.conf file at all.

Currently, you can choose between Fluxbox, XFCE, LXDE and (hopefully soon) GNOME3 (but still in failsafe mode).