Architectures/ARM/F18/Versatile Express

From FedoraProject

< Architectures | ARM(Difference between revisions)
Jump to: navigation, search
(Explain how to expand mmc disk.)
(Expanding the Disk Image)
 
(One intermediate revision by one user not shown)
Line 40: Line 40:
 
  Usage: ./boot-vexpress [--gui] --kernel=vmlinuz... --ramfs=initramfs --image=fsimage [--dtb=vexpress.dtb]
 
  Usage: ./boot-vexpress [--gui] --kernel=vmlinuz... --ramfs=initramfs --image=fsimage [--dtb=vexpress.dtb]
 
For serial console:
 
For serial console:
  ./boot-vexpress --kernel=vmlinuz-3.6.10-8.fc18.armv7hl --ramfs=initramfs-3.6.10-8.fc18.armv7hl.img --image=../Fedora-18-vexpress-xfce-armhfp.img
+
<pre>
 +
  ./boot-vexpress --kernel=vmlinuz-3.6.10-8.fc18.armv7hl \
 +
    --ramfs=initramfs-3.6.10-8.fc18.armv7hl.img \
 +
    --image=../Fedora-18-vexpress-xfce-armhfp.img
 +
</pre>
 
For XFCE Desktop:
 
For XFCE Desktop:
  ./boot-vexpress --kernel=vmlinuz-3.6.10-8.fc18.armv7hl --ramfs=initramfs-3.6.10-8.fc18.armv7hl.img --image=../Fedora-18-vexpress-xfce-armhfp.img --gui
+
<pre>
+
  ./boot-vexpress --kernel=vmlinuz-3.6.10-8.fc18.armv7hl \
 +
    --ramfs=initramfs-3.6.10-8.fc18.armv7hl.img \
 +
    --image=../Fedora-18-vexpress-xfce-armhfp.img \
 +
    --gui
 +
</pre>
 +
 
 
The default root password is "fedora". This should be changed immediately.
 
The default root password is "fedora". This should be changed immediately.
  
Line 62: Line 71:
 
</pre>
 
</pre>
  
* Boot into the guest and use fdisk to find the offset of the root filesystem:
+
* Boot into the guest and install the rootfs-resize application.
<pre>
+
  yum install -y rootfs-resize
$ fdisk -l /dev/mmcblk0
+
* Enable the service to start at boot
 
+
systemctl enable rootfs-resize.service
Disk /dev/mmcblk0: 14.0 GB, 13958643712 bytes, 27262976 sectors
+
* Create an empty file in the root directory named '.rootfs-repartition'
Units = sectors of 1 * 512 = 512 bytes
+
touch /.rootfs-repartition
Sector size (logical/physical): 512 bytes / 512 bytes
+
* Reboot your guest
I/O size (minimum/optimal): 512 bytes / 512 bytes
+
  reboot
Disk identifier: 0x0000b774
+
*Your system will automatically reboot again to complete the resize (this is not automatic on QEMU, and you will need to manually start the guest again).
 
+
        Device Boot      Start        End      Blocks  Id System
+
/dev/mmcblk0p1            2048      411647      204800  83  Linux
+
/dev/mmcblk0p2          411648    1435647      512000  82  Linux swap / Solaris
+
/dev/mmcblk0p3        1435648    5941247    2252800  83  Linux
+
</pre>
+
 
+
* Using the offset in bytes i.e. start block * sector size, attach the root partition to a loop device:
+
<pre>
+
$ losetup -o 735051776 /dev/loop0 ./file.img
+
</pre>
+
 
+
* Resize the filesystem to consume all empty space:
+
<pre>
+
$ e2fsck /dev/loop0
+
$ resize2fs /dev/loop0
+
</pre>
+
 
+
* Resize the partition by attaching the entire device and editing the partition table:
+
<pre>
+
$ losetup -d /dev/loop0
+
$ losetup /dev/loop0 ./file.img
+
$ fdisk /dev/loop0
+
Welcome to fdisk (util-linux 2.21.2).
+
 
+
Changes will remain in memory only, until you decide to write them.
+
Be careful before using the write command.
+
 
+
Command (m for help): p
+
 
+
Disk /dev/loop0: 14.0 GB, 13958643712 bytes
+
255 heads, 63 sectors/track, 1697 cylinders, total 27262976 sectors
+
Units = sectors of 1 * 512 = 512 bytes
+
Sector size (logical/physical): 512 bytes / 512 bytes
+
I/O size (minimum/optimal): 512 bytes / 512 bytes
+
Disk identifier: 0x0000b774
+
 
+
      Device Boot      Start        End      Blocks  Id System
+
/dev/loop0p1            2048      411647      204800  83  Linux
+
/dev/loop0p2          411648    1435647      512000  82  Linux swap / Solaris
+
/dev/loop0p3        1435648    5941247    2252800  83  Linux
+
 
+
Command (m for help): d
+
Partition number (1-4): 3
+
Partition 3 is deleted
+
 
+
Command (m for help): n
+
Partition type:
+
  p  primary (2 primary, 0 extended, 2 free)
+
  e  extended
+
Select (default p): p
+
Partition number (1-4, default 3): 3
+
First sector (1435648-27262975, default 1435648):
+
Using default value 1435648
+
Last sector, +sectors or +size{K,M,G} (1435648-27262975, default 27262975):
+
Using default value 27262975
+
Partition 3 of type Linux and of size 12.3 GiB is set
+
Command (m for help): p
+
 
+
Disk /dev/loop0: 14.0 GB, 13958643712 bytes
+
255 heads, 63 sectors/track, 1697 cylinders, total 27262976 sectors
+
Units = sectors of 1 * 512 = 512 bytes
+
Sector size (logical/physical): 512 bytes / 512 bytes
+
I/O size (minimum/optimal): 512 bytes / 512 bytes
+
Disk identifier: 0x0000b774
+
 
+
      Device Boot      Start        End      Blocks  Id  System
+
/dev/loop0p1            2048      411647      204800  83  Linux
+
/dev/loop0p2          411648    1435647      512000  82  Linux swap / Solaris
+
/dev/loop0p3        1435648    27262975    12913664  83  Linux
+
 
+
Command (m for help): w
+
The partition table has been altered!
+
 
+
Calling ioctl() to re-read partition table.
+
 
+
WARNING: Re-reading the partition table failed with error 22: Invalid argument.
+
The kernel still uses the old table. The new table will be used at
+
the next reboot or after you run partprobe(8) or kpartx(8)
+
Syncing disks.
+
$ partprobe /dev/loop0
+
$ losetup -d /dev/loop0
+
</pre>
+
 
+
* Boot into the guest and verify that everything boots and mounts OK. You should see:
+
<pre>
+
...
+
[    8.171246] mmc0: SD Status: Invalid Allocation Unit size.
+
[    8.171638] mmc0: host does not support reading read-only switch. assuming write-enable.
+
[    8.181745] mmc0: new SDHC card at address 4567
+
[    8.905362] mmcblk0: mmc0:4567 QEMU! 13.0 GiB
+
[    8.931486]  mmcblk0: p1 p2 p3
+
...
+
[  10.255200] EXT4-fs (mmcblk0p3): mounted filesystem with ordered data mode. Opts: (null)
+
[  11.374115] EXT4-fs (mmcblk0p3): mounted filesystem with ordered data mode. Opts: (null)
+
...
+
</pre>
+
  
 
==Release Notes==
 
==Release Notes==

Latest revision as of 19:06, 11 February 2013

A screen shot of Fedora 18 for ARM on QEMU .

Contents

[edit] Versatile Express

The Versatile Express family of development platforms provides users with a modular board design for use testing different ARM SOC design implementations. QEMU provides the ability to emulate ARM Versatile Express for Cortex-A9 on your desktop computer for easy experimentation!

[edit] Technical Specifications

  • ARM Versatile Express for Cortex-A9
  • 1GB RAM
  • 10/100Mbit/s Ethernet

For more information on Versatile Express or QEMU visit their websites.

[edit] Running Fedora through QEMU

This page will give you detailed instructions for running Fedora 18 through QEMU. The tarball includes all that is needed to boot your system including the root filesystem image and the pre-extracted kernel and initramfs. Also, included for your convenience is a script to boot using a serial connection or the XFCE desktop. WARNING: If you will be doing development with this image then it is recommended that you add 10-15GB to the root partition before booting.

[edit] Download the image

There are two Versatile Express images available for use with QEMU, a hardware floating point (armhfp), and a software floating point(arm). If you are unsure of which to choose, the hard floating point image is recommended, and will be used in the provided examples below (adjust accordingly for 'arm'):

Download and verify the checksum:

wget http://dl.fedoraproject.org/pub/fedora-secondary/releases/18/Images/armhfp/Fedora-18-armhfp-Images-CHECKSUM
sha256sum --check Fedora-18-armhfp-Images-CHECKSUM

[edit] Preparing the Image

[edit] Linux Users

Extract the tarball using the graphical user interface or the following commandline option:

tar xvJf Fedora-18-vexpress-xfce-armhfp.tar.xz

[edit] Windows Users

QEMU is also available on Windows but is not yet covered in this guide. For more information on running QEMU on Windows please visit their website.

[edit] Using Fedora through QEMU

First you will need to install the ARM QEMU package (this example is using Fedora)

yum install qemu-system-arm

Once installed, change to the boot directory of the extracted kernel package:

cd Fedora-18-vexpress-xfce-armhfp/boot/

From there execute the provided script, choosing to boot with or without a graphical interface.

./boot-vexpress -h
Usage: ./boot-vexpress [--gui] --kernel=vmlinuz... --ramfs=initramfs --image=fsimage [--dtb=vexpress.dtb]

For serial console:

 ./boot-vexpress --kernel=vmlinuz-3.6.10-8.fc18.armv7hl \
    --ramfs=initramfs-3.6.10-8.fc18.armv7hl.img \
    --image=../Fedora-18-vexpress-xfce-armhfp.img

For XFCE Desktop:

 ./boot-vexpress --kernel=vmlinuz-3.6.10-8.fc18.armv7hl \
    --ramfs=initramfs-3.6.10-8.fc18.armv7hl.img \
    --image=../Fedora-18-vexpress-xfce-armhfp.img \
    --gui

The default root password is "fedora". This should be changed immediately.

[edit] Expanding the Disk Image

You can easily expand the root partition of the disk image using qemu-img.

For example to increase the image size by 10GB you can issue:

 qemu-img resize ./file.img +10G

Doing this before booting the image will cause the filesystem to be automatically resized.

If you have already booted the system then you will need to do the following:

  • Enlarge the disk as before:
qemu-img resize ./file.img +10G
  • Boot into the guest and install the rootfs-resize application.
yum install -y rootfs-resize
  • Enable the service to start at boot
systemctl enable rootfs-resize.service
  • Create an empty file in the root directory named '.rootfs-repartition'
touch /.rootfs-repartition
  • Reboot your guest
reboot
  • Your system will automatically reboot again to complete the resize (this is not automatic on QEMU, and you will need to manually start the guest again).

[edit] Release Notes

  • Images were composed using tools in Fedora 17 due to continuing work on Fedora 18.
  • When upgrading to the 3.7.X kernel you will require a device tree binary (.dtb) file for the system to boot. The provided 'boot-vexpress' script allows for the optional use of a 'dtb' file and will give a warning when booting kernels above 3.6.x.
    • The XFCE Desktop is not currently available when using the 3.7.x kernel.

[edit] Additional Support

There are Fedora ARM users all around the globe - if you need assistance, would like to provide feedback or contribute to Fedora ARM please visit us on the IRC - we can be found in #fedora-arm on Freenode. You can also contact us on the mailing list - arm@lists.fedoraproject.org