I have compiled a Linux Kernel for the NGW100 or any AVR32 device, using buildroot. It includes: Lighttp, SQLite, PHP, Python, and OpenSSH (supports SCP).
This all stemmed from wanting to be able to develop and compile C and C++ programs for the NGW100. At first I tried to compile PHP and Lighttp using the instructions found on Wildan Maulana’s blog entitled Compiling PHP & lighttpd for avr32, but it was less then ideal. After some experimentation and Googling, I discovered that with Buildroot, I could build my own custom Kernel that included all the software that I required.
I first compiled with dropbear SSH which lacks SCP (Secure Copy) and not OpenSSH but soon realized that ProFTPD was a huge pain in the rear, transfers were unreliable (especially to the SD card), so I recompiled with OpenSSH support.
Useful Information:
- Root Password: roota
- HTTP Directory: /www/pages
- Both NICs have DHCP client enabled, and Iptables has been disabled.
Additional Daemons Installed:
- lighttpd
- SQLite
- PHP
- Python
- OpenSSH w/ SCP support
Version Information:
uname -a
Linux ngw.example.net 2.6.27.6.atmel.1 #1 Fri Jan 16 15:21:34 EST 2009 avr32 unknown
Installation Instructions:
UPDATE: I have uploaded the images to a new faster server. I have also compiled the root file system with support for Lighttpd (w/ OpenSSL), PHP (w/ OpenSSL), and SQLite per special request. It also includes OpenSSH and Nano.
With Python and no OpenSSL: avr32-linux.tar.bz2
With OpenSSL Support: avr32-openssl.tar.bz2
You will need to format an SD Card using the ext2 filesystem, which will need to be done from a Linux machine, First unmount the device, then use the following command to format it:
sudo mkfs.ext2 /dev/yourDeviceHere
After this you can just extract the avr32-linux.tar.bz2 archive to the root of the SD Card using the following command (replace /media/sdcard with the mount point of your SD card):
cd /media/sdcard
sudo tar -xvf /path/to/avr32-linux.tar.bz2
Insert the SD Card into your NGW100 and boot it up, using a serial console press the space key to abort the normal boot sequence, then enter the following:
Print your current environment variables:
Uboot> printenv
Make a note of the current settings, that way if you want to boot from the onboard flash memory at some point, you will be able to change your settings back. You can also find the default settings on this page.
No lets change the uBoot environment variables to boot from the SD Card:
Uboot> askenv bootcmd
Please enter 'bootcmd': mmcinit; ext2load mmc 0:1 0x10300000 /uImage; bootm 0x10300000
Uboot> set bootargs 'console=ttyS0 root=/dev/mmcblk0p1 rootwait'
Uboot> saveenv
Now you should be able to press the reset button and boot into Linux, congratulations!
Hi,
I have just tried to boot your Ngw100 kernel on my board. Unfortunately I get this error:-
mmc: Using 2097152 cycles data timeout (DTOR=0×72)
.Unknown c’ – try ‘help’
…………………
** Unable to read “/uImage” from mmc 0:1 **
Wrong Image format for bootm command
ERROR: can’t get kernel image!
U-Boot>
I would appreciate any help you can give to suggest how to correct this.
regards
Patrick
[Reply]
Marcel Manning Reply:
February 19th, 2009 at 2:30 pm
Could be a non-compatible SD Card or the files did not properly copy to the card. I would suggest plugging in the card into your Linux desktop/notebook and browse the SD Card to ensure that uImage exists in the root of the device.
Try changing rootwait in the boot arguments to rootwait=1
If that still does not help try this message board thread:
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=53785
[Reply]
Hi,
Great work, thanks. It’s works very fine. I want to use lighttpd with ssl. In the normal buildroot (www.atmel.no/buildroot) I get run the openssl-part but not lighttpd (like you). Can you show/give me the sources from your buildroot?
regards
Chris
[Reply]
Marcel Manning Reply:
March 18th, 2009 at 12:15 pm
I originally wanted to post my Buildroot sources but after compilation it’s 2.3 GBs and I don’t have enough bandwidth for that. I can recompile with openssl support if you like and upload the Binary to here. If so, let me know if there is anything else you want before I compile. You could also either copy the lighttpd binary from the disk image I provided onto yours or copy your openssh binary onto the image found here.
[Reply]
Chris Reply:
March 19th, 2009 at 9:16 am
It would be fine if you will build it with openssl support.
Today I try to compile the buildroot with php and openssl, after some problems I have success. But I have not get lighttpd in the buildroot running.
Because of this I am glad when you build this with openssl support or/and tell me how you import lightpd in buildroot.
Thanks for your help. Chris
[Reply]
Chris Reply:
March 19th, 2009 at 9:50 am
When you build it, php and lighttpd with openssl support. Thanks
Check back here regularly, as I will post it in the next few days.Update:
I have compiled with OpenSSL support and have updated the article, you can download the new file system here: avr32-openssl.tar.bz2. Let me know if you need anything else, as I can easily add additional packages to this image. Thank you for your interest in Blogic.
[Reply]
Hi Marcel,
Your work is greatly appreciated!
I have been trying to get the right combination of packages to be able to connect up to the aws.amazon.com s3 data storage (http://aws.amazon.com/s3) with my NGW100. All of the examples use PHP, Perl, or Ruby. I have not been able to get a clean buildroot with PHP and the MicroPerl does not seem to work well.
Somehow, I would like to get the process that you used to get a clean buildroot to work with these packages. I have done several buildroots successfully, but not with the combinations of PHP, OpenSSL, lighttpd. I am hoping that this combination will allow me to use some of the solutions on the amazon web site.
The reason that I ask for the process, rather than have you build it for me, is that I have a need for enabling the additional usarts, which involves a patch to the setup.c file. Most folks would not need that, so I hate to ask for something that would not be useful to others.
Thanks for your help and let me know if there is something we can do for you! The NGW100 is a wonderful product and lots of folks are doing very interesting things with it.
Regards,
Andy
[Reply]
Marcel Manning Reply:
April 12th, 2009 at 9:35 pm
Andy,
I did not follow any special instructions, just used the buildroot instructions on the Atmel site. I used Ubuntu 8.10 and waiting a long time for everything to build. If you have a server that I can upload to I can upload my buildroot files (~2 gigs worth) to it. Otherwise let me know the exact problem you are running into. Hope this helps a little.
Thanks,
Marcel
[Reply]
elis Reply:
August 26th, 2009 at 9:03 pm
Could you please post your “.config” file?
[Reply]
I cant compile using buildroot …need 2.6.27.6 patches…can ne 1 help ?
[Reply]
Marcel,
I have not yet managed to build my own ngw100 images, however the images you have provided are quite useful for my purposes.
Question: is it possible to add the gd2 (graphics) library to PHP? That is actually all that I lack at the moment.
Regards, Bert
[Reply]
Hi Marcel,
First i’d like to say a big thank you!
i have managed to get my ngw100 up and running which is quite amazing since i am into linux for 3 days now
so… as a newcomer i wanted to start making a small webserver using joomla as a cms. all went pretty ok until i started the installation and i got an error message regarding the php. apparently it lacks some xml libraries. sadly i have no ideea what libraries this is about.
can You please help me a little bit?
by the way… i wanted to do my own buildroot but i only managed to hang the build process at so many points that i gave it up (and it was 3 am already…).
the error message sound like this:
Fatal error: Call to undefined function xml_parse() in /www/pages/libraries/joomla/utilities/simplexml.php on line 234
[Reply]
Hi Marcel,
Thanks for the images, they work great!
My problem now is that I would like to have support for spi port1 using spidev and it is not intialized in your images. Currently, I was able to modify my own linux image to have support for spi1 but unfortunately I have been trying like crazy to compile php in but just can’t get it going.
I keep getting this error even trying various php versions:
…
zend_execute.lo sapi/cli/php_cli.lo sapi/cli/php_cli_readline.lo sapi/cli/getopt.lo main/internal_functions_cli.lo -lcrypt -lcrypt -lrt -lz -lm -lcrypt -lcrypt -o sapi/cli/php
ext/pdo_sqlite/sqlite/src/os_unix.o: In function `sqlite3UnixRandomSeed’:
os_unix.c:(.text+0×17e): undefined reference to `dlclose’
os_unix.c:(.text+0×18e): undefined reference to `dlsym’
os_unix.c:(.text+0×1a2): undefined reference to `dlopen’
collect2: ld returned 1 exit status
make[1]: *** [sapi/cli/php] Error 1
make[1]: Leaving directory `/home/avr32/buildroot-avr32-v2.3.0/build_avr32/php-5.2.6′
make: *** [/home/avr32/buildroot-avr32-v2.3.0/build_avr32/php-5.2.6/.built] Error 2
Any advice would be greatly appreciated!
Regards,
Sylvio
[Reply]
Marcel Manning Reply:
July 21st, 2009 at 8:02 am
You should not have to compile PHP from source. I have tried this before and got a bunch of errors also. Your best bet is to use buildroot which you can download from here: http://www.atmel.no/buildroot/.
When using buildroot you are presented with a menu when you use the command make menuconfig in which you select the packages you want to build and PHP is in there.
Let me know if this helps.
Marcel
[Reply]
Sylvio LeBlanc Reply:
July 21st, 2009 at 8:15 am
Thanks for the reply.
That is exactly what I did (I think).
I downloaded the Atmel vmware image pre-loaded with buildroot v2.3.0.
1 – I go to the /home/avr32/buildroot-avr32-v2.3.0/ folder.
2 – make atngw100_defconfig
3 – make menuconfig
4 – I go to the php option and select it. That automatically sets the sqlite option enabled.
5 – make
That’s when I get the error. Actually, at first I got a php-5.2.6 download error. Then I tried downloading manually. (Maybe I download the wrong source tar ball). If you are willing to email me the one you have in your ‘/dl’ folder that would be great or give me some the version and/or link to the php version you are using to get it to work.
I also tried a bunch of different versions by editing it in the php*.mk (not sure of exact file name) from the packages/php folder. I got php-5.2.8 to dowload when make runs but get the same type of error.
Please let me know if this is basically the steps you did to get it to work. If so, I will try re-downloading the buildroot and trying again from scratch.
Thanks in advance!
Cheers,
Sylvio
[Reply]
Marcel Manning Reply:
July 21st, 2009 at 8:23 am
I am emailing you the PHP binary as I am writing this(its a hair under 10mb). Let me know if this helps with your problem, or if you still get the same error.
Thanks,
Marcel
Sylvio LeBlanc Reply:
July 22nd, 2009 at 8:17 am
Hi Marcel,
I am still looking @ updating my glibc (I’m new at this linux) to see if it will fix my dlopen problems.
In the mean time, I was able to accomplish my goal by doing a hybrid of your image and mine. If I used your file structure on my SDCard and my own uImage with the changes I made to the kernel, I get your php and my spi initialization. I’m not quite sure how and why it works
but I thought of giving it a try and it works.
Thanks again!
Cheers,
Sylvio
Marcel Manning Reply:
July 22nd, 2009 at 9:40 am
Glad you got it working.
Regards,
Marcel
Marcel, do you have any information on what is the maximum size of SD card supported by the NGW100? What card are you using (brand and size)?
Thanks.
[Reply]
Marcel Manning Reply:
September 24th, 2009 at 9:22 am
Martin,
I do not have the NGW100 in front of me but I believe I was using a 256MB Card. It’s a pretty old card. Here is a post regarding SD Card sizes http://8515.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=505343
[Reply]
Martin Reply:
September 24th, 2009 at 6:52 pm
Thanks a lot for your quick reply! That post answered my question. The board only supports cards below 4GB, that is, non-SDHC cards.
[Reply]
Thanks,
I too am new to Linux. While doing an update to my NGW100, following ATMELs directions, I bricked the unit. Fortunately my company has the JTAG MKII so I at least got U-Boot back up and running. Getting the root to boot from my MMC was a different story. Literally I searched dozens of sites and followed their directions without success. Thanks again.
Mike Trethowan.
[Reply]
Hi,
I plan to devellop application in Python.
Thanks for your Nice work.
Can you add more Python lib i need for example PYSERAL
Thanks
Georges
[Reply]
You dind’t compile the GPIO driver into yout kernel, right? Cause I can’t set an output pin by following the instructions given here: http://www.atmel.com/dyn/resources/prod_documents/doc32073.pdf
and here
http://www.avrfreaks.net/wiki/index.php/Documentation:NGW/NGW100_Switched_Input
When using the kernel provided with the board everything worked fine.
[Reply]
Hi, first of all thank you for your compile for avr32.
Can you help me installing samba or FTP service inside the image…
I tried to install php and lighttpd, I campiled it but when I start linux and I want to check the version of php an lighttpd it say
php -v
/bin/sh: php: not found
an the same with lighttpd and nano
and the daemon didn’t star.. when i compile php and lighttpd
But I already compile it. please help me with that…
Can you help me with this problem
PD: Whit your image I tried to mount NFS to shared that it is on this page but I have a proble with the server name..
Tank you in advance…. my email is robertino97@hotmail.com for advice..
[Reply]
@Patrick: For the ‘Unable to read “/boot/uImage”‘ error, you need to format the SD card with 128 byte inodes. Newer versions of ext2 will by default create 256 byte inodes which u-boot (even the latest ones from Atmel) doesn’t support. Just add -I 128 to the mkfs command:
sudo mkfs.ext2 -I 128 /dev/yourDeviceHere
[Reply]