第6章 Building

This chapter explains how to build images from source code with the same content as the factory images, and also how to customize these images.

If you have not yet set up a development environment on a work PC, please do so now by referring to 4章Development Environment Set-up.

For more a detailed explanation of the steps involved, please refer to the "Atmark-Dist Developers Guide."

The operations in the following examples should be carried out under the home directory (~/).

[警告]

The development process involves working with basic libraries, applications and system configuration files. While all files are altered only under the working directory, in order to ensure the PC operating system is not inadvertently damaged from any mistakes made during development please perform all work as a general user and not a root user.

6.1. Building Kernel and Userland Images

The following explains how to make kernel and userland images from the source code based distribution Atmark-Dist and the Linux kernel source code.

6.1.1. Preparing Source Code

First, obtain the source code. Extract atmark-dist-[version].tar.gz from the source/dist directory and linux-[version].tar.gz from the source/kernel directory on the included DVD into the working directory.

After extracting the files, register the kernel source in Atmark-Dist. Perform all operations as shown in 図6.1「Source Code Preparation」.

[PC ~]$tar zxvf atmark-dist-[version].tar.gz
[PC ~]$tar zxvf linux-[version].tar.gz
[PC ~]$ ls
atmark-dist-[version].tar.gz  atmark-dist-[version]
linux-[version].tar.gz  linux-[version]
[PC ~]$ ln -s atmark-dist-[version] atmark-dist
[PC ~]$ cd atmark-dist
[PC ~/atmark-dist]$ ln -s ../linux-[version] linux-2.6.x

図6.1 Source Code Preparation


6.1.2. Applying Default Configuration

Atmark-Dist should then be configured for the target Armadillo. As the Linux kernel is managed by Atmark-Dist, once Atmark-Dist has been configured appropriately the correct kernel configuration will be applied automatically.

Start the configuration by entering the commands shown in the following example[12].

[PC ~/atmark-dist]$ make config

First, you will be asked to select a vendor. Please enter "AtmarkTechno".

[PC ~/atmark-dist]$ make config
config/mkconfig > config.in
#
# No defaults found
#
*
* Vendor/Product Selection
*
*
* Select the Vendor you wish to target
*
Vendor (3com, ADI, Akizuki, Apple, Arcturus, Arnewsh, AtmarkTechno, Atmel, Avnet, Cirrus, Cogent, Conexant, Cwlinux, CyberGuard, Cytek, Exys, Feith, Future, GDB, Hitachi, Imt, Insight, Intel, KendinMicrel, LEOX, Mecel, Midas, Motorola, NEC, NetSilicon, Netburner, Nintendo, OPENcores, Promise, SNEHA, SSV, SWARM, Samsung, SecureEdge, Signal, SnapGear, Soekris, Sony, StrawberryLinux, TI, TeleIP, Triscend, Via, Weiss, Xilinx, senTec) [SnapGear] (NEW) AtmarkTechno

Next, you will be asked to select a product name. Please select the appropriate product name from 表6.1「Product Name List」.

表6.1 Product Name List

ProductProduct NameNotes
Armadillo-440 LCD ModelArmadillo-440Factory Image
Armadillo-420 Basic ModelArmadillo-420Factory Image

Armadillo-440 is used in the example below.

* * Select the Product you wish to target * AtmarkTechno Products (Armadillo-210.Base, Armadillo-210.Recover, Armadillo-220.Base, Armadillo-220.Recover, Armadillo-230.Base, Armadillo-230.Recover, Armadillo-240.Base, Armadillo-240.Recover, Armadillo-300, Armadillo-440, Armadillo-500, Armadillo-500-FX.base, Armadillo-500-FX.dev, Armadillo-9, Armadillo-9.PCMCIA, SUZAKU-V.SZ310, SUZAKU-V.SZ310-SID, SUZAKU-V.SZ310-SIL, SUZAKU-V.SZ310-SIL-GPIO, SUZAKU-V.SZ410, SUZAKU-V.SZ410-SID, SUZAKU-V.SZ410-SIL, SUZAKU-V.SZ410-SIL-GPIO, SUZAKU-V.SZ410-SIV) [Armadillo-210.Base] (NEW)Armadillo-440

You will then be asked to select the development environment. Please enter "default". The armel (EABI) development environment will be used for the Armadillo-400 Series when "default" is selected.

* * Kernel/Library/Defaults Selection * * * Kernel is linux-2.6.x * Cross-dev (default, arm-vfp, arm, armel, armnommu, common, h8300, host, i386, i960, m68knommu, microblaze, mips, powerpc, sh) [default] (NEW)default

Next, enter "None" for which libc to build. By selecting "None", the libc already installed in the development environment (glibc) will be used.

Libc Version (None, glibc, uC-libc, uClibc) [uClibc] (NEW)None

Enter "y" (yes) when asked whether or not to default all settings.

Default all settings (lose changes) (CONFIG_DEFAULTS_OVERRIDE) [N/y/?] (NEW)y

Enter "n" (no) for the final three questions.

Customize Kernel Settings (CONFIG_DEFAULTS_KERNEL) [N/y/?]n
Customize Vendor/User Settings (CONFIG_DEFAULTS_VENDOR) [N/y/?]n
Update Default Vendor Settings (CONFIG_DEFAULTS_VENDOR_UPDATE) [N/y/?]n

Once all options have been entered, the configuration will be saved to the build system and you will be returned to the prompt.

6.1.3. Building

To start the build, execute the command shown in 図6.2「Atmark-Dist Build」 in the atmark-dist directory. Once the build completes, image files will have been created under the atmark-dist/images directory. romfs.img is the userland image and linux.bin is the kernel image. romfs.img.gz and linux.bin.gz are compressed versions of these files.

[PC ~/atmark-dist]$ make
	:
	:
[PC ~/atmark-dist]$ ls images
linux.bin  linux.bin.gz  romfs.img  romfs.img.gz

図6.2 Atmark-Dist Build


The created images can be written to the target Armadillo by following the steps in 5章Rewriting Flash Memory. The compressed images are normally used as they use the least amount of flash memory.

6.1.4. Customizing Images

Atmark-Dist includes a variety of applications and libraries which can be included or removed from an image according to the chosen configuration. It is also possible to alter the kernel configuration.

Use the make menuconfig command to change the Atmark-Dist configuration.

[PC ~/atmark-dist]$ make menuconfig

図6.3 Atmark-Dist Configuration


After executing the make menuconfig command, the Main Menu screen as shown in 図6.4「menuconfig: Main Menu」 is displayed.

menuconfig: Main Menu

図6.4 menuconfig: Main Menu


Use the up and down arrow keys to highlight Kernel/Library/Defaults Selection ---> and press enter. The Kernel/Library/Defaults Selection screen will be displayed.

menuconfig: Kernel/Library/Defaults Selection

図6.5 menuconfig: Kernel/Library/Defaults Selection


To change the kernel configuration, select Customize Kernel Settings. To change what applications or libraries are included in the userland, select Customize Vendor/User Settings. Each option can be selected by using the up and down arrow keys to highlight the relevant option and then pressing the space bar so that a "*" mark appears before it.

After making the selections, use the left and right arrow keys to highlight Exit and press Enter. You will be taken back to the Main Menu screen.

Again in the Main Menu screen highlight Exit and press Enter. The Do you wish to save your new kernel configuration? confirmation screen will then appear. Highlight Yes and press Enter.

menuconfig: Do you wish to save your new kernel configuration?

図6.6 menuconfig: Do you wish to save your new kernel configuration?


If you had selected the Customize Kernel Settings option, the Linux Kenrel Configuration screen will appear. Changes to the kernel configuration can be made here. After making the required changes, highlight Exit on the Linux Kernel Configuration screen and press Enter to exit.

menuconfig: Linux Kernel Configuration

図6.7 menuconfig: Linux Kernel Configuration


If you had selected the Customize Vendor/User Settings option, the Userland Configuration screen will then appear. Changes to what applications are libraries are included in the userland can be made here. After making the required changes, highlight Exit on the Userland Configuration screen and press Enter to exit.

menuconfig: Userland Configuration

図6.8 menuconfig: Userland Configuration


The Do you wish to save your new kernel configuration? confirmation screen will then appear once again. Highlight Yes and press Enter.

This completes the configuration process.

For more details on the using make menuconfig for configuration, please refer to the "Atmark-Dist Developers Guide".

After the configuration process, use the make command in the same way described in 「Building」 to create images based off the new configuration.

6.1.5. Adding An Application To The Userland Image

The following explains how to add files such as an original application not included in Atmark-Dist to the userland created in 「Building Kernel and Userland Images」.

The following example assumes that an original application has be built with the Out-Of-Tree method[13] and has the filename ~/sample/hello.

In Atmark-Dist, the files to be included in the userland image are stored under the romfs directory. It is possible to create a userland image which includes the original application by adding the application to this directory and then executing the make image command.

[PC ~/atmark-dist]$ cp ~/sample/hello romfs/bin/
[PC ~/atmark-dist]$ make image
: : [PC ~/atmark-dist]$ ls images
linux.bin  linux.bin.gz  romfs.img  romfs.img.gz

図6.9 Userland Image Customization


The hello application is now installed under the /bin directory in the newly created userland image.

6.2. Building Bootloader Images

The following explains how to build a Hermit-At bootloader image from source code. The explanation applies to versions v2.0.0 or later of the source code.

6.2.1. Preparing Source Code

Extract hermit-at-[version]-source.tar.gz from the source/bootloader directory on the included DVD to the working directory. Complete the operation as shown in 図6.10「Hermit-At Source Archive Extraction」.

[PC ~]$ tar zxvf hermit-at-[version]-source.tar.gz
[PC ~]$ ln -s hermit-at-[version] hermit-at
[PC ~]$ cd hermit-at
[PC ~/hermit-at]$

図6.10 Hermit-At Source Archive Extraction


6.2.2. Building

In versions v2.0.0 and later of Hermit-At, default configurations for each product have been prepared as defconfig files. To build an image with the same content as the factory image, execute the commands shown in 図6.11「Hermit-At Build Example」.

[PC ~/hermit-at]$ make armadillo4x0_defconfig
[PC ~/hermit-at]$ make
    :
    :
[PC ~/hermit-at]$ ls src/target/armadillo4x0/*.bin
loader-armadillo4x0-[version].bin

図6.11 Hermit-At Build Example


The loader-armadillo4x0-[version].bin file is the newly created bootloader image.

Versions v2.0.0 and later of Hermit-At also support configuration with the make menuconfig command in the same way as Atmark-Dist. Commands can be added or removed and default behavior altered with this configuration method.



[12] While this explains how to configure Atmark-Dist using the command line, it is also possible to use a menu system. For more details on using the menu system, please refer to the "Atmark-Dist Developers Guide."

[13] For information on Out-Of-Tree compiles, please refer to "Atmark-Dist Developers Guide".