⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ramdisk.html

📁 9200的开发资料:包括uboot
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!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>&nbsp;
<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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
bash$ dd if=/dev/zero of=your_ramdisk bs=1k count=$SIZE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// this command creates a block in your storage space whose size is 1kbyte*$SIZE.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// the block will look like /dev/zero which means that it will a file full
of zeros.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
bash$ mke2fs -vm0 your_ramdisk $SIZE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
//&nbsp; this command transforms your file "your_ramdisk" into a filesystem
whose size is
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
//&nbsp; $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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
bash$ su
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Password :
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
bash$ mkdir /mnt/your_ramdisk_directory
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
bash$ mount -o loop your_ramdisk /mnt/your_ramdisk_directory
<p>Now "your_ramdisk" is mounted and you can access it like this :
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
bash$ mount -o loop ramdisk /mnt/your_ramdisk_directory
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
bash$ cd /mnt/your_ramdisk_directory
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
bash$ do_whatever_you_want (create directories, files ...)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
bash$ cd&nbsp; where_your_ramdisk_file_is
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
bash$ umount /mnt/your_ramdisk_directory
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
bash$ cd busybox-xx&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// change your directory to the busybox source directory
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
bash$ make&nbsp; CROSS=arm-linux-&nbsp; LIBCDIR=/usr/local/arm/2.95.3&nbsp;
LIBRARIES=/usr/local/arm/2.95.3/arm-linux/lib/libc.a -lgcc&nbsp; GCCINCDIR=/usr/local/arm/2.95.3/arm-linux/include
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
CROSS_CFLAGS+=-I$(LIBCDIR)/lib/gcc-lib/arm-linux/2.95.3/include -I$(GCCINCDIR)
PREFIX=/home/user/usr/local/busybox
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
bash$ cp -a&nbsp; /home/user/usr/local/busybox/bin/*&nbsp; /mnt/ramdisk-as/bin/*
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
bash$ cp -a&nbsp; /home/user/usr/local/busybox/sbin/*&nbsp; /mnt/ramdisk-as/sbin/*
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
bash$ cp -a&nbsp; /home/user/usr/local/busybox/usr/sbin/*&nbsp; /mnt/ramdisk-as/usr/sbin/*
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
bash$ cp -a&nbsp; /home/user/usr/local/busybox/usr/bin/*&nbsp; /mnt/ramdisk-as/usr/bin/*
<br>&nbsp;
<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 + -