Linux下用Busy Box制作Ramdisk全过程
-------------------------------------------------------------------------------------------------------
//By:yuyongbao
//QQ:673360056
Linux下用Busy Box制作Ramdisk全过程
1 建立根文件系统结构
#mkdir rootfs
#cd rootfs
#mkdir bin dev etc lib proc sbin tmp usr var
#chmod 1777 tmp
#mkdir usr/bin usr/lib usr/sbin
#mkdir var/lib var/lock var/log var/run var/tmp
#chmod 1777 var/tmp
2 准备链接库
#cd ${OBJ_LIB}/lib (${OBJ_LIB}是交叉编译环境的目录)
#for file in libc libcrypt libdl libm \
>libpthread libresolv libutil
>do
>cp $file-*.so /home/fortis/rootfs/lib
>cp -d $file.so.[*0-9] /home/fortis/rootfs/lib
>done
#cp -d ld*.so* /home/fortis/rootfs/lib
3 使用busybox制作系统应用程序
3.1 下载busybox(http://www.busybox.net/)并解压。
3.2 进入解压后的目录,配置Busybox
$make menuconfig
Busybox Settings >
General Configuration >
[*] Support for devfs
Build Options >
[*] Build BusyBox as a static binary (no shared libs)
/* 将busybox编译为静态连接,少了启动时找动态库的麻烦 */
[*] Do you want to build BusyBox with a Cross Compiler?
(/usr/local/arm/3.3.2/bin/armlinux)
Cross Compiler prefix/* 指定交叉编译工具路径 */
Init Utilities >
[*] init
[*] Support reading an inittab file
/* 支持init读取/etc/inittab配置文件,一定要选上 */
Shells >
Choose your default shell (ash) >
/* (X) ash 选中ash,这样生成的时候才会生成bin/sh文件
* 看看我们前头的linuxrc脚本的头一句:
* #!/bin/sh 是由bin/sh来解释执行的
*/
[*] ash
Coreutils >
[*] cp
[*] cat
[*] ls
[*] mkdir
[*] echo (basic SuSv3 version taking no options)
[*] env
[*] mv
[*] pwd
[*] rm
[*] touch
Editors >
[*] vi
Linux System Utilities >
[*] mount
[*] umount
[*] Support loopback mounts
[*] Support for the old /etc/mtab file
Networking Utilities >
[*] inetd
/*
* 支持inetd超级服务器
*/
3.3 编译并安装Busybox
$make TARGET_ARCH=arm CROSS=armlinux\
PREFIX=/home/arm/dev_home/
相关文档:
手头有个ep9315的板,今天突然想起跑一下adsl上网。晚上回来就开始搞。
从10点到现在,终于能够跑起来。
给大家借鉴一下。
1.编译内核,把ppp的那些选项选上。 (我用2.6.8.1的kernel,cirrus 的patch)
2.libpcap-0.9.1 这个包是pppd需要的。
./configure CC=arm-linux-gcc CFLAGS=-msoft-float --target=arm-linu ......
Linux启动时,第一个必须挂载的是根文件系统;若系统不能从指定设备上挂载根文件系统,则系统会出错而退出启动。之后可以自动或手动挂载其他的文件系统。因此,一个系统中可以同时存在不同的文件系统。不同的文件系统类型有不同的特点,因而根据存储设备的硬件特性、系统需求等有不同 ......
Linux下高并发的Squid服务器,TCP TIME_WAIT套接字数量经常达到两、三万,服务器很容易被拖死。通过修改Linux内核参数,可以减少Squid服务器的TIME_WAIT套接字数量。
vi /etc/sysctl.conf
增加以下几行:
引用
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_syncookie ......
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <stdio.h>
#include <string>
#include <iostream>
#include <cstring>
using namespace std;
void peek_interfaces(int ......
#!/bin/bash
while getopts "ab:cd:" Option
# b and d take arguments
#
do
case $Option in
a) echo -e "a = $OPTIND";;
b) echo -e "b = $OPTIND $OPTARG";;
c) echo -e "c = $OPTIND";;
d) echo -e "d = $OPTIND $OPTARG";;
esac
done
shift $(($OPTIND - 1)) ......