Sunday, January 1, 2012

Fedora 14 ARM on Pandaboard, part 2

From my previous entry, you'll have already created a bootable SD card.  Yeah, it doesn't boot much and ends with a kernel panic, but that's just what we need so far to get Fedora 14 on the Pandaboard.

Install a different u-boot.bin

Unfortunately the u-boot.bin on the validation image doesn't read boot.scr (autoboot script) and the settings are hard-coded.  In order to get a more flexible u-boot.bin, we'll borrow from Jon Master's previous Fedora 13 Pandaboard image.  Download the fedora_arm_image_pandaboard-uboot-20110622-0.tar.xz file, extract u-boot.bin, and copy it to the uboot filesystem:


# tar -x uboot/u-boot.bin -f fedora_arm_image_pandaboard-uboot-20110622-0.tar.xz
# ls uboot
u-boot.bin
# mount /dev/sde1 /mnt/tmp
# cp uboot/u-boot.bin /mnt/tmp/
cp: overwrite `/mnt/tmp/u-boot.bin'? y
# umount /mnt/tmp


Download Fedora 14 ARM image and install the root filesystem


Go ahead and download the F14 ARM RC1 minimal image previously referenced.

Insert the SD card and wait until the card is recognized.  Then create the physical volume, volume group, logical volume, root filesystem, and install the files to the root filesystem.

# pvcreate /dev/sde2
  Writing physical volume data to disk "/dev/sde2"
  Physical volume "/dev/sde2" successfully created
# vgcreate panda /dev/sde2
  Volume group "panda" successfully created
# lvcreate -L 2G -n root panda
  Logical volume "root" created
# mkfs -t ext4 -L rootfs /dev/mapper/panda-root
mke2fs 1.41.14 (22-Dec-2010)
Filesystem label=rootfs
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
131072 inodes, 524288 blocks
26214 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=536870912
16 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912

Writing inode tables: done                           
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
# mount /dev/mapper/panda-root /mnt/tmp
# tar -xf rootfs-f14-minimal-RC1.tar.bz2 -C /mnt/tmp
One thing that I haven't mentioned is that the minimal image doesn't contain lvm2, which we're going to need.  Go ahead and install that (and its dependencies) now:

# rpm -ivh --ignorearch --root=/mnt/tmp http://dl.fedoraproject.org/pub/fedora-secondary/releases/14/Everything/arm/os/Packages/lvm2-2.02.73-3.fc14.armv5tel.rpm http://dl.fedoraproject.org/pub/fedora-secondary/releases/14/Everything/arm/os/Packages/lvm2-libs-2.02.73-3.fc14.armv5tel.rpm http://dl.fedoraproject.org/pub/fedora-secondary/releases/14/Everything/arm/os/Packages/device-mapper-1.02.54-3.fc14.armv5tel.rpm http://dl.fedoraproject.org/pub/fedora-secondary/releases/14/Everything/arm/os/Packages/device-mapper-event-1.02.54-3.fc14.armv5tel.rpm http://dl.fedoraproject.org/pub/fedora-secondary/releases/14/Everything/arm/os/Packages/device-mapper-event-libs-1.02.54-3.fc14.armv5tel.rpm http://dl.fedoraproject.org/pub/fedora-secondary/releases/14/Everything/arm/os/Packages/device-mapper-libs-1.02.54-3.fc14.armv5tel.rpm
Retrieving http://dl.fedoraproject.org/pub/fedora-secondary/releases/14/Everything/arm/os/Packages/lvm2-2.02.73-3.fc14.armv5tel.rpm
Retrieving http://dl.fedoraproject.org/pub/fedora-secondary/releases/14/Everything/arm/os/Packages/lvm2-libs-2.02.73-3.fc14.armv5tel.rpm
Retrieving http://dl.fedoraproject.org/pub/fedora-secondary/releases/14/Everything/arm/os/Packages/device-mapper-1.02.54-3.fc14.armv5tel.rpm
Retrieving http://dl.fedoraproject.org/pub/fedora-secondary/releases/14/Everything/arm/os/Packages/device-mapper-event-1.02.54-3.fc14.armv5tel.rpm
Retrieving http://dl.fedoraproject.org/pub/fedora-secondary/releases/14/Everything/arm/os/Packages/device-mapper-event-libs-1.02.54-3.fc14.armv5tel.rpm
Retrieving http://dl.fedoraproject.org/pub/fedora-secondary/releases/14/Everything/arm/os/Packages/device-mapper-libs-1.02.54-3.fc14.armv5tel.rpm
Preparing...                ########################################### [100%]
   1:device-mapper-libs     ########################################### [ 17%]
warning: %post(device-mapper-libs-1.02.54-3.fc14.armv5tel) scriptlet failed, exit status 127
   2:device-mapper          ########################################### [ 33%]
   3:device-mapper-event-lib########################################### [ 50%]
warning: %post(device-mapper-event-libs-1.02.54-3.fc14.armv5tel) scriptlet failed, exit status 127
   4:device-mapper-event    ########################################### [ 67%]
   5:lvm2-libs              ########################################### [ 83%]
warning: %post(lvm2-libs-2.02.73-3.fc14.armv5tel) scriptlet failed, exit status 127
   6:lvm2                   ########################################### [100%]
warning: %post(lvm2-2.02.73-3.fc14.armv5tel) scriptlet failed, exit status 127
#


You can ignore the %post errors as %post is simply trying to run ldconfig to update the dynamic linker/loader cache or chkconfig to enable a service.

Now there is still one problem with getting LVM to work:  The generated initramfs files have no LVM support.   This is a huge problem (the system will not be able to detect the root filesystem which is on a logical volume).  It's also a huge pain to fix it as dracut did not generate a bootable image when I tried to update the initramfs on my host system.  Because of that, I've made it easy on you - here is an initramfs with LVM support included.  Let's install that:

# cp initramfs-2.6.40.3-0.fc14.armv7l.omap.img /mnt/tmp/boot/
cp: overwrite `/mnt/tmp/boot/initramfs-2.6.40.3-0.fc14.armv7l.omap.img'? y
#


The next thing we'll need to do is update the boot files stored in the uboot filesystem (mkimage is in the uboot-tools package if it's not installed on your system).
# mkdir /mnt/tmp/boot/uboot
# mount /dev/sde1 /mnt/tmp/boot/uboot
# mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n 2.6.40.3.fc14.armv7l.omap -d /mnt/tmp/boot/vmlinuz-2.6.40.3-0.fc14.armv7l.omap /mnt/tmp/boot/uboot/uImage
Image Name:   2.6.40.3.fc14.armv7l.omap
Created:      Fri Dec 30 16:44:41 2011
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    3919956 Bytes = 3828.08 kB = 3.74 MB
Load Address: 80008000
Entry Point:  80008000
# mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d /mnt/tmp/boot/initramfs-2.6.40.3-0.fc14.armv7l.omap.img /mnt/tmp/boot/uboot/uInitrd
Image Name:   initramfs
Created:      Fri Dec 30 16:46:50 2011
Image Type:   ARM Linux RAMDisk Image (uncompressed)
Data Size:    8043128 Bytes = 7854.62 kB = 7.67 MB
Load Address: 00000000
Entry Point:  00000000
#
In order to boot, we'll need to also create a boot script and compile it.

# echo "setenv bootargs 'console=ttyO2,115200n8 ro rootwait root=/dev/mapper/panda-root init=/sbin/init earlyprintk rd_NO_PLYMOUTH'" > /mnt/tmp/boot/uboot/boot.cmd
# echo "setenv bootcmd 'mmc init; fatload mmc 0:1 0x80300000 uImage; fatload mmc 0:1 81600000 uInitrd; bootm 80300000 81600000'" >> /mnt/tmp/boot/uboot/boot.cmd
# echo "boot" >> /mnt/tmp/boot/uboot/boot.cmd
# mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Pandaboard boot script" -d /mnt/tmp/boot/uboot/boot.cmd /mnt/tmp/boot/uboot/boot.scr
Image Name:   Pandaboard boot script
Created:      Fri Dec 30 16:49:18 2011
Image Type:   ARM Linux Script (uncompressed)
Data Size:    257 Bytes = 0.25 kB = 0.00 MB
Load Address: 00000000
Entry Point:  00000000
Contents:
   Image 0: 249 Bytes = 0.24 kB = 0.00 MB
#
Create the klist.txt file that contains the list of installed kernels.  This is actually not needed in this case since there is no xpfa repository with an updated grubby that can use it.  I'm just doing it for completeness.

# echo "2.6.40.3.fc14.armv7l.omap" > /mnt/tmp/boot/uboot/klist.txt
#

This should be all that's required.  Let's unmount these filesystems, deactivate the volume group, eject the media, and try booting on the Pandaboard.



# umount /mnt/tmp/boot/uboot /mnt/tmp
# vgchange -an panda
  0 logical volume(s) in volume group "panda" now active
# eject /dev/sde
#

If all has gone well, you're now sitting at the login prompt.  The root password is "fedoraarm".

Next post will be dedicated to a few cleanup items.

No comments:

Post a Comment