From Fedora Project Wiki

Livemedia-modifier

Introduction

Some disk images created with 'livemedia-creator' will require some additonal tweaks prior to being used with some devices - including Vexpress(QEMU) and some versions of U-Boot that ship with Kirkwood devices. With newer devices coming to the market every day, some users require only a root filesystem to be used with a custom kernel not provided by Fedora. For these reasons the 'livemedia-modifier' tool was created allowing the process to be automated.

Note: Please force-refresh this page before downloading as it caches very easily
The tool can be downloaded in an RPM package from:

wget http://fossjon.fedorapeople.org/review/livemedia-modifier/livemedia-modifier-2.4-1.fc18.noarch.rpm


Usage:

livemedia-modifier -h
livemedia-modifier [-h, --help] [-v, --version]
                   --image=IMAGE_NAME
                   --platform=PLATFORM
                   --nocompress

Modify a livemedia-creator image for specific platform requirements.
  -h, --help            Show this help message and exit.
  -v, --version         Display the current version number and last modification date.
  --image=IMAGE_NAME    Name of disk image to modify.
  --platform=PLATFORM   Platform to target {generic,kirkwood,omap,vexpress}.
  --nocompress          Modify the image without any final archival or compression (for vexpress).

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.

Creating the disk image

You will first need to create the Vexpress 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.

Using 'livemedia-modifier' with QEMU images

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

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' with Kirkwood images

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.

Copying to your media

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 device and boot.

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.

User Info

Fossjon