第7章 Kernel and Userland Placement

On the Armadillo-400 Series, by default the kernel and userland images are stored in flash memory and loaded to RAM by the bootloader before the kernel is booted.

It is also possible to have the kernel and userland images loaded from places other than flash memory on the Armadillo-400 Series.

This chapter explains how to load images from other places as well as the boot options required to do so.

7.1. Loading From A TFTP Server

The tftpboot function of the Hermit-At bootloader can download kernel and userland image files from a TFTP server, load the images to RAM and then boot them.

As images are booted without first writing them to flash memory, the tftpboot function can help development efficiency during stages when the images are updated regularly.

7.1.1. File Placement

Place the kernel and userland images in the root directory of the TFTP server.

[ティップ]

A TFTP server (atftpd) is started by default on ATDE v3.0 and later. Files placed in the /var/lib/tftpboot/ directory will be accessible via TFTP.

7.1.2. Boot Options

Set the jumpers on the target Armadillo appropriately for maintenance mode and power on the board.

Using the serial console software on the work PC, enter the following command[14].

hermit> setbootdevice tftp [Armadillo IP adress] [tftp server IP adress]
        --kernel=kernel_image_file_name --userland=userland_image_file_name

図7.1 tftpboot Command


Either one or both of the kernel and userland images may be specified.

Where the TFTP server has the IP address 192.168.10.1, the Armadillo has the IP address 192.168.10.10, the kernel image filename is linux.bin.gz and the userland image filename is romfs.img.gz, the command[15] will be as shown below.

hermit> setbootdevice tftp 192.168.10.10 192.168.10.1
        --kernel=linux.bin.gz --userland=romfs.img.gz

図7.2 tftpboot Command Example


When the TFTP configuration is set with the setbootdevice command, the settings are saved and the kernel and userland images will be loaded from the TFTP server on all future boots.

7.2. Loading From Storage

The kernel image can be loaded from a microSD card and the userland root filesystem can be stored on either a microSD card or USB memory on the Armadillo-400 Series.

The following explains how to load a kernel image and root filesystem both stored on a microSD card.

In this example one partition is created on a microSD card and formatted as an EXT3 filesystem. A root filesystem is then created there and the kernel image placed under the /boot/ directory. The device from which the kernel image will be loaded is specified with Hermit-At's boot options. The placement of the root filesystem is specified with kernel parameters.

[警告]

The steps described here apply when using versions 2.0.3 and later of the Hermit-At bootloader. As versions 2.0.2 and earlier are not compatible with EXT3 formatted boot partitions, these steps will not be usable.

If version 2.0.2 or earlier of the Hermit-At bootloader must be used for some reason, please refer to the explanation in version 1.2.0 of the Armadillo-400 Series Software Manual.

7.2.1. Partitioning

First, make one primary partition on the microSD card.

Insert the microSD card into the slot[16] and create the partition as shown in 図7.3「Partitioning Procedure」.

[armadillo ~]# fdisk /dev/mmcblk0
The number of cylinders for this disk is set to 124277.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): d                                                     1
Selected partition 1

Command (m for help): n                                                     2
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-124277, default 1):                                       3
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-124277, default 124277):      4
Using default value 124277

Command (m for help): w                                                     5
The partition table has been altered!

Calling ioctl() to re-read partition table.
 mmcblk0: p1
 mmcblk0: p1
Syncing disks.

[armadillo ~]#

図7.3 Partitioning Procedure


1

First, delete a pre-existing partition. If there is more than one pre-existing partition, please delete them all.

2

Make the new primary partition on the microSD card.

3

Press enter to use the default value (1) for the first cylinder.

4

Press enter to use the default value (124277) for the last cylinder also.

5

Write the changes to the microSD card.

[ティップ]

As the number of cylinders depends on the specifications of the microSD card being used, the number may not be the same as that displayed in the procedure above.

7.2.2. Creating Filesystems

Next, format the partition as an EXT3 filesystem as shown in 図7.4「Filesystem Creation Procedure」.

[armadillo ~]# mke2fs -j /dev/mmcblk0p1
mke2fs 1.25 (20-Sep-2001)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
497984 inodes, 994220 blocks
49711 blocks (5%) reserved for the super user
First data block=0
31 block groups
32768 blocks per group, 32768 fragments per group
16064 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736

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

This filesystem will be automatically checked every 35 mounts or
180.00 days, whichever comes first.  Use tune2fs -c or -i to override.

図7.4 Filesystem Creation Procedure


7.2.3. Kernel Image Placement

When booting from a microSD card, the kernel image must be stored in the /boot directory on the boot partition. Both uncompressed kernel images (Image, linux.bin) and compressed images (Image.gz, linux.bin.gz) are supported.

In the following example the wget command is used to obtain the kernel image. The URL that should be specified with the wget command differs depending on the product. Please refer to the table below for the correct URL.

表7.1 Kernel Image Download URLs

ProductURL
Armadillo-420http://download.atmark-techno.com/armadillo-420/image/linux-a400-[version].bin.gz
Armadillo-440http://download.atmark-techno.com/armadillo-440/image/linux-a400-[version].bin.gz

The following example shows the kernel placement for Armadillo-440.

[armadillo ~]# mount /dev/mmcblk0p1 /mnt/
[armadillo ~]# mkdir /mnt/boot
[armadillo ~]# cd /mnt/boot
[armadillo /mnt/boot]# wget http://download.atmark-techno.com/armadillo-440/image/linux-a400-[version].bin.gz
[armadillo /mnt/boot]# mv linux-a440-[version].bin.gz /mnt/boot/linux.bin.gz
[armadillo /mnt/boot]# cd
[armadillo ~]# umount /mnt

図7.5 Kernel Image Placement


7.2.4. Creating A Root Filesystem

The following explains how to create a root filesystem on a microSD card.

Either Debian/GNU Linux or a filesystem created with Atmark-Dist can be used for the root filesystem.

7.2.4.1. Installing Debian GNU/Linux

To install Debian GNU/Linux, first obtain the archive files from either the debian directory on the included DVD or from the download site. These are files from a standard Debian GNU/Linux install which have been divided up and compressed into a number of archives. The installation can be performed by just extracting the archives to the root filesystem.

[警告]

A partition with at least 1GB of free space is required when installing Debian GNU/Linux as the root filesystem.

In the following example the wget command is used to obtain the debian archives. The URLs that should be specified with the wget command differ depending on the product. Please refer to the table below for the correct URLs.

表7.2 Debian Archive Download URLs

ProductURL
Both Armadillo-420 and Armadillo-440http://download.atmark-techno.com/armadillo-4x0/debian/debian-lenny-armel-#.tgz[a]
http://download.atmark-techno.com/armadillo-4x0/debian/debian-lenny-armel-a4x0.tgz

[a] Note: the "#" is replaced with the range 1 to 5.


[armadillo ~]# mount /dev/mmcblk0p1 /mnt/
[armadillo ~]# mkdir tmp
[armadillo ~]# mount -t ramfs ramfs tmp
[armadillo ~]# cd tmp
[armadillo ~/tmp]#for N in 1 2 3 4 5 a4x0; do
> wget http://download.atmark-techno.com/armadillo-4x0/debian/debian-lenny-armel-${N}.tgz;
> gzip -cd debian-lenny-armel-${N}.tgz | (cd /mnt; tar xf -);
> sync;
> rm -f debian-lenny-armel-${N}.tgz;
> done
[armadillo ~/tmp]# cd
[armadillo ~]# umount tmp
[armadillo ~]# rmdir tmp
[armadillo ~]# umount /mnt

図7.6 Root Filesystem Creation With Debian Archives


7.2.4.2. Using an Atmark-Dist Image

The following explains how to create a root filesystem on a microSD card by using a root filesystem produced with Atmark-Dist. It is possible to use a microSD with a smaller storage capacity than when installing Debian.

In the following example the wget command is used to obtain the initrd image containing the root filesystem produced with Atmark-Dist. The URL that should be specified with the wget command differs depending on the product. Please refer to the table below for the correct URL.

表7.3 Atmark-Dist Image Download URL

ProductURL
Armadillo-420http://download.atmark-techno.com/armadillo-420/image/romfs-a420-[version].img.gz
Armadillo-440http://download.atmark-techno.com/armadillo-440/image/romfs-a440-[version].img.gz

[armadillo ~]# mount /dev/mmcblk0p1 /mnt/
[armadillo ~]# mkdir tmp
[armadillo ~]# mkdir romfs
[armadillo ~]# mount -t ramfs ramfs tmp
[armadillo ~]# wget http://download.atmark-techno.com/armadillo-440/image/romfs-a440-[version].img.gz -P tmp
[armadillo ~]# gzip -d tmp/romfs-a440-[version].img.gz
[armadillo ~]# mount -o loop tmp/romfs-a440-[version].img romfs/
[armadillo ~]# (cd romfs/; tar cf - *) | (cd /mnt; tar xf -)
[armadillo ~]# sync
[armadillo ~]# umount romfs
[armadillo ~]# rmdir romfs
[armadillo ~]# umount tmp
[armadillo ~]# rmdir tmp
[armadillo ~]# umount /mnt

図7.7 Root Filesystem Creation With Atmark-Dist Image


7.2.5. Boot Device and Kernel Parameter Settings

The place from which the kernel image will be loaded is selected with Hermit-At's boot device configuration. The placement of the root filesystem is specified with kernel parameters.

Set the jumpers for maintenance mode and reboot the board.

Execute the command shown in 図7.8「Boot Device Designation」 in order to boot from a kernel image stored in the first partition on a microSD card.

hermit> setbootdevice mmcblk0p1

図7.8 Boot Device Designation


Execute the command shown in 図7.9「Root Filesystem Designation Example」 in order to use a root filesystem stored in the first partition on a microSD card.

hermit> setenv console=ttymxc1 root=/dev/mmcblk0p1 noinitrd rootwait

図7.9 Root Filesystem Designation Example


7.3. Return Settings To Defaults

Enter the command shown in 図7.10「Assigning Flash Memory As Boot Device」 to return to using flash memory as the boot device.

hermit> setbootdevice flash

図7.10 Assigning Flash Memory As Boot Device


To return kernel parameters set with setenv to their default state, execute the clearenv command.

hermit> clearenv

図7.11 Return Kernel Parameters To Default State With clearenv




[14] The command is only shown as multiple lines due to formatting constraints and should be entered as one line.

[15] The command is only shown as multiple lines due to formatting constraints and should be entered as one line.

[16] The microSD slot on the Armadillo-400 Series is a lockable type. For information on inserting and removing the microSD card, please refer to the "Armadillo-400 Series Hardware Manual".