Buildroot Patching
AVR32 websites
Building avr32 on Ubunt:
http://www.yagarto.de/howto/avr32ngw100/index.html
TG notes, from Atmel:
Buildroot is a script system that heavily depends on a Linux® system. It is highly recommended that users either run a native Linux installation or run Linux with a virtual machine when running other operating systems.
From doc32062:
List of requirements for the build machine
- C compiler (GCC)
- C++ compiler (for Qtopia® (G++))
- GNU make
- sed
- bison
- flex
- autoconf
- ncurses library (development install)
- zlib library (development install)
- libacl library (development install)
- lzo library (development install)
Buildroot has a well defined structure of directories. From a fresh extraction of the tarball, Buildroot will look like:
- Config.in
- .defconfig
- docs/
- Makefile
- package/
- project/
- target/
- TODO
- toolchain/
After a successful build there will be 6 extra directories in the base directory of Buildroot:
- binaries/
- build_avr32_nofpu/
- include/
- project_build_avr32_nofpu/
- src/
- toolchain_build_avr32_nofpu/
From AVR Freaks Forum:
What I learned was that if you plan to do significant and exploratory kernel modification, buildroot is probably not what you want. But if you need to make a small change (such as adding support for more serial ports), buildroot will probably suffice.
As was mentioned in the above URL, you will find it easiest to patch setup.c using quilt. I present it here in a more general and complete form:
- Install quilt
- cd into the kernel source directory (e.g., <buildroot>/project_build_avr32/<projectname>/linux-2.6.nn.nn)
- Run “quilt new enable-two-usarts.patch”
- Run “quilt edit arch/avr32/boards/<board_name>/setup.c” and make the changes you need.
- Run “quilt refresh”
- cp patches/enable-two-usarts.patch <buildroot>/target/device/Atmel/<board_config_name>/kernel-patches/linux-2.6.nn.nn-<patch_number>, where patch_number is any number like “01”.
- cd to top of buildroot directory
- Run make
To make this work for me, I had to first delete the <buildroot>/project_build_avr32/<projectname> directory, but I think that may have been because I had left it in a mess after previously trying to do this the wrong way.
From another thread:
You can also just delete the .unpacked and .configured files inside project_build_avr32_nofpu/project/linux-2.6.xx
Place your patch inside target/device/Atmel/<your_board>/kernel-patches. Make sure that the filename starts with linux-2.6.xx-<patch order>. Then run make. I'm starting to become a bit of a buildroot maniac now Smile
Patch to Enable Multiple UARTS
Code:
Index: linux-2.6.25.10/arch/avr32/boards/atngw100/setup.c =================================================================== --- linux-2.6.25.10.orig/arch/avr32/boards/atngw100/setup.c +++ linux-2.6.25.10/arch/avr32/boards/atngw100/setup.c @@ -112,6 +112,8 @@ static void __init set_hw_addr(struct pl void __init setup_board(void) { at32_map_usart(1, 0); /* USART 1: /dev/ttyS0, DB9 */ +at32_map_usart(0, 1); // usart 0 as /dev/ttyS1 -mjj +at32_map_usart(2, 2); // usart 2 as /dev/ttyS2 -mjj at32_setup_serial_console(0); }
@@ -166,6 +168,8 @@ static int __init atngw100_init(void)
at32_add_system_devices();
at32_add_device_usart(0);
+at32_add_device_usart(1); // add usart1 -mjj +at32_add_device_usart(2); // add usart1 -mjj
set_hw_addr(at32_add_device_eth(0, ð_data[0]));
set_hw_addr(at32_add_device_eth(1, ð_data[1]));