Saturday February 25, 2017 11:24:35 UTC
|How to setup a Linux environment on a Linksys NSLU2 (SLUG) that runs completely in flash|
Introduction (In Progress)This document is dedicated to building a Linux-based image for the NSLU2 (also known as SLUG) that runs out of flash using the JFFS2 file system and compression. My reason for building one from scratch instead of using existing images is because I wanted a barebones setup that did not require any additional disk storage devices. I wanted a simple image that includes a kernel with only the features I need and a file system with the packages I need and nothing more.
There is quite a bit involved with building a working image up from the ground-up. I plan to break this document down in multiplie pieces. The document will cover how to setup a file system structure with busybox and uclibc. I will cover how to setup the cross compiler, kernel, libraries, applications, and the Ethernet firmware. I hope to also include a file consisting of a base framework to have something to start with and a built cross-compiler package for simplicity.
My reason for choosing to go with uclibc over glibc is because I was able to get soft-float support to work correctly with uclibc. I spent quite a bit of time working with a glibc-based cross compiler that I built and I was not able to get soft-float support to work with the NSLU2's Intel X-Scale processor for some reason. I had soft-float based options enabled while building the glibc-based toolchain, but floating point support simply did not want to work via the NSLU2.
The NSLU2 only has 8MB of flash to work with. This flash space has to cover the bootloader, kernel, and file system. I used ZLIB and RTIME compression for JFFS2 to increase available space in the file system. The memory and CPU overhead was minimal by enabling compression. With my current running image I have 7.7MB out of 32MB of available memory in use on boot. This leaves some memory for other applications.
As I have the time, I will add new information to this howto.
KernelFor the kernel, I prefer to use the latest available. I have had good success with 18.104.22.168, 22.214.171.124, and 2.6.32-rc. You can grab the latest kernel from ftp.kernel.org. Login as anonymous and cd to /pub/linux/kernel/v2.6. Alternatively, you can grab the latest kernel development source using git:
First time: git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git linux-2.6 Update: cd linux-2.6 git pullThe first thing to do is to untar the kernel to a location of your choosing. The Makefile needs to be updated to use the cross-compiler. The Makefile is located in the top-level directory of the linux kernel source tree. Search for CROSS_COMPILE and set the following values:
ARCH ?= arm CROSS_COMPILE ?= armeb-linux-uclibcgnueabi-The next thing to do is to edit the file arch/arm/tools/mach-types
I swap the following two lines from:
ixdp425 ARCH_IXDP425 IXDP425 245 nslu2 MACH_NSLU2 NSLU2 597to
nslu2 MACH_NSLU2 NSLU2 245 ixdp425 ARCH_IXDP425 IXDP425 597The reason for this is because my NSLU2's send code 245, which by default calls the IXDP425 code. This is the wrong code base and causes certain things like USB and Ethernet support not to work. I spent quite a bit of time in frustration trying to figure out why certain NSLU2 hardware was not working right and why I had to enable IXDP425 code in the kernel base until I came across this. I have had to make this change going all the way up to the latest 2.6.32 kernel.
I have included a copy of my kernel config that I use for my NSLU2 image. To load that configuration file, run the following commands:
wget http://www.linuxforge.net/docs/embedded/files/nslu2/kconfig-2.6.31 mv kconfig-2.6.31 .configThe following commands will let you change the kernel configuration and build the kernel and modules.
make menuconfig make zImage -j4 make modules -j4Replace the 4 after j with however many processors you want to build with.
File SystemThis section will cover some of the various packages including required packages that I have built for my image. With these examples, you should be able to build other packages of your choosing using the cross compiler.
Base file system structure
Building the image using the JFFS2 tools and slugimage
Updating the NSLU2 using upslugUpdating the NSLU2 is fairly simple. The bootloader has a default IP of 192.168.0.1. During the first few seconds of boot, there is the option to telnet into port 9000 of IP address 192.168.0.1. This will present a prompt asking to press CTRL+C to enter the Redboot bootloader. What I normally do is set my Ethernet interface to 192.168.0.2 in Linux and I wait a few seconds. I then telnet into 192.168.0.1:9000 and hit CTRL+C when prompted.
The first step is to enter the command upgrade in the bootloader via the telnet session.
Then on the Linux system, run the followingc command:
./upslug -i eth0 -u slugimage.imgWhere eth0 is the network interface of the Linux system that is assigned the 192.168.0.2 IP and slugimage.img is the name of the image file.
|HOME | CONTACT|