NGW100 LiveCD

From TechNet
Jump to: navigation, search

THIS IS A WORK IN PROGRESS - THIS IS MAINLY NOTES TO MYSELF FOR BUILDING MY NGW100 DEVELOPMENT ENVIRONMENT. THEY ARE INCOMPLETE AND OUT OF ORDER. USE OF THESE INSTRUCTIONS BEFORE CERTIFICATION IS AT YOUR OWN RISK!

Contents

Background and Purpose

The NGW100 is a 'mature' product of Atmel, however it is still very popular. Development on the Atmel Buildroot chain stopped in 2008. The environment is quite functional however since then the Linux distributions have matured as well, and some of the packages in the toolchain have to be modified or worked around.

There are numerous forum posts noting how others have conquered their challenges installing the toolchain, but none of them give a complete description of their development system or how they built it. This wiki attempts to diagram the steps taken in building the development system, and creating a live CD afterwards so the system can be replicated on other users hardware.

The live cd should have functionality to flash the uboot and filesystem in the NGW100 (or other AVR32 target boards) from the live desktop without having to install on the users machine. Should the user decide to develop on the NGW100 he can install the full development system, ready to go, with the click of his mouse like any other live cd installation.

If all you want to do is build your development environment and are not interested in making the live cd, then you can skip the removal opf unneccessary software and continue on with installing the required packages for buildroot. This will leave you witha very robust development environment.

Why PCLinuxOS?

The first reason is their setup for remastering a LiveCD looked the easiest for me. I had experience in the past attempting to hack the mklivecd scripts and failed miserably. The mylivecd system for creating a livecd looks much easier than any other process.

While experimenting with the installation, I noticed it handles my hardware extremely well. NO OTHER DISTRO, including Windows, turns on the fan in my video card. In fact, I was getting ready to replace it. When the livecd first loaded, right at the point it was asking what kind of keyboard I had, the fan came on - bravo PCLinuxOS!!

I understand Ubuntu and Fedora have pretty good livecd creators, perhaps someone can make one from those as well. If this project goes well, I may do so myself. Ubuntu and Fedora do not turn on my video card fan ;]

Prepare the Development System

System

Get and Install the PCLinuxOS LiveCD

Download the PCLinuxOS iso Here.

Use your favorite CD burning program to create the bootable CD.

Start the LiveCD by booting from it, and allow it to install to your system. Some distributions allow you to select the packages to install, PCLinuxOS does not. We'll have to add the files required by buildroot after installation.

Once the installation is complete shut down or restart and remove the CD in order to boot from your newly installed system.

Uninstall unnecessary packages

This is an important step because your live cd is just a cd - it only holds 700 MiB. If you develop anything decent it could easily build out to be larger than 700 MiB. THis is not good ...

Since there are many unnecessary packages for NGW development in PCLinuxOS, we should remove them. This will also decrease the amount of time it takes to create the compressed image when making the live cd,

PCLinuxOS recommends using the synaptek package manager instead of the command line apt-get. I will use this tool from this point on to install all packages. If you would like to use the command line apt-get command, please document your success and post the variations here.

When you first start Synaptec you want to hit the 'Reload' button. I believe this refreshes the repositories - it downloads some files.

 Start the Synaptec package manager
 Click 'Reload' near the top left of the program screen


The packages we are going to remove are

 all games
 this
 that
 the other
 (make list)


In the Synaptec package manager search for each of the packages and mark them for removal.

For each of the above packages

 Click the Search button (looks like binoculars)
 Enter the package name in the search field
   Select 'Name' in 'Look In '
   right click the appropriate package and select 'mark for removal'
   click 'Mark" on the confirmation dialog

Take a break this may be a while.

Install packages required by buildroot

According to the Atmel Buildroot page, the following packages must be installed before attempting to compile buildroot -

 C compiler (GCC)
 C++ compiler for Qtopia (G++)
 GNU make
 sed
 flex
 bison
 patch
 gettext
 libtool
 texinfo
 autoconf (version 2.13 and 2.61)
 automake
 ncurses library (development install)
 zlib library (development install)
 libacl library (development install)
 lzo2 library (development install)


Some of the packages are already installed by default from the PCLinuxOS installer on their live cd. Some need to add the 'devel' version.

The following packages needed to be installed on my system -

 C++
 flex
 bison
 libtool
 texinfo
 gettext-devel 
 autoconf 
 automake
 zlib devel
 lzo2 devel


In the Synaptec package manager search for each of the packages and mark them for install. DO NOT SELECT ANY AVR ITEMS! see This article about why.

For each of the following packages

 Click the Search button (looks like binoculars)
 Enter the package name in the search field
   Select 'Name' in 'Look In '
   right click the appropriate package and select 'mark for installation'
   click 'Mark" on the confirmation dialog


Here are the names and descriptions of the required packages -

 gcc-c++ - "C++ support for gcc" for PCLOS 2010
 flex -  'A tool for creating scanners (text pattern recognizers)'
 bison - "general purpose parser generator'
 libtool - "simplifies the use of shared libraries'
 texinfo - "tools needed to create Texinfo format documentation files'
 gettext-devel - "development files for gettext'
 autoconf - "a gnu tool for automatically configuring source code'
 automake version for PCLinuxOS 2010 - "a gnu tool for automatically creating Makefiles'
 zlib devel - "header files and libraries for developing apps which will use zlib'    
 lzo2 devel - "header files of liblzo library'


Once all the packages are selected go ahead and install them

 Click the 'Apply' button
   Review the changes to the system if you like 
 Click Apply


The system will now download and install the marked packages and their dependencies.

Have a cup of coffee.

Additional packages useful for development

There are some additional niceties that we can add for development. I think it is imperative to have the AVR32Studio installed, as well as the QT Creator and assistants for making graphical environment apps for the touchscreen enabled NGW100.

The packages I'm going to add are

 AVE32 Studio
 QTCreator
 Bluefish
 Kate
 KDevelop


Once all the packages are selected go ahead and install them

 Click the 'Apply' button
   Review the changes to the system if you like 
 Click Apply


The system will now download and install the marked packages and their dependencies.

Have a cup of coffee.


Update the system

There will be a lot of files that need to be updated at this point. Allow the system to do a complete update. PCLinuxOS recommends not to do the updates from the command line but to use the synaptec software manager.

 Click 'Mark all upgrades'
 Confirm by clicking 'Mark'
 Click 'Apply'
 Click 'Apply' again to confirm


On my installation 396 packages are upgraded.

Have another break!

After the update process completes, a dialog may open showing messages from various package installations. Click Close, and close the package manager.

I generally reboot at this point. Perhaps old habits?  ;]

AVR32 Tools

Download and Uncompress buildroot

Download the AVR32 Buildroot of your choice - I used 2.2.1 because it supports AC97 audio, the 2.3.0 does not. I may change this later, and in reading some of the documentation on AVRFreaks forums, we may change to buildroot 2008.10 but for now we're using the Atmel 2.2.1 chain.

Here is the Buildroot page at Atmel. It has a lot of good documentation you should read. All of it ...

Download buildroot version 2.2.1 Here.

I use the browser and right click the link above and select 'save link as' to put the tarball in my development directory. Then uncompress it using tar - (all of the command line instructions are executed as root)

Open a terminal I use yakuake, any will do. Find them from the 'PC" menu (start) -> More Applications -> Terminals

Become root

 su
 (provide password)


change to your development directory and untar the download

 tar -xjf buildroot-avr32-v2.2.1.tar.bz2


Build the toolchain and filesystem

Change to the buildroot directory -

 cd buildroot-avr32-v2.2.1

We have to set the AVR32 toolchain up for the NGW100 -

 make atngw100_defconfig
Corrupt Files

Because the 2.2.1 toolchain references a set of help files that got corrupted on the hosting server, one must either download the uncorrupted sources manually, or deselect them in the ncurses type menu configuration editor. See the following forum posts on avrfreaks -

How to deselect the corrupted wiki help with menuconfig and where to download and copy the uncorrupted files

 make menuconfig


scroll down to the Package Selection entry, press Enter and deselect the avr32-wiki-docs entry. Exit the menu system and save the configuration when prompted. This information is all on the avrfreaks wiki anyway.

Now we can download the source, this is important if we really want to develop anything ...

 make source


TODO: add instructions to copy the files from the BSP to the proper location in the buildroot directories.

Compatibility correction for gcc

We need to go ahead and get the corrupted files to edit. The 'make' command begins the build process for the toolchain. It downloads the sources and compiles them -

 make


Take another break. This takes a while but ends with the following error -

 scripts/unifdef.c:209: error: conflicting types for ‘getline’
 /usr/include/stdio.h:651: note: previous declaration of ‘getline’ was here
 make[2]: *** [scripts/unifdef] Error 1
 make[1]: *** [headers_install] Error 2


Unfortunately we need to do this to have the source files in the buildroot directory.

There are several forum posts at AVRFreaks regarding how to correct this error. Two of the approaches seem feasible; one is to downgrade gcc to 4.2, the other is to patch the unifdef.c files. I'm going to try the unifdef.c solution first.

Forum posts for modifying unifdef.c are Here. There are other explanations but this one is short and to the point.

First we need to find exactly where the unifdef.c files ended up, then we need to edit them. In order to find them, we need to update the file database. As root in a terminal window type the following

 updatedb
 locate unifdef.c


Mine ended up being here

 /home/tracy/devel/atmel/buildroot-avr32-v2.2.1/toolchain_build_avr32/linux-2.6.25.10/scripts/unifdef.c
 /usr/src/kernel-devel-2.6.33.5-pclos1.bfs/scripts/unifdef.c


I used kate to edit the files. I installed Kate with the package manager. You can use any editor you'd like, either gui or command line. Search and replace 'getline' with '_getline' in both files. Oddly, it only found it in one of the files and not the other, but after editing it run

 make


again. Take another break, this one took a while too!!

Compile Errors

For me it ran for quite a while and gave another error

 cannot find -lc

I rebooted and ran the sequence make atngw100_defconfig, make menuconfig and edited out the wiki package, ran make source, and ran make again. take another break ...

It failed compilation on a Samba related problem. I ran

 make menuconfig
 make source
 make

again and (yeah, after another hefty break ...) it compiled without errors! Not to figure out the Samba error ...

Desktop Activities

Write the scripts
Flash uboot using atmel flash utility
Flash compiled uboot
Flash compiled filesystem
Burn compiled filesystem to SD
Write Desktop Activities to execute scripts
Flash uboot using atmel flash utility
Flash compiled uboot
Flash compiled filesystem
Burn compiled filesystem to SD

LiveCD

Generate the LiveCD

This part really is simple! All you have to do from a terminal as root

 mylivecd

Thats it! If you really want to be clean, exit your desktop session and create a console login and run the mylivecd command, that way the system is built without all the X server and related processes running.

The problem is that the method above leaves us with a huge ISO file, much larger than can fit on a CD. Working to remove packages and leave room for our system.

If you get the error

 draklive-install is not installed on this system

then go to the package manager and install draklive-install and rerun the mylivecd command. And guess what? You get to take another break!

ISO Images

Provided here will be the ISO images of the LiveCD that I create once I tune up this procedure. Feel free to copy and distribute this to your friends with NGW100's, and encourage them to contribute development to the 147120 Technet Projects!

Basic LiveCD (no scripts or Desktop Activities)

LiveCD for NGW100 generic development

LiveCD for NGW100 + RMT1 expansion board

LiveCD for NGW100 + RMT1 + AD7020-1




By --Technicavolous 06:55, 23 August 2010 (UTC)

Last Updated --Technicavolous 02:58, 24 August 2010 (UTC)

Personal tools