gentoo on XM

I have followed the instructions on slashorg to try to boot their
uImage. I was not successful, but I found that if I removed the
user.scr file from the boot partition it would boot the android kernel
that the XM rev A came with and use the gentoo stage-3 binarys as its
runtime environment. This is gentoo in all but the kernel, it
remembers the date, passwords etc. just like gentoo woudl on a PC.

I emerged gentoo kernel sources, built a new kernel on the xm itself
(which takes around 33 minutes by the way), emerged u-boot-tools and
ran makeimage to create a new uImage. But the new uImage that I
created will not boot. It loads but will not boot and there is no
debug information, the system just hangs.

I now have 3 images on my sdcard: uandroid (the original from the
factory), uGentoo (the binary from slashorg.org) and uG2 (the kernel I
built)

OMAP3 beagleboard.org # fatls mmc 0:1

** Unable to use mmc 0:1 for fatls **
OMAP3 beagleboard.org # mmc init
mmc1 is available
OMAP3 beagleboard.org # fatls mmc 1
  3190568 android
      376 md5sum.txt
    24296 mlo
19960110 ramdisk.gz
19509297 ramfs.img
   210360 u-boot.bin
  2989884 ugentoo
  2989884 uimage
  3190568 uandroid
  3039168 ug2

10 file(s), 0 dir(s)

Right now I can interrupt the uboot process, set the environment
variable to load the image I wish...

setenv loaduimage fatload mmc ${mmcdev} ${loadaddr} uandroid

and it goes ahead and tries to start. uandroid works, but neither of
the other kernels do. What's the secret to building a kernel that will
work on the XM ?

OMAP3 beagleboard.org # setenv loaduimage fatload mmc ${mmcdev} $
{loadaddr} uG2
OMAP3 beagleboard.org # boot
mmc1 is available
The user button is currently NOT pressed.
reading boot.scr

** Unable to read "boot.scr" from mmc 1:1 **
reading user.scr

** Unable to read "user.scr" from mmc 1:1 **
reading uG2

3039168 bytes read
Booting from mmc ...
## Booting kernel from Legacy Image at 80200000 ...
   Image Name: Gentoo
   Image Type: ARM Linux Kernel Image (uncompressed)
   Data Size: 3039104 Bytes = 2.9 MB
   Load Address: 80008000
   Entry Point: 80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

that's it, it hangs at this point. It gets a little further with the
slashorg image, printing soem periods across the screen before
hanging. As I wrote above, the uangstrom kernel boots all the way up
to a live system, complete with a persistent writable root partition.

I'd appreciate your comments

Many thanks

Alan

Update:

I followed the instructions at http://elinux.org/BeagleBoardLinuxKernel
to extract the OE version of the kernel sources from git and to apply
the patches with quilt per the "recipe" and then built the image on the
beagleboard itself (with CROSS_COMPILE=""). I also updated the
md5sum.txt file in the boot partition to reflect the checksum of the new
uImage but to no avail...

3110032 bytes read
Booting from mmc ...
## Booting kernel from Legacy Image at 80200000 ...
   Image Name: Linux-2.6.29-omap1
   Image Type: ARM Linux Kernel Image (uncompressed)
   Data Size: 3109968 Bytes = 3 MB
   Load Address: 80008000
   Entry Point: 80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing
Linux.............................................................
<hangs here>

There are no dire warnings or errors in building the uImage, plus gcc
and ld clearly build other packages cleanly or I would not have been
able to emerge git, screen, u-boot-tools, syslog-ng, openntpd etc. all
of which seem to work just fine.

I can use the pre-built kernel at
http://www.angstrom-distribution.org/demo/beagleboard/ which works and
allows me to boot my system, but I still have no luck in building my own
kernel natively.

Alan

Thanks for the reply.

So far I have tried...

1) uandroid = the pre-built kernel that came on the sdcard included with
the beagleboard. Of course that works and boots properly. I don't know
why I got it into my head that it is android when in fact it is an
angstrom Kernel. Chalk that one up to too much caffeine.

2) uGentoo = the pre-built kernel from slashorg.net's "getting started
with gentoo: wiki. This does not boot for me, I've tried a variety of
u-boot parameters including those recommended on the slashorg site. I
have no idea how this kernel was generated, I've not been successful in
joining slashorg's forum.

3) uG2 = the gentoo-sources from the gentoo portage repository, built
using the "usual" (for gentoo on a PC) make menuconfig, make process and
then converted to uImage format with makeimage. This does not boot

3) uOE = an openembedded kernel. To get this I fetched the git
repository: 58cf2f1425abfd3a449f9fe985e48be2d2555022 and applied the
patches from the linux-omap_2.6.29.bb recipe. Then built it using make
ARCH=arm omap2plus_defconfig, then make ARCH=arm uImage. That did build
a uImage, but I could not boot it.

4) uangstrom = a pre-built 2.6.32 kernel from angstrom, this works but I
did not build it.

So I can use a pre-built kernel from angstrom, but I can't use any that
I build, and I would like to build my own. Have you been able to run a
kernel built natively on the beagleboard ?

Many thanks

Alan

Thanks for the reply.

Not what I was looking for. Since I'm not running Gentoo, I don't
know what kernel (2.6.34, etc) their stuff is based on. Which is it?

The latest OMAP kernels (2.6.37 or maybe even some 2.6.36) have renamed
the serial ports from ttySn to ttyOn. If the kernel you built is this
recent, try changing the console=ttyS2 in your bootargs to console=ttyO2

Man, that would be great...

But it did not work for me, I tried tty02 and ttyO2 and I am plugged
into the DB9 serial console port.

Also, the network interface is not coming up to allow any other access
(no ping, no ssh even though both work when I boot from angstrom). Right
now I'd accept it blinking a message on an LED in morse code !

The kernel versions are...

Will boot

* Angstrom 2.6.32 (pre-built binary)

Will load but won't boot

* linux-2.6.36-gentoo-r5 (ie 2.6.36 with gentoo patches) built from
source
* 2.6.32 with OE patches built from source
* 2.6.32 vanilla kernel with no patches built from source
* Linux-2.6.29 pre-built from slashorg.net

Many thanks

Alan

I now get console output, but I can't mount the root partition r/w on
mmcblk0p2. There are pre-compiled OE kernels that can mount this
partition and read from/write to it, but mine can't. I can't figure out
whether I should be investigating an mmc problem or a usb problem.

I've tried the unpatched linux-omap kernel (2.6.37) and the
gentoo-sources kernel (2.6.36) and the patched linux-omap kernel
(2.6.29).

The error I get with unpatched linux-omap 2.6.37 is...

Waiting for root device /dev/mmcblk0p2...
mmc0: error -110 whilst initialising SD card

Google comes up with nothing that looks relevant.

The full dmesg output is...

Hit any key to stop autoboot: 0
OMAP3 beagleboard.org # setenv console ttyO2,115200n8
OMAP3 beagleboard.org # setenv mpurate 800
OMAP3 beagleboard.org # run mmcargs
OMAP3 beagleboard.org # mmc init
mmc1 is available
OMAP3 beagleboard.org # fatload mmc 0:1 0x80300000 uOMAP
reading uOMAP

2660912 bytes read
OMAP3 beagleboard.org # bootm 0x80300000
## Booting kernel from Legacy Image at 80300000 ...
   Image Name: Linux-2.6.37-rc7+
   Image Type: ARM Linux Kernel Image (uncompressed)
   Data Size: 2660848 Bytes = 2.5 MB
   Load Address: 80008000
   Entry Point: 80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Linux version 2.6.37-rc7+ (root@puppy) (gcc version 4.4.2 (Gentoo 4.4.2
p1.0) )
#4 PREEMPT Wed Dec 29 10:29:20 UTC 2010
CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c53c7f
CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: OMAP3 Beagle Board
Memory policy: ECC disabled, Data cache writeback
OMAP3630 ES1.1 (l2cache iva sgx neon isp 192mhz_clk )
SRAM: Mapped pa 0x40200000 to va 0xfe400000 size: 0x10000
pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
pcpu-alloc: [0] 0
Built 1 zonelists in Zone order, mobility grouping on. Total pages:
130048
Kernel command line: console=ttyO2,115200n8 mpurate=800 buddy=none
camera=lbcm3m
1 vram=12M omapfb.mode=dvi:640x480MR-16@60 omapdss.def_disp=dvi
root=/dev/mmcblk
0p2 rw rootfstype=ext3 rootwait
PID hash table entries: 2048 (order: 1, 8192 bytes)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 512MB = 512MB total
Memory: 514436k/514436k available, 9852k reserved, 0K highmem
Virtual kernel memory layout:
    vector : 0xffff0000 - 0xffff1000 ( 4 kB)
    fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
    DMA : 0xffc00000 - 0xffe00000 ( 2 MB)
    vmalloc : 0xe0800000 - 0xf8000000 ( 376 MB)
    lowmem : 0xc0000000 - 0xe0000000 ( 512 MB)
    modules : 0xbf000000 - 0xc0000000 ( 16 MB)
      .init : 0xc0008000 - 0xc002e000 ( 152 kB)
      .text : 0xc002e000 - 0xc04dd550 (4798 kB)
      .data : 0xc04de000 - 0xc0517000 ( 228 kB)
SLUB: Genslabs=11, HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:402
Clocking rate (Crystal/Core/MPU): 26.0/332/600 MHz
Reprogramming SDRC clock to 332000000 Hz
GPMC revision 5.0
IRQ: Found an INTC at 0xfa200000 (revision 4.0) with 96 interrupts
Total of 96 interrupts on 1 active controller
OMAP clockevent source: GPTIMER12 at 32768 Hz
Console: colour dummy device 80x30
Calibrating delay loop... 513.62 BogoMIPS (lpj=2007040)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
regulator: core version 0.5
regulator: dummy:
NET: Registered protocol family 16
OMAP GPIO hardware version 2.5
OMAP GPIO hardware version 2.5
OMAP GPIO hardware version 2.5
OMAP GPIO hardware version 2.5
OMAP GPIO hardware version 2.5
OMAP GPIO hardware version 2.5
omap_mux_init: Add partition: #1: core, flags: 0
OMAP3 Beagle Rev: xM
Found NAND on CS0
Registering NAND on CS0
Unable to get DVI reset GPIO
Switched to new clocking rate (Crystal/Core/MPU): 26.0/332/800 MHz
OMAP DMA hardware revision 5.0
bio: create slab <bio-0> at 0
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
omap_device: omap_i2c.1: new worst case activate latency 0: 30517
omap_i2c omap_i2c.1: bus 1 rev4.0 at 2600 kHz
twl4030: PIH (irq 7) chaining IRQs 368..375
twl4030: power (irq 373) chaining IRQs 376..383
twl4030: gpio (irq 368) chaining IRQs 384..401
regulator: VUSB1V5: 1500 mV normal standby
regulator: VUSB1V8: 1800 mV normal standby
regulator: VUSB3V1: 3100 mV normal standby
twl4030_usb twl4030_usb: Initialized TWL4030 USB module
regulator: VMMC1: 1850 <--> 3150 mV at 3000 mV normal standby
regulator: VDAC: 1800 mV normal standby
regulator: VDVI: 1800 mV normal standby
regulator: VSIM: 1800 <--> 3000 mV at 1800 mV normal standby
omap_i2c omap_i2c.3: bus 3 rev4.0 at 100 kHz
Advanced Linux Sound Architecture Driver Version 1.0.23.
Switching to clocksource 32k_counter
musb_hdrc: version 6.0, musb-dma, otg (peripheral+host), debug=0
omap_device: omap_i2c.1: new worst case deactivate latency 0: 30517
musb_hdrc musb_hdrc: USB OTG mode controller at fa0ab000 using DMA, IRQ
92
NET: Registered protocol family 2
IP route cache hash table entries: 4096 (order: 2, 16384 bytes)
TCP established hash table entries: 16384 (order: 5, 131072 bytes)
TCP bind hash table entries: 16384 (order: 4, 65536 bytes)
TCP: Hash tables configured (established 16384 bind 16384)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
DLM (built Dec 29 2010 05:29:59) installed
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
msgmni has been set to 1004
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
omap_uart.0: ttyO0 at MMIO 0x4806a000 (irq = 72) is a OMAP UART0
omap_uart.1: ttyO1 at MMIO 0x4806c000 (irq = 73) is a OMAP UART1
omap_uart.2: ttyO2 at MMIO 0x49020000 (irq = 74) is a OMAP UART2
console [ttyO2] enabled
omap_uart.3: ttyO3 at MMIO 0x49042000 (irq = 80) is a OMAP UART3
brd: module loaded
loop: module loaded
omap2-nand driver initializing
No NAND device found.
No NAND device found.
usbcore: registered new interface driver smsc95xx
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-omap ehci-omap.0: OMAP-EHCI Host Controller
ehci-omap ehci-omap.0: new USB bus registered, assigned bus number 1
ehci-omap ehci-omap.0: irq 77, io mem 0x48064800
ehci-omap ehci-omap.0: USB 2.0 started, EHCI 1.00
usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: OMAP-EHCI Host Controller
usb usb1: Manufacturer: Linux 2.6.37-rc7+ ehci_hcd
usb usb1: SerialNumber: ehci-omap.0
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 3 ports detected
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
usbcore: registered new interface driver cdc_acm
cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN
adapter
s
usbcore: registered new interface driver usblp
usbcore: registered new interface driver usbtmc
usbcore: registered new interface driver libusual
zero gadget: Gadget Zero, version: Cinco de Mayo 2008
zero gadget: zero ready
musb_hdrc musb_hdrc: MUSB HDRC host driver
musb_hdrc musb_hdrc: new USB bus registered, assigned bus number 2
usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb2: Product: MUSB HDRC host driver
usb usb2: Manufacturer: Linux 2.6.37-rc7+ musb-hcd
usb usb2: SerialNumber: musb_hdrc
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
mice: PS/2 mouse device common for all mice
twl_rtc twl_rtc: rtc core: registered twl_rtc as rtc0
twl_rtc twl_rtc: Power up reset detected.
twl_rtc twl_rtc: Enabling TWL-RTC.
OMAP Watchdog Timer Rev 0x31: initial timeout 60 sec
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
usbcore: registered new interface driver ushc
omap_sham_mod_init: loading omap-sham driver
omap_sham_mod_init: Unsupported cpu
omap_aes_mod_init: loading omap-aes driver
omap_aes_mod_init: Unsupported cpu
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
usbcore: registered new interface driver snd-usb-audio
usbcore: registered new interface driver snd-ua101
usbcore: registered new interface driver snd-usb-caiaq
OMAP3 Beagle/Devkit8000 SoC init
asoc: twl4030-hifi <-> omap-mcbsp-dai.1 mapping ok
ALSA device list:
  #0: omap3beagle
IPv4 over IPv4 tunneling driver
hub 1-0:1.0: unable to enumerate USB device on port 2
GRE over IPv4 demultiplexor driver
TCP cubic registered
NET: Registered protocol family 17
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
sctp: Hash tables configured (established 16384 bind 32768)
VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
omap2_set_init_voltage: unable to find boot up OPP for vdd_mpu
omap2_set_init_voltage: Unable to put vdd_mpu to its init voltage

Power Management for TI OMAP3.
clock: disabling unused clocks to save power
registered taskstats version 1
regulator_init_complete: incomplete constraints, leaving VDVI on
regulator_init_complete: incomplete constraints, leaving VDAC on
twl_rtc twl_rtc: setting system clock to 2000-01-01 00:00:00 UTC
(946684800)
Waiting for root device /dev/mmcblk0p2...
mmc0: error -110 whilst initialising SD card

I'd certainly appreciate any help you can give

Many thanks

Alan

Im using OMAP kernel tree and it compiles and boots without any patches, it seems that I just need a different FS as the boot panics at entering user space (at init somethig message)

Using the unpatched OMAP kernel with the Ubuntu FS from Rob Nelson works correctly, but it is using a ramFS and I dont want that

Bear in mind that to get debug output over the serial, you will need to change the console bootarg to ttyO2 (from ttyS2), that is why it might seem as if the boot process just hangs with the latest kernels

Lioric

It's now working (at least it boots cleanly except for USB Ethernet
support). Gary Thomas told me about the ttyO2 rename yesterday and it
does cause all sorts of heartache for gentoo it seems. In particular,
something somewhere does not allow root logins with the new console
name, and /etc/inittab needs fixing to run agetty at all.

Anyway, thanks to Lioric and Gary for their comments. I now have a self
hosted gentoo that can build its own kernel based on 2.6.37-rc8 (the
very latest form the linux-omap git tree). I've built a few packages and
it looks like I won't need a cross compiler, at least not for a little
while.

Thanks again

Alan

Glad it is working

What file system are you using with your gentoo kernel?

Lioric

The boot partition is vfat, the root partition is ext3. Those are the
only two partitions on the device.

I'm not sure that ext3 is the best possible solution, but it is the
first one I have tried and it seems to work.

Alan

ok, I think that I did the question incorrectly

What rootFS are you using with your Gentoo kernel, is it the slashorg stage3 rootFS? ubuntu’s? your own? other?

Lioric

I'm using the slashorg stage3:
http://media.slashorg.net/beagleboard/gentoo-stage3-latest.tar.bz2
<http://media.slashorg.net/beagleboard/gentoo-stage3-latest.tar.bz2>

Alan