Difference between revisions of "Armadeus 3"

From ArmadeusWiki
Jump to: navigation, search
m (update U-Boot (on the target))
m (How-to configure and build Armadeus 3)
Line 142: Line 142:
 
: '''apf9328-linux.bin''' (Linux image to use with U-Boot, see [[Target_Software_Installation#Linux_kernel_installation | InstallLinux]])
 
: '''apf9328-linux.bin''' (Linux image to use with U-Boot, see [[Target_Software_Installation#Linux_kernel_installation | InstallLinux]])
 
: '''apf9328-rootfs.arm.jffs2''' (FileSystem/RootFS image to use with U-Boot, see [[Target_Software_Installation#Linux_rootfs_installation | RootFS flashing]])
 
: '''apf9328-rootfs.arm.jffs2''' (FileSystem/RootFS image to use with U-Boot, see [[Target_Software_Installation#Linux_rootfs_installation | RootFS flashing]])
: '''apf9328-rootfs.arm.tar''' (for an NFS/MMC RootFS, see RootNFS? & [[MultiMediaCard#Booting_from_MMC.2FSD | Booting from a MMC/SD]])
+
: '''apf9328-rootfs.arm.tar''' (for an NFS/MMC RootFS, see [[Network_Configuration#Boot_from_NFS|Booting from NFS]] & [[MultiMediaCard#Booting_from_MMC.2FSD | Booting from a MMC/SD]])
  
 
<b> Please note the new naming convention of binary files and directories</b>
 
<b> Please note the new naming convention of binary files and directories</b>

Revision as of 14:14, 28 January 2009

This page will help you to use the upcoming Armadeus software release 3. This page also provides information about changes compared to the previous versions of Armadeus.


Introduction

Armadeus 3 adds many new features, including the following:

  • Some architectural changes to support different hardware targets (APF27 is coming)
  • New versions of U-Boot (1.3.4), Linux kernel (2.6.27), GCC (4.2.1), Busybox (1.12.1) and also a recent version of Buildroot
  • New naming convention of files
  • New Flash partition mapping on the target
  • TBC

Important Information regarding documentation

With the introduction of Armadeus 3 the Wiki documentation is also moving to support the new software. Nevertheless you can download the following HTML dump to have the Armadeus 2.x compatible documentation: Armadeus 2.x wiki

To summarize the documentation changes, here are the rules to adapt the documentation according to your target and version of Armadeus.

  • First Armadeus configuration once you have downloaded the Armadeus package found somewhere in First Setup pages:
Armadeus 3 first command to use according to your <board> (apf9328 or the future apf27): make <board>_defconfig
Armadeus 2 first command for apf9328: make
  • Binary files location according to your <board> (apf9328 or the future apf27):
Armadeus 3 is buildroot/binaries/<board>/
Armadeus 2 was buildroot/armadeus/
  • Armadeus 3 binary files naming convention according to your <board> (apf9328 or the future apf27):
<board>-u-boot.brec
<board>-u-boot.bin
<board>-linux.bin
<board>-rootfs.arm.jffs2
<board>-rootfs.arm.tar
  • Armadeus 2 binary files naming convention for apf9328 only:
u-boot.brec
u-boot.bin
linux-kernel-2.6.xx.x-arm.bin
rootfs.arm.jffs2
rootfs.arm.tar
  • Non configurable users-space tools including compiler for your board (apf9328 or the future apf27):
Armadeus 3 tools for the apf9328 are located at buildroot/build_armv4t/
Armadeus 3 tools for the apf27 are located at buildroot/build_armv5te/
Armadeus 2 tools are located at buildroot/build_arm/
  • Configurable user-space tools (Linux, rootfs, U-Boot, Busybox...) for your board (apf9328 or the future apf27):
Armadeus 3 tools for the apf9328 are located at buildroot/project_build_armv4t/apf9328/
Armadeus 3 tools for the apf27 are located at buildroot/project_build_armv5te/apf27/
Armadeus 2 tools are located at buildroot/project_build_arm/armadeus/
  • cross compilation toolchain for your board (apf9328 or the future apf27):
Armadeus 3 source toolchain for the apf9328 is located at buildroot/toolchain_build_armv4t/
Armadeus 3 source toolchain for the apf27 is located at buildroot/toolchain_build_armv5te/
Armadeus 2 toolchain is located at buildroot/toolchain_build_arm/

Keeping these rules in mind, you are ready to use any wiki page as guideline whatever you are working with Armadeus 2.x or 3 or even the future board apf27.

How-to obtain the Armadeus 3

For the time being, the third generation of Armadeus is only available on the Subversion repository: https://armadeus.svn.sourceforge.net/svnroot/armadeus/trunk

You can checkout the new version of armadeus or update your working version of armadeus. We strognly suggest you to checkout the new version of Armadeus because the new naming convention of files will produce a second directory structure of toolchain, projects, build and image files that could be a source of confusion.

  • Checkout the new version:
$ svn co https://armadeus.svn.sourceforge.net/svnroot/armadeus/trunk armadeus

this commmand will download the latest version of Armadeus.

Remarks: Do not use spaces in the directory name !


  • Update your working version of armadeus

WARNING: Do not use a simple svn update because some legacy buildroot patches will break your compilation!

$cd armadeus
$rm -rf buildroot/package
$rm -rf buildroot/target
$rm -rf buildroot/toolchain
$svn update
$make apf9328_defconfig

WARNING: the latest command (make apf9328_defconfig) is very important to start with an up to date configuriguration!

At any time you can cleanup the old directories built with armadeus 2:

$rm -rf buildroot/binaries/armadeus
$rm -rf buildroot/build_arm
$rm -rf buildroot/project_build_arm
$rm -rf buildroot/toolchain_build_arm


  • How-to obtain the legacy Armadeus 2 (If you're not ready to upgrade your target):
$ svn co https://armadeus.svn.sourceforge.net/svnroot/armadeus/trunk@914 armadeus2

How-to configure and build Armadeus 3

  • After changing to the directory armadeus, you have to configure Armadeus software for the APF9328 target.
$ cd armadeus/
$ make apf9328_defconfig


The 'apf9328_defconfig' configuration option is the first difference with the previous releases of Armadeus. This configuration has to be done only once after a checkout or after an update from an older version Armadeus. This command configure Armadeus for the apf9328 board then launch the regular Buildroot configuration menu:


Menuconfig3.png


  • Configure Armadeus

In Target options ---> Armadeus Device Support menu, you can check and change the quantity of RAM available on your Armadeus board (apf9328). (Default value 16MB is just fine with all APF9328 boards).

In Target filesystem options --> for each type of filesystems to build you have the option to copy the binary file to secondary location like your tftp server folder (for exemple /tftpboot).

In Target filesystem options --> You will find U-Boot options at the end of this menu including the option to copy U-Boot to a secondary location like /tftpboot

In Kernel --> Destination for linux kernel binaries --> You will find options to copy linux to a secondary location like /tftpboot


  • Exit the configuration tool and save your configuration


  • Launch the build process and take a cup of coffee for the next hour
$ make

The toolchain is built automatically. During this procedure, several files are downloaded from Internet. Please wait for a while.... it takes at least one hour to compile everything!


  • Enjoy the result


The generated binary files can be found in the new subdirectory buildroot/binaries/apf9328/:

apf9328-u-boot.brec (BRecord image that can be used with the bootstrap, if U-Boot is not installed or not working, see BootLoader page)
apf9328-u-boot.bin (U-Boot image file to be used with U-Boot itself, see updating U-Boot)
apf9328-linux.bin (Linux image to use with U-Boot, see InstallLinux)
apf9328-rootfs.arm.jffs2 (FileSystem/RootFS image to use with U-Boot, see RootFS flashing)
apf9328-rootfs.arm.tar (for an NFS/MMC RootFS, see Booting from NFS & Booting from a MMC/SD)

Please note the new naming convention of binary files and directories

The toolchain and project files share a new nameing convention too:

buildroot/build_armv4t (contains all non configurable user-space tools)
buildroot/project_build_armv4t/apf9328 (contains all configurable user-space tools: target filesystem, linux, busybox and u-boot...)
buildroot/toolchain_build_armv4t (cross compilation toolchain)

More information is available in the buildroot documentation


  • Prepare binary images for download

The simplest method to prepare binary files for a download to target is to copy them in the tftpboot public directory (for example /tftpboot). You can do it manually:

$ cp -f buildroot/binaries/apf9328/* /tftpboot

Or you can configure buildroot to copy the image files automatically as described hereabove in Configure Armadeus.
From here we will suppose all the image files are available at the root of your tftp server

How-to upgrade the apf9328 target

To prepare the upgrade of the target you have to copy binary files from buildroot/binaries/apf9328/ to your /tftpboot folder or make this process automatic using the command: make menuconfig. The communication with target is fully compatible with previous versions of Armadeus, as explained in communicate with the target

update U-Boot (on the target)

Using the command printenv check the target IP variables:

BIOS> printenv
bootcmd=run jffsboot
bootdelay=20
...
gatewayip=192.168.0.1
netmask=255.255.255.0
ipaddr=192.168.0.10
serverip=192.168.0.2

ipaddr is the target IP address and serverip is the one of the Host PC running the tftp server. The page Target_Software_Installation will help you to set these variables.


If everything is fine you should be ready to download the new release of u-boot:

  • Load the new U-Boot code in RAM

You can use the following commands to download U-boot:
With Ethernet and a TFTP server:

BIOS> tftpboot 08000000 apf9328-u-boot.bin
dm9000 i/o: 0x15c00000, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 00:1e:ac:00:00:02
operating at 100M full duplex mode
TFTP from server 192.168.0.2; our IP address is 192.168.0.10
Filename 'apf9328-u-boot.bin'.
Load address: 0x8000000
Loading: ##################################
done
Bytes transferred = 173036 (2a3ec hex)

Or with Ethernet and a NFS server:

BIOS> nfs 08000000 ${serverip}:/nfs_path_to_buildroot/binaries/apf9328/apf9328-u-boot.bin

Or with the kermit and a serial line

BIOS> loadb 08000000
   <CTRL><ALT GR>\
   c
   send path_to_buildroot/binaries/apf9328/apf9328-u_boot.bin
   c
  • Test the downloaded version of u-boot
BIOS> go 08000000

## Starting application at 0x08000000 ...


U-Boot 1.3.4 (Dec  2 2008 - 18:44:41) apf9328 patch 3.3

I2C:   ready
DRAM:  16 MB
Flash:  8 MB
In:    serial
Out:   serial
Err:   serial

Hit any key to stop autoboot:  0
BIOS>


  • Transfer code from RAM to Flash memory

There is a simple U-Boot command/script to do that:

BIOS> run flash_uboot

.. done
Un-Protected 2 sectors

.. done
Erased 2 sectors
Copy to Flash... done
.. done
Protected 2 sectors
Flashing uboot succeed
BIOS>


Advanced informations can be found at the BootLoader wiki page.


  • Reset the environment variables and reset the board

Note: This is important to support the new flash memory mapping. !! You will loose all the variables you had defined before !!

BIOS> run flash_reset_env

. done
Un-Protected 1 sectors

. done
Erased 1 sectors
Erasing of flash environment variables done!
BIOS>

And do not forget to reset the board by hardware or software.

BIOS> reset

U-Boot 1.3.4 (Dec  2 2008 - 18:44:41) apf9328 patch 3.3

I2C:   ready
DRAM:  16 MB
Flash:  8 MB
...

update linux and rootfs (on the target)

  • Check and set the IP variables:
BIOS> printenv
bootcmd=run jffsboot
bootdelay=20
...
gatewayip=192.168.0.1
netmask=255.255.255.0
ipaddr=192.168.0.10
serverip=192.168.0.2

ipaddr is the target IP address and serverip is the one of the Host PC running the tftp server. The page Target_Software_Installation will help you to set these variables.

You can use the dhcp command to automatically configure these variables from your DHCP server. You probably will have to adjust the serverip variable manually.

BIOS> dhcp
dm9000 i/o: 0x15c00000, id: 0x90000a46
MAC: 00:0e:32:00:00:02
operating at 100M full duplex mode
BOOTP broadcast 1
DHCP client bound to address 192.168.0.10
BIOS> setenv serverip 192.168.0.2
BIOS> saveenv

Do not forget to save your changes in FLASH, to have them available at next power up:

BIOS> saveenv


  • Update Linux (still on the target)

Using the new release of U-Boot, it is quite simple to update Linux kernel and rootfs using the news scripts included in the release:

BIOS> run update_kernel
dm9000 i/o: 0x15c00000, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 00:1e:ac:00:00:02
operating at 100M full duplex mode
TFTP from server 192.168.0.2; our IP address is 192.168.0.10
Filename 'apf9328-linux.bin'.
Load address: 0x8000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         ##############################################
done
Bytes transferred = 1564776 (17e068 hex)

................ done
Erased 16 sectors
Copy to Flash... done
Flashing kernel succeed


  • Update rootfs (still on the target)
BIOS> run update_rootfs
dm9000 i/o: 0x15c00000, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 00:1e:ac:00:00:02
operating at 100M full duplex mode
TFTP from server 192.168.0.2; our IP address is 192.168.0.10
Filename 'apf9328-rootfs.arm.jffs2'.
Load address: 0x8000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ######################################################
done
Bytes transferred = 3932160 (3c0000 hex)

........................................... done
Erased 43 sectors
Copy to Flash... done
Flashing rootfs succeed
BIOS>

update your fpga firmware (on the target)

Please, follow the standard procedure Firmware installation

How-to develop with Armadeus

Your new Armadeus 3 is running fine on the target. Now you probably would like to customize the target for your project.

How-to add a software

Use the command make menuconfig':

$ make menuconfig

Select your package in the menu "package", save the configuration and compile a new rootfs

$ make 

On the target, download and flash the new rootfs:

BIOS> run update_rootfs
...
BIOS> boot

How-to remove a software

Supposing you would like to remove an unwanted package from the target.

  • The first step is to use the command make menuconfig to unselect this package but this commnand will not remove the package from the rootfs. You have to use the clean command of buildroot. In the lines hereafter replace the word <package> with the real name of your package.
 $ make menuconfig
 ... deselect your <package>
 $ make <package>-clean
 $ make

Your new rootfs is now ready to use - Enjoy


  • Some packages do not support any uninstall behavior. In such a case you can rebuild your environment using the global clean command. This command requests to compile almost everything and therefore will take time.
 $ make menuconfig
 ... deselect your <package>
 $ make clean
 $ make

WARNING: Using this method you will lose any modification you could have done directly in the directory buildroot/project_build_armv4t/apf9328/root.
Please read the chapter How-to modifify root filesystem hereafter.

Your new rootfs is ready to use - Enjoy

  • A faster method exists to force to rebuild rootfs. You can delete the root directory. Unfortunately some libraries (ie c++ lib) are not reinstalled using this method.
 $ make menuconfig
 ... deselect your <package>
 $ rm -rf buildroot/project_build_armv4t/apf9328/root
 $ rm -rf buildroot/project_build_armv4t/apf9328/.root
 $ make

WARNING: Using this method you will lose any modification you could have done directly in the directory buildroot/project_build_armv4t/apf9328/root.
Please read the chapter How-to modify root filesystem hereafter.

Your new rootfs is ready to use - Enjoy

How-to modify a software

You would like to modify a package and test your modification on the target. The command make <package>-clean will force to rebuild the package you modified:

 $ make <package>-clean
 $ make

Your new rootfs is ready to use - Enjoy

How-to create a buildroot package

The creation of a new buildroot package is more in depth described in the specific wiki page Buildroot_Packages and in the buildroot documentation

How-to modify root filesystem

There are different methods to modify the rootfs of the apf9328:

  1. modify files directly on the target (ideal solution for first trials)
  2. modify files in buildroot/project_build_armv4t/apf9328/root/ (to validate your modification with armadeus)
  3. modify files in buildroot/target/device/aramdeus/rootfs/target_skeleton (your modifcation will support a make clean )
  4. create a patch file in armadeus/patches (your modification will support a svn update)

How-to modify Linux kernel

To rebuild the kernel or any kernel driver you can use the command make linux26-clean; make. please note the new package name use by buildroot for Linux: linux26

$ make linux26-clean
$ make

your new Linux kernel and rootfs containing drivers are ready to use - Enjoy

There is another method to rebuild the kernel faster than the previous one:

$ make linux26
$ make

With this method only the modified files are compiled.


How-to configure a Linux kernel

There is a command to modify the linux kernel configuration:

$make linux26-menuconfig

Modify your kernel configuration, save your change and rebuild Armadeus in few seconds:

$make

How-to configure U-Boot

you can change the U-Boot configuration using the buildroot command make menuconfig. U-Boot options are in the sub-menu target filesystem options. In order to rebuild U-Boot with new options it is necessary to remove U-Boot first:

$make menuconfig
...
$make u-boot-dirclean
$make

WARNING: the command make u-boot-dirclean delete the U-Boot directory and any modification you did in this directory.

How-to modify U-Boot

To rebuild U-Boot you can use the command make u-boot-clean; make.

$ make u-boot-clean
$ make

your new U-Boot is ready to use - Enjoy

If you modify the config file apf9328.h located in buildroot/project_build_armv4t/apf9328/u-boot-1.3.4/include/configs/apf9328.h, then we suggest you to rebuild the whole u-boot package:

$ make u-boot-distclean
$ make

How-to configure busybox

It also possible to modify the Busybox configuration to add or remove some features:

$make busybox-menuconfig

to be continued...