?? loading_linux.html
字號:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Authors" content="Olivier DEBICKI, Mohammed Amine SAYA">
<meta name="GENERATOR" content="Mozilla/4.73 [en] (Windows NT 5.0; U) [Netscape]">
<title>Loading linux on the AT91RM9200DK</title>
</head>
<body bgcolor="white">
<center>
<h1> <a NAME="Linux Loader"></a>U-Boot : A Bootloader for AT91RM9200DK </h1>
</center>
<br>
<blockquote>
<blockquote>
<li><a href="#About U-Boot">About U-Boot</a></li>
<li><a href="#Setting the hardware">Setting the hardware</a></li>
<li><a href="#Configuration of the host PC">Configuration of the host PC</a></li>
<li><a href="#build_uimage">Building an uImage from Linux kernel</a></li>
<li><a href="#Configuration of AT91RM9200DK through U-Boot">Configuration of AT91RM9200DK through U-Boot</a></li>
</blockquote>
</blockquote>
<h2><a NAME="About U-Boot"></a>About U-Boot</h2>
<p>U-boot is a boot loader for AT91RM9200DK that can be installed in a boot ROM
and used to configure AT91RM9200DK and to run linux in SDRAM thanks to its ability
to download kernel images and ramdisks. U-Boot offers a user interface through the
AT91RM9200 DBGU serial link. Binaries can be downloaded using either Kermit through
the serial link or through TFTP transfer using the ethernet link.
The development of U-Boot is closely related to Linux: some parts of
the source code originate in the Linux source tree, we have some
header files in common, and special provision has been made to
support booting of Linux images.
<h4>Sample Monitor Commands</h4>
<table>
<tr>
<td>
<dl>
<dd>go</dd>
<dd>run</dd>
<dd>bootm</dd>
<dd>bootp</dd>
<dd>tftpboot</dd>
<dd> </dd>
<dd>loadb</dd>
<dd>printenv</dd>
<dd>setenv</dd>
<dd>saveenv</dd>
</dl>
</td>
<td>
<dl>
<dd>- start application at address 'addr'</dd>
<dd>- run commands in an environment variable</dd>
<dd>- boot application image from memory</dd>
<dd>- boot image via network using BootP/TFTP protocol</dd>
<dd>- boot image via network using TFTP protocol and env variables </dd>
<dd> "ipaddr" and "serverip" (and eventually "gatewayip")</dd>
<dd>- load binary file over serial line (kermit mode)</dd>
<dd>- print environment variables</dd>
<dd>- set environment variables</dd>
<dd>- save environment variables to persistent storage</dd>
</dl>
</td>
</tr>
</table>
<h3>Sample Environment Variables</h3>
<table>
<tr>
<td>
<dl>
<dd>baudrate</dd>
<dd>bootdelay</dd>
<dd>bootcmd</dd>
<dd>bootargs</dd>
<dd>bootfile</dd>
<dd>ipaddr</dd>
<dd>serverip</dd>
<dd>loadaddr</dd>
<dd>ethaddr</dd>
</dl>
</td>
</tr>
</table>
<h2><a NAME="Setting the hardware"></a>Setting the hardware</h2>
<ul>
<li>
Connect the serial port of your PC to the "SERIAL DEBUG PORt" on AT91RM9200DK</li>
<li>
Connect the AT91RM9200DK to the ethernet network</li>
<ul>or</ul>
<li>
Connect the AT91RM9200DK ethernet port to the PC ethernet port using a
crossed link</li>
</ul>
<h2><a NAME="Configuration of the host PC"></a>Configuration of the host PC</h2>
<ul>
<li>Configure the PC serial port to 115200-8N1N</li>
<li>Start a tftp server on the host PC (please refer to the "Tftpserver Install
guide.htm" in the AT91RM9200 CDROM)</li>
<li> Copy the linux kernel image (uImage) to the tftp server defaut directory
</li>
<li>Copy the ramdisk image (ramdisk-rmk7) to the tftp server default directory</li>
</ul>
<h2><a NAME="build_uimage"></a>Building an uImage from Linux kernel</h2>
<p>In order to build an uImage you have to make an uncompressed Image of your kernel, then you have to type the following command when you compile your kernel on your host PC :
<dl>
<dd> [ root @PCLinux ~/linux-2.4.19] <font face="italic" color="gray"><b>make Image</b></font></dd>
</dl>
<p>A <font color="green">"vmlinux"</font> file is created in the kernel source directory (where you compiled ofcourse) which leads to the next step : building the uImage. But before you proceed you need to know where the <font color="green">"mkimage"</font> binary is. You can usually find it in U-Boot source distribution. the operation goes like this :
<dl>
<dd> [ root @PCLinux ~/linux-2.4.19] <font face="italic" color="gray"><b>/usr/local/arm/2.95.3/bin/arm-linux-objcopy
-O binary -S vmlinux linux.bin</b></font></dd>
<dd> [ root @PCLinux ~/linux-2.4.19] <font face="italic" color="gray"><b>gzip
-v9 linux.bin</b></font></dd>
<dd> [ root @PCLinux ~/linux-2.4.19] <font face="italic" color="gray"><b>mkimage
-A arm -O linux -C gzip -a 0x20008000 -e 0x20008000 -d linux.bin.gz uImage</b></font></dd>
<p>At this time a <font color="green">"uImage"</font> file is created in the
current directory. All you have to do now is to copy this file in your TFTP
server directory :<br>
<br>
<dd> [ root @PCLinux ~/linux-2.4.19] <font face="italic" color="gray"><b>cp
uImage /tftpboot/AS/</b></font></dd>
</dl>
<p>Note: You can write a script with all these commands to generate the uImage
file. </p>
<h2><a NAME="Configuration of AT91RM9200DK through U-Boot"></a>Configuration of AT91RM9200DK through U-Boot</h2>
<blockquote>
<blockquote>
<li><a href="#General_Setup">General Setup</a></li>
<li><a href="#Kernel">For Kernel download</a></li>
<li><a href="#LOCAL vs NFS">Local ramdisk vs NFS ramdisk</a></li>
<li><a href="#local_ramdisk">For local ramdisk download</a></li>
<li><a href="#NFS_ramdisk">For NFS ramdisk set up</a></li>
<li><a href="#Kernel boot message">Kernel boot message</a></li>
</blockquote>
</blockquote>
<h3><a NAME="General_Setup"></a>General Setup</h3>
You have to set up some variables like network ones (Ethenet address, IP address...) and bootdelay. It goes like this :
<dl>
<dd> U-Boot > <font face="italic" color="gray"><b>setenv ethaddr 12:34:56:78:99:aa</b></font></dd>
<dd> U-Boot > <font face="italic" color="gray"><b>setenv ipaddr 10.159.245.178</b></font></dd>
<dd> U-Boot > <font face="italic" color="gray"><b>setenv serverip
10.159.245.156</b></font></dd>
<dd> U-Boot > <font face="italic" color="gray"><b>setenv bootdelay 3</b></font></dd>
<dd> U-Boot > <font face="italic" color="gray"><b>saveenv</b></font></dd>
</dl>
<p><font color=red><b>Note :</b></font> The values given to these variables should be set to whatever your system and network, especially for ip and ethernet addresses which should match your network parameters.
<h3><a NAME="Kernel"></a>For Kernel</h3>
Before we hit the command setting let's have a look at how a TFTP server works.
TFTP (Trivial File Transfer Protocol) allows to exchange files across the network,
a TFTPSERVER that is running on a PC(host) handles all TFTP request. Files sought
out are fetched from a root directory already configured in TFTPSERVER config
file. the paths used in the following commands start from the root directory of
TFTPSERVER. The command used to download a kernel image and place it in a specific
SDRAM address is :
<dl>
<dd> U-Boot > <font face="italic" color="gray"><b>tftp 21000000 AS/uImage</b></font></dd>
</dl>
<p>If you want to save this variable and make U-Boot automaticaly fetch the kernel image and turn it on
you have to save it in a "<font color="green">bootcmd</font>", it goes like this :
<dl>
<dd> U-Boot > <font face="italic" color="gray"><b>setenv bootcmd tftp 21000000 AS/uImage\; bootm 21000000</b></font></dd>
<dd> U-Boot > <font face="italic" color="gray"><b>saveenv</b></font></dd>
<dd> U-Boot > <font face="italic" color="gray"><b>run bootcmd</b></font></dd>
</dl>
<h3><a NAME="LOCAL vs NFS"></a>Local ramdisk vs NFS ramdisk</h3>
<p>Before we dive into command details let's take a glance at the difference between a local
ramdisk and a NFS one.<br>
A local ramdisk is ramdisk that is downloaded from a TFTP server
(compressed) and decompressed by the kernel in SDRAM. After this step the board can run
without any connection with outter environment. Everything we create (files and directories)
during this kind of session is automaticaly erased after a reboot. Like a RAM, a SDRAM is
erased after a reboot.<br>
A NFS ramdisk on the other hand is a directory that is located on a remote host (provided that
the board is local host). This directory is mounted on <font color="green">"/"</font> thus the system has its own filesystem.
Unlike local ramdisk, everything created on this kind of session remains in remote directory and isn't
erased after a reboot.
<h3><a NAME="local_ramdisk"></a>For local ramdisk</h3>
In order to download a remote ramdisk and mount it localy on the board you have to set a variable that will lead U-Boot to it.
It goes like this :
<dl>
<dd> U-Boot > <font face="italic" color="gray"><b>setenv bootargs root=/dev/ram rw initrd=0x21100000,6000000 ramdisk_size=15360 console=ttyS0,115200 mem=32M</b></font></dd>
<dd> U-Boot > <font face="italic" color="gray"><b>saveenv</b></font></dd>
<dd> U-Boot > <font face="italic" color="gray"><b>tftp 21100000 AS/ramdisk</b></font></dd>
<dd> U-Boot > <font face="italic" color="gray"><b>tftp 21000000 AS/uImage</b></font></dd>
<dd> U-Boot > <font face="italic" color="gray"><b>bootm 21000000</b></font></dd>
</dl>
As shown before you can make the boot sequence automatic by setting a <font color="green">"bootcmd"</font> variable. It goes like this :
<dl>
<dd> U-Boot > <font face="italic" color="gray"><b>setenv bootcmd tftp 21100000 AS/ramdisk\; tftp 21000000 AS/uImage\; bootm 21000000</b></font></dd>
<dd> U-Boot > <font face="italic" color="gray"><b>saveenv</b></font></dd>
<dd> U-Boot > <font face="italic" color="gray"><b>run bootcmd</b></font></dd>
</dl>
<h3><a NAME="NFS_ramdisk"></a>For NFS ramdisk</h3>
for a NFS mounting ramdisk you need to have a NFS server running from which the board's NFS client can fetch the ramdisk.
First of all you have to make sure that there is a NFS server running on your PC (host) and second of all you have to edit a file called exports located in /etc and add the following entry :
<dl>
<dd><font face="italic" color="gray"><b>/usr/home/amine/RD/rd root(rw,no_root_squash,insecure)</b></font></dd>
<p>Then you need to enter the following command :<br>
<dd>[ root@host ] <font face="italic" color="gray"><b>exportfs -r</b></font></dd>
</dl>
After all this you need to go back to your board and set some variables on U-Boot, it goes like this :
<dl>
<dd> U-Boot > <font face="italic" color="gray"><b>setenv bootargs root=/dev/nfs rw nfsroot=10.159.245.142:/usr/home/amine/RD/rd ip=10.159.245.180 console=ttyS4,115200 mem=32M </b></font></dd>
<dd> U-Boot > <font face="italic" color="gray"><b>saveenv</b></font></dd>
<dd> U-Boot > <font face="italic" color="gray"><b>tftp 21000000 AS/uImage</b></font></dd>
<dd> U-Boot > <font face="italic" color="gray"><b>bootm 21000000</b></font></dd>
<p>In case you want to launch it automaticaly you can set a <font color="green">"bootcmd"</font> variable, it goes like this :<br>
<dd> U-Boot > <font face="italic" color="gray"><b>setenv bootcmd tftp 21000000 AS/uImage\; bootm 21000000</b></font></dd>
<dd> U-Boot > <font face="italic" color="gray"><b>saveenv</b></font></dd>
<dd> U-Boot > <font face="italic" color="gray"><b>run bootcmd</b></font></dd>
</dl>
<h3><a NAME="Kernel boot message"></a>Kernel boot message</h3>
<p>
Linux version 2.4.19-rmk7 (amine@PC0142) (gcc version 2.95.3 20010315 (release)) #40 Wed Jun 25 19:19:12 CEST 2003
<br>CPU: Arm920Tid(wb) revision 0
<br>Machine: ATMEL AT91RM9200
<br>On node 0 totalpages: 8192
<br>zone(0): 8192 pages.
<br>zone(1): 0 pages.
<br>zone(2): 0 pages.
<br>Kernel command line: root=/dev/ram rw initrd=0x21100000,6000000 ramdisk_size=15360 console=ttyS0,115200 mem=32M
<br>Relocating machine vectors to 0xffff0000
<br>Calibrating delay loop... 89.70 BogoMIPS
<br>Memory: 32MB = 32MB total
<br>Memory: 24964KB available (1273K code, 228K data, 52K init)
<br>Dentry cache hash table entries: 4096 (order: 3, 32768 bytes)
<br>Inode cache hash table entries: 2048 (order: 2, 16384 bytes)
<br>Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
<br>Buffer-cache hash table entries: 1024 (order: 0, 4096 bytes)
<br>Page-cache hash table entries: 8192 (order: 3, 32768 bytes)
<br>POSIX conformance testing by UNIFIX
<br>Linux NET4.0 for Linux 2.4
<br>Based upon Swansea University Computer Society NET3.039
<br>Initializing RT netlink socket
<br>Starting kswapd
<br>devfs: v1.12a (20020514) Richard Gooch (rgooch@atnf.csiro.au)
<br>devfs: boot_options: 0x1
<br>JFFS2 version 2.1. (C) 2001 Red Hat, Inc., designed by Axis Communications AB.
<br>i2c-core.o: i2c core module
<br>i2c-dev.o: i2c /dev entries driver module
<br>RAMDISK driver initialized: 16 RAM disks of 15360K size 1024 blocksize
<br>physmap flash device: 200000 at 10000000
<br>CFI: Found no Physically mapped flash device at location zero
<br>Search for id:(06 ea00) interleave(1) type(2)
<br>Search for id:(1f c0) interleave(1) type(2)
<br>Found: Atmel AT49BV16X
<br>Physically mapped flash: Found 1 x16 devices at 0x0 in 16-bit mode
<br>number of JEDEC chips: 1
<br>usb.c: registered new driver hub
<br>ttyS%d0 at MEM 0xfefff200 (irq = 1) is a AT91_SERIAL
<br>ttyS%d1 at MEM 0xfefc4000 (irq = 7) is a AT91_SERIAL
<br>eth0: Link now 100-FullDuplex
<br>eth0: AT91 ethernet at 0xfefbc000 int=24 100-FullDuplex (12:34:56:78:99:aa)
<br>AT91 Watchdog Timer enabled (5 seconds)
<br>AT91 Real Time Clock driver
<br>usb-ohci.c: USB OHCI at membase 0xc2a06000, IRQ 23
<br>usb.c: new USB bus registered, assigned bus number 1
<br>hub.c: USB hub found
<br>hub.c: 2 ports detected
<br>i2c-dev.o: Registered 'AT91RM9200' as minor 0
<br>Found AT91 i2c
<br>AT91 SPI driver loaded
<br>at91_dataflash: Atmel AT45DB642 detected [spi0] (8650752 bytes)
<br>SmartMedia card inserted.
<br>NAND device: Manufacture ID: 0x98, Chip ID: 0xe6 (Toshiba TC58V64AFT/DC)
<br>NET4: Linux TCP/IP 1.0 for NET4.0
<br>IP Protocols: ICMP, UDP, TCP
<br>IP: routing cache hash table of 512 buckets, 4Kbytes
<br>TCP: Hash tables configured (established 2048 bind 2048)
<br>NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
<br>NetWinder Floating Point Emulator V0.95 (c) 1998-1999 Rebel.com
<br>RAMDISK: Compressed image found at block 0
<br>Freeing initrd memory: 5859K
<br>EXT2-fs warning: mounting fs with errors, running e2fsck is recommended
<br>VFS: Mounted root (ext2 filesystem).
<br>Mounted devfs on /dev
<br>Freeing init memory: 52K
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -