2010年7月12日星期一

OpenEmbedded / Angstrom : use the demo root filesystem

OpenEmbedded / Angstrom : use the demo root filesystem

Boot to the installed rootfs

Check Load Linux with u-boot chapter in the u-boot page to know how to load a Linux kernel.

Once loaded, the Linux kernel tries to mount a root file system ; command line parameters can indicate a location of such a rootfs. This option can be specified during the build process of through a u-boot environment variable.

Here is a sample command line for booting in the proper partition of the NAND FLASH : address indicated in theAddress text field during the flashing process (step #6).

mem=64M console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=jffs2 
which leads to the following u-boot command to setup the environment :
setenv bootargs 'mem=64M console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=jffs2' saveenv 

Once the Linux kernel and root filesystem loaded, you can access the Linux console through the serial line plugged on DBGU port.
Use the root login account without password.

Fit application set to your needs

While building the rootfs image

The AT91 demo policy is to bring the user more application to figure out what the capacities of the CPU are. We add then more packages at build time. The way to add packages to a base Angstrom image at building time is to add a new recipe, stating that it requires the base recipe, and to modify the ANGSTROM_EXTRA_INSTAL variable. Basically this is exactly the same thing as extending the RDEPENDS variable (Cf. x11-at91sam9-image.bb recipe):

RDEPENDS = "\     [..]      ${ANGSTROM_EXTRA_INSTALL}" 

Check the attached x11-at91sam9-image.bb file.

ANGSTROM_EXTRA_INSTALL += " \     <package_name> \     <another_package_or_task> \     <..> \     " 

The complete process of how to build the rootfs is described in the How to build Angstrom for AT91 from sourceschapter.

This point is discussed in details in this acticle : The correct way to add packages to an OpenEmbedded Image.

With pre-built packets in hands

Referring to the Angstrom Manual, you can check how to install new packages in an existing Angstrom distribution. 5. Installing Software and Package Management. So, there is always the ability to add applications to an already built distribution.

Here is different mean to add packaged applications to a running system.

Install application packages over the network

Reference chapter in the Angstrom manual.

Here is the Opkg official website.

On the target, /etc/opkg/etc/opkg/*.conf files points towards the servers where the device can pull packages from.

Angstrom feeds are discussed in the Angstrom Wiki.

Information on available packages are stored on particular files: the Packages or Packages.gz . This kind of file is downloaded to the target while issuing the opkg update command. 
You can create a custom opkg feed using a web server that is configured to point to the directory where resides compiled packages (*.ipk). Those packages are created during the OpenEmbedded building process. For example generic /armv5te/ compiled packages are located in tmp/deploy/glibc/ipk/armv5te .

tip If you build additional packages, do not forget to run bitbake package-index to update Packages and Packages.gz files in your opkg feed.

Procedure

On the host machine :

  • construct packages
  • run bitbake package-index
  • collect packages in a directory (done by the OpenEmbedded system : in path_to_deploy_dir/glibc/ipk/armv5te/)
  • configure your web server to give access to that directory

On the target

  • configure your Ethernet interface
  • check that you can access the web server and the feed (package directory)
  • run opkg update
  • run opkg list to see if the package you want is in the "available packages" list
  • run opkg install
  • check if the package is installed with the opkg list_installed command

Install application packages from local storage

Reference chapter in the Angstrom manual.

You can pick those packages in the deploy/glibc/ipk/ directory once you built them with bitbake.

You can install .ipk packages from all mass-storage support you can connect to a board.

  • usb key
  • SD/MMC card




[备份]angstrom rootfs for at91

OpenEmbedded / Angstrom : build from sources

How to build Angstrom for AT91

Note that building an entire distribution is a long process. It also requires a big amount of free disk space ; at least :

  • ~650 MByte of source archives downloaded for Internet
  • ~5 GByte of compiled packages and tools

This documentation is largely inspired by the following resources :

To build the binary found in the OpenEmbeddedAngstromGet page, you will have to go through the following steps.

Pre-requires

Here are the reference pages for setting up an OpenEmbedded building environment.

Note however that most of time, on a development host, those packages are often already installed.

Building environment

A step-by-step comprehensive installation is explained in the OpenEmbedded Getting Started page. The following lines have to be considered as an add-on that is AT91 specific or that can facilitate your setup.

Have a look at the OEDirectoryTree to figure out what your working environment tree will look like. In the following procedure, each time we speak about the base directory, we refer to the stuff directory.

Getting BitBake

Take it through the BitBake build tool website and take the latest archive tarball. follow the advice: simply install it in your OEDirectoryTree and make a generic link:

tar xvzf bitbake-1.8.18.tar.gz ln -s bitbake-1.8.18 bitbake 

Getting OpenEmbedded

Once in your OEDirectoryTree, download a snapshot of the OpenEmbedded database using the GIT Souce Code Management tool.

git clone git://git.openembedded.org/openembedded openembedded 
or using HTTP protocol:
git clone http://repo.or.cz/r/openembedded.git openembedded 

warning Make sure to call the directory where you will clone the GIT source openembedded. This name will be used in the following procedure and in the site.conf configuration file.

Then create a local branch based on OpenEmbedded stable/2009 branch:

cd openembedded git checkout -b stable_2009_mybranch origin/stable/2009 cd .. 

For demo root filesystems available in the GettingStarted page, we used the following commit ID :a646269c2ada7691d8a7f7455ba4528c7cca3483 . The stable/2009 branch should be stable enough to be able to build using those instructions even with a more recent HEAD for this branch.

AT91 OpenEmbedded overlay tree

In addition to the upstream recipes, we also have a set of our own recipes or modifications of the original ones. So, the following overlay tree will modify current OE original recipes.

hand note however that the goal of those recipes is to merge the most of it bits into the mainstream OE tree.

DESCRIPTIONSOURCESPATCH
OpenEmbedded databaseWeb interface:
http://cgit.openembedded.org/ 
branch: stable/2009
overlay directory tree archive

Then download and install the overlay tree archive, be sure to be in your OEDirectoryTree and:

wget ftp://ftp.linux4sam.org/pub/oe/linux4sam_x.y/oe_at91sam.tgz tar xvzf oe_at91sam.tgz 

This archive contains the configuration files, recipes that will overload the original ones from the OpenEmbedded project. The oe_env.sh script will allow you to setup local configuration variables needed for your rootfs to build.

Setup local configuration

The local configuration is located in oe_at91sam/conf/local.conf . This configuration file will overload theopenembedded/conf/local.conf one.

hand Read comments in it as it will bring you valuable information and allow you to adapt it to your own environment and building host (directory structure for example). Choose the proper machine type: we will use at91sam9m10g45ek for this setup:

MACHINE ?= "at91sam9m10g45ek" 

Start building

Be sure to always be in your OEDirectoryTree.

To start the building, source the oe_env.sh script:

source ./oe_env.sh 

Then begin building the distribution with a little set of packages:

bitbake base-image 

warning even a minimal image will require a big amount of time because of the cross-toolchain building process.

The console and graphical images are built using the following recipes respectively:

bitbake console-at91sam9-image bitbake x11-at91sam9-image 

Or for AT91SAM9M10 based boards:

bitbake x11-at91sam9m10-image 
This will allow you to take advantage of video features of this chip. This image will include kernel and Gstreamer components needed to use the hardware video decoder.

Tips & tricks

OE Link collection

From the BUG community, here is a very good link collection :
Three Steps for OpenEmbedded N00Bs

Wonder how to customize an OpenEmbedded building based on AT91 SOCs? Here is a simple and clear step by step blog:
Customizing OpenEmbedded

BitBake

BitBake usage:
http://www.uv-ac.de/openembedded/openembedded-3.html#ss3.2 
BitBake User Manual

list tasks provided by a package:

bitbake -c listtasks <package_name> 
You can use one of those tasks to have a fine grained control over the package building.

The structure of a BitBake file explained: BitBake Metadata

Hello World examples

The OpenMoko way: 
http://wiki.openmoko.org/wiki/Building_a_hello_world_application 
http://wiki.openmoko.org/wiki/Application_Development_Crash_Course#Your_First_Application


 ATTACHMENTACTIONSIZEDATEWHOCOMMENT
elseoe_angstrom_at91-2.diff.gzpropsmove194.9 K12 Dec 2008 - 12:56NicolasFerrelinux4sam_1.4_20081212
elseoe_angstrom_at91-3.diff.gzpropsmove195.9 K23 Jul 2009 - 15:17NicolasFerrelinux4sam_1.6_20090723
elseoe_angstrom_at91.diff.gzpropsmove192.5 K15 Apr 2008 - 13:13NicolasFerrelinux4sam_1.2_20080415
r28 - 07 Jun 2010 - 14:23:07 - NicolasFerre


2010年7月10日星期六

重新编译了根文件系统

使用最新的openembedded,编译的at91sam9263ek的rootfs,LCD换为800*600的后,触摸屏死活校准不好,而linux4sam上的可以。今天上Linux4sam发现根文件系统有更新了,故到学校更新了下。学校的网速真是爽阿!花了5个小时就编译完了,后天上班实验下。


2010年7月2日星期五

AT91SAM9263开发近况1

从6月10号左右元器件到齐,焊好板子,到今天已经快有三周了,期间也有很多乱七八糟的事情要处理,但是大部分时间还是用到了调试板子上,也走了很多弯路,16C554的驱动调试了快一周,最后才发现是有两个引脚在芯片底下焊接短路了,但是还算顺利,到今天驱动算是差不多了。
主要完成了:
一些平台搭建;
硬件调试;
16C554外括4个RS485驱动;
自带RS485口驱动;
4个MCP2515 CAN驱动;
自带CAN驱动;
PCF8563驱动;
FM24CL64驱动;
LCD驱动(800*600);
主频修改到235MHZ;

当然,都是在一些现有的基础上修改的,但是对于俺这样的菜鸟来说已经貌似可以了。

最爽的是,设计的LVDS LCD驱动电路、16C554扩展电路、RS485自动收发切换电路及LCD背光驱动电路等现在都还没有发现问题。硬件除了一个插头手册上有,但是市场上少量买不到外,都没有问题。

使用了:
bootstrap-1.1.4
u-boot-1.3.4
linux-2.6.30