Is it possible to boot a kernel image from second partition (ext4)?

Hi,

I am using Robert Nelsons kernel and the setup of the
sdcard/uEnv.txt/MLO/U-Boot/dtbs described here:
http://eewiki.net/display/linuxonarm/BeagleBone+Blackhttp://eewiki.net/display/linuxonarm/BeagleBone+Black
for the sdcard of my BBB.

The sdcards first partition contains MLO, u-boot and the kernel image
and is VFAT formatted.

The second partition contains the rootfs and is ext4 formatted.

Since I update the kernel image relatively often, vfat on a small
sized partition is not optimal due to the write cycles to the flash
chip.

I would like to modify the setup that way, that kernel image and dtbs
folder are placed in a folder in the rootfs ("big" and ext4 instead of vfat) and
loaded/booted from there.

The uEnv.txt currently in use is:

    kernel_file=zImage
    initrd_file=uInitrd

    loadzimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${kernel_file}
    loadinitrd=load mmc ${mmcdev}:${mmcpart} 0x81000000 ${initrd_file}; setenv initrd_size ${filesize}
    loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdtaddr} /dtbs/${fdtfile}

    console=ttyO0,115200n8
    mmcroot=/dev/mmcblk0p2 ro
    mmcrootfstype=ext4 rootwait fixrtc

    ##To disable HDMI/eMMC...
    optargs=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN,BB-BONE-EMMC-2G

    mmcargs=setenv bootargs console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} ${optargs}

    #zImage:
    uenvcmd=run loadzimage; run loadfdt; run mmcargs; bootz ${loadaddr} - ${fdtaddr}

I tried to figure out how to set the second partition as source for
the kernel...and failed.

Or more specifically...the variables ${mmcdev} and ${mmcpart}
seem to specify what I am searching for...but despite others
variables they seem not to be set inside uEnv.txt.

How can I setup uEnv.txt to accomplish what I am trying to do?

Thank you very much in advance for any idea/help !

Best regards,
mcc

They are set from within u-boot... first checking 0:1 (1st partition
of microSD) looking for a uEnv.txt to set userenv, if not set, it then
searches 1:1 (1st partition on eMMC)..

So if you want to search the 2nd partition of the microSD just hard
set it to "0:2" for ${mmcdev}:${mmcpart}

Regards,

Robert Nelson <robertcnelson@gmail.com> [13-09-03 19:28]:

Hi meino.

I have a guide here you may be interested in too.
http://www.embeddedhobbyist.com/debian-tips/beaglebone-black/beaglebone-black-usb-boot/

I also have a netboot guide on this site as well. I also update the kernel and the rootfs frequently, and both of these work pretty good. The USB boot guide is probably written better for understanding the basics of how everything works. But on a personal level I prefer netbooting( as I can do this from a virtual machine, or a dedicated Linux laptop ). Both are probably worth at least reading.

However, the netboot guide will not work with Angstrom, Ubuntu, or fedora, but have been tested on Debian by myself, and at least one other person. ARCH, and busybox can also work with these instructions.

William Hermans <yyrkoon@gmail.com> [13-09-03 19:40]:

Hi meino.

I have a guide here you may be interested in too.
http://www.embeddedhobbyist.com/debian-tips/beaglebone-black/beaglebone-black-usb-boot/

I also have a netboot guide on this site as well. I also update the kernel
and the rootfs frequently, and both of these work pretty good. The USB boot
guide is probably written better for understanding the basics of how
everything works. But on a personal level I prefer netbooting( as I can do
this from a virtual machine, or a dedicated Linux laptop ). Both are
probably worth at least reading.

However, the netboot guide will not work with Angstrom, Ubuntu, or fedora,
but have been tested on Debian by myself, and at least one other person.
ARCH, and busybox can also work with these instructions.

Hi Wiliam,

Thanks a lot for the link! :slight_smile:
Netboot would make it a LOT simpler to experiment with kernel variations
before copying another "ideal kernel" onto the flash card.

By the way: I am using Gentoo :slight_smile:

Best regards,
mcc

meino,

Hi, I am not sure if Gentoo will work with the netboot guide i made there or not. No one that I am aware of has tested them yet for Gentoo. If you try though I would appreciate if you would let me know if it does work. Gentoo should work with the USB boot guide though.

Robert Nelson <robertcnelson@gmail.com> [13-09-03 19:28]:

> Hi,
>
> I am using Robert Nelsons kernel and the setup of the
> sdcard/uEnv.txt/MLO/U-Boot/dtbs described here:
> http://eewiki.net/display/linuxonarm/BeagleBone+Blackhttp://eewiki.net/display/linuxonarm/BeagleBone+Black
> for the sdcard of my BBB.
>
> The sdcards first partition contains MLO, u-boot and the kernel image
> and is VFAT formatted.
>
> The second partition contains the rootfs and is ext4 formatted.
>
> Since I update the kernel image relatively often, vfat on a small
> sized partition is not optimal due to the write cycles to the flash
> chip.
>
> I would like to modify the setup that way, that kernel image and dtbs
> folder are placed in a folder in the rootfs ("big" and ext4 instead of vfat) and
> loaded/booted from there.
>
> The uEnv.txt currently in use is:
>
> kernel_file=zImage
> initrd_file=uInitrd
>
> loadzimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${kernel_file}
> loadinitrd=load mmc ${mmcdev}:${mmcpart} 0x81000000 ${initrd_file}; setenv initrd_size ${filesize}
> loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdtaddr} /dtbs/${fdtfile}
>
> console=ttyO0,115200n8
> mmcroot=/dev/mmcblk0p2 ro
> mmcrootfstype=ext4 rootwait fixrtc
>
> ##To disable HDMI/eMMC...
> optargs=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN,BB-BONE-EMMC-2G
>
> mmcargs=setenv bootargs console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} ${optargs}
>
> #zImage:
> uenvcmd=run loadzimage; run loadfdt; run mmcargs; bootz ${loadaddr} - ${fdtaddr}
>
> I tried to figure out how to set the second partition as source for
> the kernel...and failed.
>
> Or more specifically...the variables ${mmcdev} and ${mmcpart}
> seem to specify what I am searching for...but despite others
> variables they seem not to be set inside uEnv.txt.

They are set from within u-boot... first checking 0:1 (1st partition
of microSD) looking for a uEnv.txt to set userenv, if not set, it then
searches 1:1 (1st partition on eMMC)..

So if you want to search the 2nd partition of the microSD just hard
set it to "0:2" for ${mmcdev}:${mmcpart}

Regards,

--
Robert Nelson
http://www.rcn-ee.com/

Hi Robert,

I set up the uEnv.txt with 0:2 as device and partion and added /boot/
where appropiate.

The kernel "boots" and panics.
What happens is (I am using the BBB with LCD7 cape, HDMI and eMMC
disabled via uEnv.txt, I redirect the boot log output to tty1):
TUX is displayed and the boot runs til the message
"Freeing init memory 292k"
Then the log diplayed:

FATAL: cannot determine kernel version
Kernel panic - not syncing: Attempt to kill init! exit code=0x00000100

then some hexcode of exit addresses (as it seems to me) are printed
and thats it.

Unfortunately I have no idea, why a kernel, which gets booted cannot
figure out its own version (if this is the problem here...).

I build the kernel this mornin after updateing. I used defconfig
with the only change, that I added the date as local version of
the kernel. But I did this several times before the change of
uEnv.txt ... and it works fine.

What went wrong here?

Thank you very much in advance for any help!

Best regards,
mcc

I posted a summary of NFS on Gentoo to this forum on July 2nd

For what its worth, the server does not have to run a dhcp server on it for the BBB to find, and boot from a server. However, there does need to be a dhcp server on the network. Well I suppose directly connected with static IP’s could work too . . . but I have not checked that.

uEnv.txt ipaddr, serverip, and gatewayip all exist so there is no problem booting from the server.