Architectures/ARM/livemedia-modifier

From FedoraProject

< Architectures | ARM
Revision as of 21:07, 14 January 2013 by Pwhalen (Talk | contribs)

Jump to: navigation, search

Contents

Livemedia-modifier

Introduction

Disk images created with 'livemedia-creator' require some additonal tweaks prior to being used with some devices - including the Pandaboard, Vexpress(QEMU) and some versions of U-Boot that ship with Kirkwood devices. With newer devices coming to the market every day, some users also require only a root filesystem that to be used with a Curstom kernel not provided by Fedora. For these reasons the 'livemedia-modifier' was created, automating the process for all.

As of Fedora 17 all disk images can be produced using Fedora tools. Disk images created for the Pandaboard require an additional step before use due to the unique paritioning requirements, and the nessecity of the 'MLO' being the first file written to the 'boot' partition. Vesatile express also requires the user extract the kernel, initramfs and kermodules in order to boot the disk image. The 'livemedia-modifier' tool was written to augment the output of 'livemedia-creator', and prepare the disk images for use.

Pandaboard

Images can be created for the Pandaboard using 'livemedia-creator', these images will not be bootable until they have been 'fixed'. The script will mount the disk image partitions, reformat the boot partition, and copy the files from the root filesystem in the correct order with the MLO file being the first file copied to the media. This will result in a bootable Pandaboard disk image.

You will first need to create the Pandaboard disk image using 'livemedia-creator'

livemedia-creator  --make-disk 
                   --no-virt --image-only 
                   --keep-image --armplatform=omap 
                   --ks=<location-of-kickstart>

The disk image produced will be available in '/var/tmp/disk<random>.img'. This image will not yet be bootable and will require one additional step as follows:

livemedia-modifier --image=<location-of-file.img> --platform=omap

Below is example out for an omap disk:

[root@thinkpad Desktop]# ./livemedia-modifier --image=2012-09-18-f18-panda-deploy.img --platform=omap
Mount :: [/dev/mapper/loop0p3] -> [/mnt/root]
Mount :: [/dev/mapper/loop0p1] -> [/mnt/boot]
Mkdir :: [/mnt/root/boot]
Mkdir :: [/mnt/root/boot/uboot]
Move :: [/mnt/boot/grub] -> [/mnt/root/boot/grub]
Move :: [/mnt/boot/uImage] -> [/mnt/root/boot/uImage]
Move :: [/mnt/boot/klist.txt] -> [/mnt/root/boot/klist.txt]
Move :: [/mnt/boot/boot.scr] -> [/mnt/root/boot/boot.scr]
Move :: [/mnt/boot/initramfs-3.6.0-0.rc4.git0.1.fc18.armv7hl.omap.img] -> [/mnt/root/boot/initramfs-3.6.0-0.rc4.git0.1.fc18.armv7hl.omap.img]
Move :: [/mnt/boot/.vmlinuz-3.6.0-0.rc4.git0.1.fc18.armv7hl.omap.hmac] -> [/mnt/root/boot/.vmlinuz-3.6.0-0.rc4.git0.1.fc18.armv7hl.omap.hmac]
Move :: [/mnt/boot/System.map-3.6.0-0.rc4.git0.1.fc18.armv7hl.omap] -> [/mnt/root/boot/System.map-3.6.0-0.rc4.git0.1.fc18.armv7hl.omap]
Move :: [/mnt/boot/config-3.6.0-0.rc4.git0.1.fc18.armv7hl.omap] -> [/mnt/root/boot/config-3.6.0-0.rc4.git0.1.fc18.armv7hl.omap]
Move :: [/mnt/boot/vmlinuz-3.6.0-0.rc4.git0.1.fc18.armv7hl.omap] -> [/mnt/root/boot/vmlinuz-3.6.0-0.rc4.git0.1.fc18.armv7hl.omap]
Move :: [/mnt/boot/uImage-3.6.0-0.rc4.git0.1.fc18.armv7hl.omap] -> [/mnt/root/boot/uImage-3.6.0-0.rc4.git0.1.fc18.armv7hl.omap]
Move :: [/mnt/boot/uInitrd-3.6.0-0.rc4.git0.1.fc18.armv7hl.omap] -> [/mnt/root/boot/uInitrd- 3.6.0-0.rc4.git0.1.fc18.armv7hl.omap]
Move :: [/mnt/boot/uInitrd] -> [/mnt/root/boot/uInitrd]
Move :: [/mnt/boot/initrd-plymouth.img] -> [/mnt/root/boot/initrd-plymouth.img]
Move :: [/mnt/boot/uEnv.txt] -> [/mnt/root/boot/uEnv.txt]
Mkfs :: /dev/mapper/loop0p1
mkfs.vfat 3.0.12 (29 Oct 2011)
unable to get drive geometry, using default 255/63
Copy :: [/mnt/root/usr/share/uboot-panda/MLO] -> [/mnt/boot/MLO]
Copy :: [/mnt/root/usr/share/uboot-panda/u-boot.img] -> [/mnt/boot/u-boot.img]
Copy :: [/mnt/root/usr/share/uboot-panda/u-boot.bin] -> [/mnt/boot/u-boot.bin]
Copy :: [/mnt/root/boot/uInitrd-3.6.0-0.rc4.git0.1.fc18.armv7hl.omap] -> [/mnt/boot/uInitrd-3.6.0-0.rc4.git0.1.fc18.armv7hl.omap]
Copy :: [/mnt/root/boot/boot.scr] -> [/mnt/boot/boot.scr]
Copy :: [/mnt/root/boot/klist.txt] -> [/mnt/boot/klist.txt]
Copy :: [/mnt/root/boot/uInitrd] -> [/mnt/boot/uInitrd]
Copy :: [/mnt/root/boot/uImage] -> [/mnt/boot/uImage]
Copy :: [/mnt/root/boot/uImage-3.6.0-0.rc4.git0.1.fc18.armv7hl.omap] -> [/mnt/boot/uImage- 3.6.0-0.rc4.git0.1.fc18.armv7hl.omap]
Copy :: [/mnt/root/boot/uEnv.txt] -> [/mnt/boot/uEnv.txt]
Wrote :: [/mnt/root/etc/fstab] <- [0C5E-28BB]
Wrote :: [/mnt/root/etc/sysconfig/uboot]
loop deleted : /dev/loop0
Modification completed successfully!
[root@thinkpad Desktop]# 


Once this has completed you are now ready to copy the image to SD card.

dd if=<image-location>.img of=/dev/<location-of-sd> 

Insert into your Pandaboard and boot.

Versatile Express

The disk image produced by 'livemedia-creator' for Versatile Express (vexpress) emulation using QEMU, will require an additional step before use. In order to boot the image you will need to extract the kernel, initramfs and kernel modules. This can be done manually or with use of the provided modifier tool. You will first need to create the Pandaboard disk image using 'livemedia-creator'

livemedia-creator  --make-disk 
                   --no-virt --image-only 
                   --keep-image --armplatform=vexpress 
                   --ks=<location-of-kickstart>

The disk image will be available in '/var/tmp/disk<random>.img'. This image will not yet be bootable and will require one additional step as follows(to be run as root):

livemedia-modifier --image=<location-of-file.img> --platform=vexpress

Below is an exampe of its output:

./livemedia-modifier --image=2012-09-17-vexpress.img --platform=vexpress
Mount :: [/dev/mapper/loop0p3] -> [/mnt/root]
Mount :: [/dev/mapper/loop0p1] -> [/mnt/boot]
Mkdir :: [/mnt/root/boot]
Mkdir :: [/mnt/root/boot/uboot]
Move :: [/mnt/boot/System.map-3.4.6-2.0.arm1.fc17.armv7hl] -> [/mnt/root/boot/System.map-3.4.6-2.0.arm1.fc17.armv7hl]
Move :: [/mnt/boot/initramfs-3.4.6-2.0.arm1.fc17.armv7hl.img] -> [/mnt/root/boot/initramfs-3.4.6-2.0.arm1.fc17.armv7hl.img]
Move :: [/mnt/boot/klist.txt] -> [/mnt/root/boot/klist.txt]
Move :: [/mnt/boot/uImage] -> [/mnt/root/boot/uImage]
Move :: [/mnt/boot/uImage-3.4.6-2.0.arm1.fc17.armv7hl] -> [/mnt/root/boot/uImage-3.4.6-2.0.arm1.fc17.armv7hl]
Move :: [/mnt/boot/uInitrd-3.4.6-2.0.arm1.fc17.armv7hl] -> [/mnt/root/boot/uInitrd-3.4.6-2.0.arm1.fc17.armv7hl]
Move :: [/mnt/boot/grub2] -> [/mnt/root/boot/grub2]
Move :: [/mnt/boot/.vmlinuz-3.4.6-2.0.arm1.fc17.armv7hl.hmac] -> [/mnt/root/boot/.vmlinuz-3.4.6-2.0.arm1.fc17.armv7hl.hmac]
Move :: [/mnt/boot/grub] -> [/mnt/root/boot/grub]
Move :: [/mnt/boot/vmlinuz-3.4.6-2.0.arm1.fc17.armv7hl] -> [/mnt/root/boot/vmlinuz-3.4.6-2.0.arm1.fc17.armv7hl]
Move :: [/mnt/boot/uInitrd] -> [/mnt/root/boot/uInitrd]
Move :: [/mnt/boot/boot.scr] -> [/mnt/root/boot/boot.scr]
Move :: [/mnt/boot/config-3.4.6-2.0.arm1.fc17.armv7hl] -> [/mnt/root/boot/config-3.4.6-2.0.arm1.fc17.armv7hl]
Move :: [/mnt/boot/lost+found] -> [/mnt/root/boot/lost+found]
Mkfs :: /dev/mapper/loop0p1
mkfs.vfat 3.0.12 (29 Oct 2011)
unable to get drive geometry, using default 255/63
Copy :: [/mnt/root/boot/uInitrd-3.4.6-2.0.arm1.fc17.armv7hl] -> [/mnt/boot/uInitrd-3.4.6-2.0.arm1.fc17.armv7hl]
Copy :: [/mnt/root/boot/uImage] -> [/mnt/boot/uImage]
Copy :: [/mnt/root/boot/klist.txt] -> [/mnt/boot/klist.txt]
Copy :: [/mnt/root/boot/uImage-3.4.6-2.0.arm1.fc17.armv7hl] -> [/mnt/boot/uImage-3.4.6-2.0.arm1.fc17.armv7hl]
Copy :: [/mnt/root/boot/boot.scr] -> [/mnt/boot/boot.scr]
Copy :: [/mnt/root/boot/uInitrd] -> [/mnt/boot/uInitrd]
Wrote :: [/mnt/root/etc/fstab] <- [D2FE-1440]
Wrote :: [/mnt/root/etc/sysconfig/uboot]
vexpress-Mkdir :: [./arm-vexpress-mmcblk0]
vexpress-Copy :: [/mnt/root/boot] -> [./arm-vexpress-mmcblk0/boot]
vexpress-Copy :: [/mnt/root/lib/modules] -> [./arm-vexpress-mmcblk0/lib/modules]
vexpress-Wrote :: [./arm-vexpress-mmcblk0/boot/boot-vexpress]
vexpress-Wrote :: [./arm-vexpress-mmcblk0/boot/boot-vexpress+x]
vexpress-Tar :: [./arm-vexpress-mmcblk0]
loop deleted : /dev/loop0
Modification completed successfully!
[root@thinkpad Desktop]#

The 'livemedia-modifier' will create a tarball of the files needed to boot including two scripts that can be used to boot using XFCE or command line.

Using vexpress

Once the tarball has completed you can extract the image by using:

 tar xvJf <name-of-tarball>.tar.xz

Then switch to the directory containing the boot scripts.

 cd <name-of-directory>/boot/

Choose the appropriate boot option, with or with the use of a graphical user interface (your kernel, initramfs and image version may be different).

 ./boot-vexpress vmlinuz-3.6.10-6.fc18.armv7hl initramfs-3.6.10-6.fc18.armv7hl.img ../Fedora-18-Beta-vexpress-armhfp.img

Extracting the kernel and initramfs

When you upgrade the kernel on vexpress, you will then need to extract the kernel and initramfs from the disk image for use during subsequent boots. The livemedia-modifier script automates this process, and with the appropriate option will not create a tarball, but only extract the needed bits for booting:

Kirkwood

The Kirkwood image includes a disk image with a EXT3 boot partition. Some versions of U-Boot do not support booting from this file system and will therefore need to be reformatted to VFAT (FAT32). The Livemedia-modifier tool will automate this process for you, extracting the files from the 'boot' partition, reformatting, then replacing the files for use in your Kirkwood device.
Using livemedia-modifier:

livemedia-modifier --image=<location-of-extracted-disk-image>.img --platform=kirkwood

An example of the output:

livemedia-modifier --image=Fedora-18-Beta-kirkwood-arm.img --platform=kirkwood
Mkdir :: [/mnt && /mnt/root]
Mount :: [/dev/mapper/loop0p3] -> [/mnt/root]
Mkdir :: [/mnt && /mnt/boot]
Mount :: [/dev/mapper/loop0p1] -> [/mnt/boot]
Mkdir :: [/mnt/root/boot && /mnt/root/boot/uboot]
Move :: [/mnt/boot/lost+found] -> [/mnt/root/boot/lost+found]
Move :: [/mnt/boot/uInitrd-3.6.10-6.fc18.armv5tel.kirkwood] -> [/mnt/root/boot/uInitrd-3.6.10-6.fc18.armv5tel.kirkwood]
Move :: [/mnt/boot/initramfs-3.6.10-6.fc18.armv5tel.kirkwood.img] -> [/mnt/root/boot/initramfs-3.6.10-6.fc18.armv5tel.kirkwood.img]
Move :: [/mnt/boot/vmlinuz-3.6.10-6.fc18.armv5tel.kirkwood] -> [/mnt/root/boot/vmlinuz-3.6.10-6.fc18.armv5tel.kirkwood]
Move :: [/mnt/boot/klist.txt] -> [/mnt/root/boot/klist.txt]
Move :: [/mnt/boot/uInitrd] -> [/mnt/root/boot/uInitrd]
Move :: [/mnt/boot/uImage-3.6.10-6.fc18.armv5tel.kirkwood] -> [/mnt/root/boot/uImage-3.6.10-6.fc18.armv5tel.kirkwood]
Move :: [/mnt/boot/initrd-plymouth.img] -> [/mnt/root/boot/initrd-plymouth.img]
Move :: [/mnt/boot/boot.scr.mmc] -> [/mnt/root/boot/boot.scr.mmc]
Move :: [/mnt/boot/uImage] -> [/mnt/root/boot/uImage]
Move :: [/mnt/boot/config-3.6.10-6.fc18.armv5tel.kirkwood] -> [/mnt/root/boot/config-3.6.10-6.fc18.armv5tel.kirkwood]
Move :: [/mnt/boot/.vmlinuz-3.6.10-6.fc18.armv5tel.kirkwood.hmac] -> [/mnt/root/boot/.vmlinuz-3.6.10-6.fc18.armv5tel.kirkwood.hmac]
Move :: [/mnt/boot/boot.cmd.mmc] -> [/mnt/root/boot/boot.cmd.mmc]
Move :: [/mnt/boot/boot.cmd.usb] -> [/mnt/root/boot/boot.cmd.usb]
Move :: [/mnt/boot/boot.scr.usb] -> [/mnt/root/boot/boot.scr.usb]
Move :: [/mnt/boot/boot.scr] -> [/mnt/root/boot/boot.scr]
Move :: [/mnt/boot/System.map-3.6.10-6.fc18.armv5tel.kirkwood] -> [/mnt/root/boot/System.map-3.6.10-6.fc18.armv5tel.kirkwood]
Move :: [/mnt/boot/grub2] -> [/mnt/root/boot/grub2]
Fdisk :: [Fedora-18-Beta-kirkwood-arm.img] Fedora-18-Beta-kirkwood-arm.img1 : start=     2048, size=   409600, Id= c
Mkfs :: /dev/mapper/loop0p1
mkfs.vfat 3.0.12 (29 Oct 2011)
unable to get drive geometry, using default 255/63
Sync :: [/dev/mapper/loop0p1]
Copy :: [/mnt/root/boot/boot.scr.mmc] -> [/mnt/boot/boot.scr.mmc]
Copy :: [/mnt/root/boot/boot.cmd.mmc] -> [/mnt/boot/boot.cmd.mmc]
Copy :: [/mnt/root/boot/boot.scr.usb] -> [/mnt/boot/boot.scr.usb]
Copy :: [/mnt/root/boot/uImage] -> [/mnt/boot/uImage]
Copy :: [/mnt/root/boot/uInitrd-3.6.10-6.fc18.armv5tel.kirkwood] -> [/mnt/boot/uInitrd-3.6.10-6.fc18.armv5tel.kirkwood]
Copy :: [/mnt/root/boot/uImage-3.6.10-6.fc18.armv5tel.kirkwood] -> [/mnt/boot/uImage-3.6.10-6.fc18.armv5tel.kirkwood]
Copy :: [/mnt/root/boot/boot.scr] -> [/mnt/boot/boot.scr]
Copy :: [/mnt/root/boot/klist.txt] -> [/mnt/boot/klist.txt]
Copy :: [/mnt/root/boot/uInitrd] -> [/mnt/boot/uInitrd]
Copy :: [/mnt/root/boot/boot.cmd.usb] -> [/mnt/boot/boot.cmd.usb]
Write :: [/mnt/root/etc/fstab] <- [1574-11FD]
Write :: [/mnt/root/etc/sysconfig/uboot]
loop deleted : /dev/loop0

Modification completed successfully!

The image has now been modified and includes '/boot' on a VFAT partition.

Root Filesystem Only

With the livemedia-modifier tool it is also possible to extract the root filesystem from a disk image, allowing uers to supply their own kernel. The tool will mount the disk image, remove the modules directory and create a tarball of the root filesystem. Below is an example of using livemedia-modifier.

livemedia-modifier --image=<path-to-disk-image>.img --platform=generic

Output using using the vexpress disk image, however the modifier can be used with all Fedora disk images - including hfp and sfp.

livemedia-modifier --image=Fedora-18-Beta-vexpress-armhfp.img --platform=generic
Mkdir :: [/mnt && /mnt/root]
Mount :: [/dev/mapper/loop0p3] -> [/mnt/root]
Mkdir :: [/mnt && /mnt/boot]
Mount :: [/dev/mapper/loop0p1] -> [/mnt/boot]
generic-Copy :: [/mnt/root] -> [./Fedora-18-Beta-vexpress-armhfp-rootfs]
generic-Remove :: [./Fedora-18-Beta-vexpress-armhfp-rootfs/lib/modules/3.6.11-3.fc18.armv7hl]
generic-Remove :: [./Fedora-18-Beta-vexpress-armhfp-rootfs/lib/modules/3.6.10-6.fc18.armv7hl]
loop deleted : /dev/loop0
generic-Mkdir :: [./Fedora-18-Beta-vexpress-armhfp-rootfs]
generic-Tar :: [Fedora-18-Beta-vexpress-armhfp-rootfs.tar.xz] <- [./Fedora-18-Beta-vexpress-armhfp-rootfs]
generic-Remove :: [./Fedora-18-Beta-vexpress-armhfp-rootfs]

Modification completed successfully!

The resulting tarball will contain a root filesystem only and can be used with a user created kernel or those provided by Fedora.