---------------------------

This README describes how this buildroot system was set up to compile
a toolchain, kernel, filesystem for the Auger PC board (Voipac PXA270).
The configuration is set up for the 256MB RAM version.

WARNING: this is not a fun process.  If you can simply use an existing
build directory, do so.  If you can avoid using a new buildroot version, do
so.

These instructions are based on buildroot v2010.05 and a 2.6.27 kernel.

Note: make sure the glibc version on whatever system you build this on is
compatible with the other machines you want to be able to compile on.  For
example, Ubuntu 9.04 has a newer glibc than SL 5.2, so the compiler
toolchain built on the former will not run on the latter.  

This version is updated for the vpac2 PXA270M board with OneNAND flash, and
for 2.6.27.48 patches.

John Kelley, October 2010
j.kelley@astro.ru.nl

---------------------------

- FIX ME these instructions are probably incomplete 

- Make sure necessary packages are installed.  On a clean Ubuntu 8.04 
  install, I had to add:

    sudo aptitude install g++ libncurses5-dev bison flex \
      gettext patch texinfo zlib1g-dev liblzo2-dev

- Set up environment variables to point to download directory:
  
    % setenv BUILDROOT_DL_DIR ~/Documents/AERA/digi/buildroot/dl_dir

- Copy config directory over (BUILDROOT_LOCAL support is broken)

    % cd <buildroot dir>; mkdir local
    % cp -r ../local_dir_vpac2/voipac_pxa270_2m256 local/

- Get configuration files from existing config directory

    % make menuconfig  <exit but don't save config>
    % make BOARD=voipac_pxa270_2m256 getconfig

- First run at make:

    % make

- Make fails with [install_headers] error.  Copy hacked install_header.sh
  file over (magical print statement fix):

    % cp local/voipac_pxa270_2m256/install_headers.sh \ 
       toolchain_build_arm/uClibc-0.9.30/extra/scripts/

- Copy hacked Makefile.in, which specifies patches are in $DL_DIR (like
  config suggests): 

    % cp local/voipac_pxa270/Makefile.in.advanced \
       target/linux

- Copy modified skeleton files:

    % cp local/voipac_pxa270_2m256/inittab target/generic/target_skeleton/etc/        
    % cp local/voipac_pxa270_2m256/issue target/generic/target_skeleton/etc/ 
    % cp local/voipac_pxa270_2m256/TZ target/generic/target_skeleton/etc/ 

- Delete the project build directory:

    % rm -rf project_build_dir/voipac_pxa270_2m256

- Restart make (this will take a long time):

    % make

- Kernel image and filesystem should be in binaries/voipac_pxa270_2m256/.  Check
  that the zImage is no larger than 1310720 bytes.

- At this point the zImage and filesystem (tarball) are ready to
  be uploaded to the board. 

NOTE: 

- To rebuild after making configuration changes, do not use "make clean" or
  the like.  Instead, remove the target and binary directories and restart
  make: 

    % rm -rf toolchain_build_arm
    % rm -rf project_build_arm
    % rm -rf binaries
    % make

*------------------------------------------------------------------------*
* My notes on the build process (gory details).  This may be helpful
* if you need to start over with a new buildroot, kernel, etc
*------------------------------------------------------------------------*

For vpac2 update:

- Downloaded buildroot 2010.05 and unpacked.

- Downloaded kernel config and 2.6.27 patches from voipac (256M versions):
    http://www.voipac.com/downloads/pxa/270m/dimm/src/linux/

- Concatenated patches into a "combo" patch

- Merged kernel config with my previous one, which turns off a bunch of
  stuff we don't use.  The main difference in the vpac2 version seems to be
  the UBIFS support in place of JFFS2.

- Started editing buildroot config file:

- Enabled BR2_PACKAGE_NETSNMP in voipac_pxa270.config

- Disabled all JFFS2 stuff and enabled UBIFS.  Concerned about ubifs
  support in 2009.02 buildroot version (perhaps too old).  Started over
  with new buildroot, 2010.05.  

- make menuconfig but didn't save config file.

- make BOARD=x getconfig doesn't work any more?!?!  Hand-copy from local/
  directory to .config, rerun "make menuconfig".  

- Chose option for hand-specified kernel version, chose 2.6.27.  

- Default UBIFS values matched our test board from Voipac.  Turned off
  copying kernel to rootfs, as we don't need it in /boot.  

- Enabled nano and uemacs editors.  

- Same [install_headers] error.  Merged modified script with one in
  output/toolchain/uClibc-0.9.30.3/extra/scripts/install_headers.sh.
  Missing newline at end of file the problem?

- Make failed.  Kernel patch expected to be in dl_dir.  Copied combo patch
  to dl_dir.

- Make failed with undefined cpufreq_frequency table functions.  Changed
  patch to 

 config CPU_FREQ_TABLE
-	tristate
+	def_tristate y

  Removed output/build/linux-2.6.27 and retry make.

- Make failed with hard link attempt by e2fsprogs.  We don't need these,
but they are in the dependency for MTD stuff.  Changed hard link to soft
links in 

     output/build/host-e2fsprogs-1.41.11/lib/*/Makefile

by changing (LN) to (LN_S).  Note that this only fails because I am on a VM
filesystem that doesn't support hard links.

- This didn't work -- too many symlink levels in build.  Tried replacing
(LN) with (CP) in all Makefiles.

*------------------------------------------------------------------------*
For vpac1 build:
*------------------------------------------------------------------------*

- Downloaded latest buildroot release
     http://buildroot.uclibc.org/downloads/buildroot-2009.02.tar.gz

- make oldconfig

- make menuconfig

- make source

- Hand copy busybox config and kernel configs over

- Download Voipac's kernel patches for appropriate kernel version and check
  config path 

- Copy Linux kernel configuration file over

- Make sure locale support is disabled in master configuration
- make uclibc-menuconfig (or make menuconfig inside uClibc directory)
    disable locales here also

- Have to have "advanced kernel config"
- Removed trailing slashes in toolchain/uClibc/uclibc.mk (see comment);
  maybe not necessary? 

- Added print statements in install_headers.sh which somehow magically
  fixed return code? 

- libcrypt, syslog, xattr support necessary in uclibc

- Add $(DL_DIR) to patch path in target/linux/Makefile.in.advanced

- Hack .config to BR2_TARGET_UBOOT=n

- Kernel binary format zImage in .config

- Hacked .config to point to 2.6.19 kernel; copied config to .; added vpac
  patch to dl/ 

- Add "limits.h" #include to 
  ./project_build_arm/voipac_pxa270/linux-2.6.19/mod/sumversion.c

- Add CONFIG_CPU_FREQ_GOV_ONDEMAND=y to kernel configuration

-*** RESTARTED WITH 2.6.27 KERNEL ***-

- Unpacked clean buildroot directory

- Copy existing .config over 

- make menuconfig and save without changing anything

- Hack .config to BR2_TARGET_UBOOT=n

- make source

- Copied kernel config and busybox configs over to home directory

- Downloaded kernel patches from voipac to dl/

- Copied uclibc menu config over to toolchain_build_arm/uClibc-0.9.30/.config

- Copied toolchain_build_arm/uClibc-0.9.30/extra/scripts/install_headers.sh
  with magical print statement fix  

- Fixed paths in uClibc config

- Add $(DL_DIR) to patch path in target/linux/Makefile.in.advanced

- Cat both voipac kernel patches together in dl/ (including 256M ram one)

- Change FREQ_TABLE patch to
 config CPU_FREQ_TABLE
-	tristate
+	def_tristate y

- Weird error in toolchain_build_arm/mtd_orig/ when building mkfs.jffs2
  Went in and made locally, worked

- Check max size of zImage.dat in binaries (must be < 1310720B)

- To rebuild, have to blow away project_build_arm and binaries

- Edited target/generic/target_skeleton/etc/inittab to start tty on serial port

- Edited target/generic/target_skeleton/etc/issue

- Files saved with "make saveconfig" in ./local/voipac_pxa270, along with
  modified scripts/files referenced above

- Edited target/generic/target_skeleton/etc/TZ to "UTC"

- Turned off PCMCIA stuff in kernel configuration -- FPGA module was
  somehow confusing pccard driver.   

---

