- Om oss
- Plattformar och lösningar
- Utvecklingsverktyg och arbetsmetodik
Booting SnapGear embedded Linux
2012-02-12Publicerad av Sven-Åke Andersson
We are now ready to install Linux in our LEON3 embedded system. We will use a special version of SnapGear supporting LEON2 and LEON3 which can be downloaded from the Aeroflex Gaisler ftp site.
There are two different versions of the Linux kernel in the Gaisler SnapGear distribution, namely 2.6.x and 2.0.x. The 2.0 version is modified for use with MMU-less LEON systems, it is called micro controller Linux –μCLinux. Version 2.6.x has support for MMU systems only, the kernel is from kernel.org with LEON specific patches and additional drivers mainly for GRLIB hardware. We will use 18.104.22.168 a rather old version but good enough for our needs. For more information about SnapGear Linux read the Snapgear for LEON manual.
Download and install
We will goto the Linux download page.
Install the toolchain
We will download and install the LEON GLibC Cross-compiler (linux-x86 host) from the ftp site:
The installation process for the different toolchains is the same, it is only the names and paths that differ. All toolchains must be installed to /opt and the path to the toolchain binary directory (/opt/sparc-[uc]-linux-3.x.x/bin) added to the shell PATH variable. Here is the result after unpacking the package.
Installing SnapGear Linux 2.6
Download snapgear-2.6-p42.tar.bz2 from the Gaisler ftp site.
Install the SnapGear distribution anywhwere in your home directory by extracting it:
tar -xjf /path/to/dist/snapgear-2.6-p42.tar.bz2
Hardware support in Linux 2.6
Here is a list of GRLIB hardware blocks that are supported in Linux 2.6
- LEON3 SMP
- GRETH 10/100/1000 Ethernet networking support
- SMC91x 10/100 Ethernet networking support
- OpenCores 10/100 Ethernet networking support
- PCI support (GRPCI)
- GRETH over PCI
- ATA DMA and non-DMA (ATACTRL)
- Host USB 1.1 and/or 2.0 (GRUSBHC)
- PS/2 support (GRPS2)
- SVGA Framebuffer (GRVGA)
- Text VGA support (APBVGA)
- I2C support (I2CMST)
- SPI support (SPICTRL)
APBUART and GRTIMER
SnapGear comes with an easy to use graphical interface similar to the Linux kernel's configuration utility. From the GUI it is possible to select processor, Linux version, C library and what applications will be included into the root file system (ROMFS image) accessed by Linux during runtime. It is also possible to configure the boot loader parameters and configure the Linux kernel. The GUI can be launched by doing <make xconfig>.
The main configuration menu will appear. We will leave most of the settings unchanged for the time being, but there are a few things we must configure.
Click the Kernel/Library/Default Selection buttton and select kernel version linux-22.214.171.124. The version 2.6.29 seems to have some build problems. Select the Yes button for <Customize Vendor/User Settings> and go to the < Main Menu> and <Save and Exit>.
Then this window will open. We have to include some applications to make the build process finish without errors. For now we will only include BusyBox. Click the BusyBox button.
Enable the BusyBox application and go to the Main Menu and save and exit.
Fixing a bug
The first time we run make we got the following error message:
After searching the Gaisler support page I came up the following solution. Adding the line: #include <linux/limits.h> in the file: snapgear-2.6-p42/linux-126.96.36.199/scripts/mod/sumversion.c
After configuring the kernel and the applications it is possible to compile and build the SnapGear LEON Linux distribution using the command: make.
If the build is successfull, the images will be placed in the image sub-directory. There are two types of images.
- image.flashbz : PROM image that will first decompress the the kernel and applications into RAM and run everything from there
image.dsu : RAM image suitable for download and excution on target hardware using the DSU, or on the TSIM/GRSIM simulators
Download SnapGear image
We will use GRMON to download and run the image. Here is the command to start GRMON using the USB cable:
grmon-eval -xilusb -nb -u
Here is the command using the ethernet connection (goes much faster):
grmon-eval -eth -ip <ip_address> -nb -u
Load the image.
Hopefully our Linux image will boot.