?? ramdisk.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.78 [en] (X11; U; Linux 2.4.7-10 i686) [Netscape]">
<title>Compiling AT91RM9200DK Linux Kernel</title>
<!-- saved from url=(0022)http://internet.e-mail -->
</head>
<body bgcolor="#FFFFFF">
<center>
<h1>
<hr WIDTH="100%"><a NAME="Building AT91RM9200DK"></a>Creating a Ramdisk
and cross-compiling some tools for Linux on ARM</h1></center>
<hr WIDTH="100%">
<br>This paper gives a set of instructions that can help you create your
own Ramdisk, cross-compile and install some tools for Linux on ARM:
<blockquote>
<blockquote>
<li><a href="#Create a RamDisk">Create a RamDisk</a></li>
<li><a href="#Cross-compiling busybox">Cross-compiling busybox</a></li>
<li><a href="#Cross-compiling samba">Cross-compiling samba</a></li>
<li><a href="#Getting Apache">Getting Apache</a></li>
<li><a href="#Installing RPM packages">Installing RPM packages</a></li>
<li><a href="#Setting up the network interfaces">Setting up the network interfaces</a></li>
<li><a href="#Installing mingetty">Installing mingetty</a></li>
</blockquote>
</blockquote>
<b><i>Notes:</i></b>
<br>
<ul>
<li>
"bash$" and "bash#" are shell prompts, not commands to be typed.</li>
<li>
"host" means the machine you are building the ARM kernel on.</li>
<li>
"target" means the machine you are building the ARM kernel for.</li>
</ul>
<h2>
<a NAME="Create a RamDisk"></a>Create a RamDisk</h2>
The commands that allow to create your own RamDisk are the following :
<p>
bash$ dd if=/dev/zero of=your_ramdisk bs=1k count=$SIZE
// this command creates a block in your storage space whose size is 1kbyte*$SIZE.
<br>
// the block will look like /dev/zero which means that it will a file full
of zeros.
<br>
bash$ mke2fs -vm0 your_ramdisk $SIZE
// this command transforms your file "your_ramdisk" into a filesystem
whose size is
<br>
// $SIZE.
<br>At this time we created a virtual disk partition called "your_ramdisk"
that can be mounted. but before doing that, we need to create a directory
where
the partition is going to be mounted.
<br>to achieve this task you need to log in as root on your host machine
:
<p>
bash$ su
<br>
Password :
<br>
bash$ mkdir /mnt/your_ramdisk_directory
<br>
bash$ mount -o loop your_ramdisk /mnt/your_ramdisk_directory
<p>Now "your_ramdisk" is mounted and you can access it like this :
<p>
bash$ cd /mnt/your_ramdisk_directory
<p>The ramdisk is created and ready to be userd. but the problem is that
we can't do anything with it because it is empty, and for a normal use
we need the basic binaries that usually reside
<br>in the /bin, /sbin, /usr/bin and /usr/sbin directories in a regular
Linux distribution. Two solutions can be considered in this kind of situation.
either you cross-compile all the commands' code source
<br>or you download a ready-to-use, ARM-specific ramdisk from the web and
copy its content in your mounted ramdisk. we chose the second solution
because it 's more easy and will save a lot of time and effort.
<p>Eventhough your ramdisk contains now all the basic binaries that you
need for a basic use we are going to need to add other cross-compiled binaries
like busybox, apache,
<br>samba and QTEmbedded.
<p>You can modify your ramdisk by following these steps :
<p>
bash$ mount -o loop ramdisk /mnt/your_ramdisk_directory
<br>
bash$ cd /mnt/your_ramdisk_directory
<br>
bash$ do_whatever_you_want (create directories, files ...)
<br>
bash$ cd where_your_ramdisk_file_is
<br>
bash$ umount /mnt/your_ramdisk_directory
<br>
bash$ gzip -c -v9 ramdisk > /tftpboot/ramdisk
<h2><a NAME="Cross-compiling busybox"></a>Cross-compiling busybox</h2>
First of all you need to fetch busybox from the web at this url : <a href="http://www.busybox.net/downloads">http://www.busybox.net/downloads</a>
<br>Always pick the latest release. you also need to have linux-arm tools
like arm-linux-gcc, arm-linux-g++ compilers and libraries to perform the
cross-compilation. In my case
<br>I put them in /usr/local./arm.
<p>
bash$ cd busybox-xx
// change your directory to the busybox source directory
<br>
bash$ make CROSS=arm-linux- LIBCDIR=/usr/local/arm/2.95.3
LIBRARIES=/usr/local/arm/2.95.3/arm-linux/lib/libc.a -lgcc GCCINCDIR=/usr/local/arm/2.95.3/arm-linux/include
<br>
CROSS_CFLAGS+=-I$(LIBCDIR)/lib/gcc-lib/arm-linux/2.95.3/include -I$(GCCINCDIR)
PREFIX=/home/user/usr/local/busybox
<br>
bash$ make install
<p>All busybox binaries and libs will be installed in /home/user/usr/local/busybox.
don't try to run them on your host machine because they are meant to run
on a ARM architecture.
<br>you can copy all useful busybox binaries and librairies in your built
ramdisk. I assume that your ramdisk is already mounted :
<p>
bash$ cp -a /home/user/usr/local/busybox/bin/* /mnt/ramdisk-as/bin/*
<br>
bash$ cp -a /home/user/usr/local/busybox/sbin/* /mnt/ramdisk-as/sbin/*
<br>
bash$ cp -a /home/user/usr/local/busybox/usr/sbin/* /mnt/ramdisk-as/usr/sbin/*
<br>
bash$ cp -a /home/user/usr/local/busybox/usr/bin/* /mnt/ramdisk-as/usr/bin/*
<br>
<h2>
<a NAME="Cross-compiling samba"></a>Cross-compiling samba</h2>
The cross-compiling of samba looks pretty much like that of busybox. it
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -