转自http://www.cnblogs.com/qiaoqiao2003/p/3738552.html

Debian系统本身包含对arm的支持,其包含的软件包最多,但是最终的文件系统要大一些。

emdebian 是一个非常好用的嵌入式linux操作系统,其基于debian的特点对于熟悉debian系统的人来说很容易就能得心应手地进行配置。

emdebian有好几个版本:Grip,Crush,Baked. 关于它们的详细介绍可以查看:http://www.emdebian.org/emdebian/flavours.html

通常为了便于使用,我们选择Grip版本。

debian下有三个工具可以用来创建根文件系统,它们分别是Debootstrap、CDebootstrap和Multistrap,安装这几个软件:

apt-get install debootstrap multistrap

本文中内容主要参考debian网站的CrossDebootstrap

先用Debootstrap制作基于debian根文件系统(详见官方文档):

debootstrap --foreign --arch armel wheezy rootfs http://ftp.debian.org/debian/

会在当前的rootfs下建立一个基本的根文件系统(名字为rootfs),然后将rootfs文件家移到nfs对应文件夹下,并重启nfs:

/etc/init.d/nfs-kernel-server restart

启动mini2440,按任意键进入uboot,按'q'键进入uboot命令行,将bootargs修改成以下内容:

noinitrd root=/dev/nfs rw nfsroot=192.168.211.2:/home/host/nfs/mini2440/rootfs ip=192.168.211.211 console=ttySAC0 init=/bin/bash

重启mini2440,但是无法进入跟文件系统,提示下面的错误:

Warning: unable to open an initial console.

参考http://blog.chinaunix.net/uid-10008293-id-2972298.html ,在根文件系统下创建设备文件console和null:

cd rootfs/dev
mknod -m 660 console c 5 1
mknod -m 660 null c 1 3

然后重启mini2440,就可以进入根文件系统了。

然后在新的根文件系统下进行配置:

 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true  LC_ALL=C LANGUAGE=C LANG=C /debootstrap/debootstrap --second-stage

但是安装base-file是提示出错,查看/debootstrap/debootstrap.log才知道执行rmdir /var/run出错。

用ls命令可以知道该文件夹下存在一个临时文件,将该临时文件删除。然后再次执行上面的命令,但是在安装 mount时提示下面的错误:

dpkg: error processing /var/cache/apt/archives/mount_2.20.1-5.3_armel.deb (--unpack):

然后就开始尝试重新开始安装这些deb包,默认情况下会重试5次才会停止执行。尝试了半天,但是安装过程中的错误很难追踪和修正,

我最终放弃了使用debootstrap制作基于debian的根文件系统.

1.下面用debootstrap来安装基于emdebian的根文件系统(参考文章http://www.linuxidc.com/Linux/2011-11/47804.htm):

步骤跟上面过程类似,先下载deb包:

debootstrap --foreign --arch armel --keyring=/usr/share/keyrings/emdebian-archive-keyring.gpg squeeze rootfs http://www.emdebian.org/grip

安装qemu-user-static包,并将qemu-arm-static拷贝到rootfs下(该工具用于避免chroot出错):

apt-get install qemu-user-static
cp /usr/bin/qemu-arm-static  rootfs/usr/bin

然后安装deb包:

chroot rootfs /bin/bash
/debootstrap/debootstrap --second-stage

安装过程中提示安装dash出错,执行”dpkg -i /var/cache/apt/archives/dash_0.5.5.1-7.4em1_armel.deb”可以得到下面的输出信息:

(Reading database ... 3895 files and directories currently installed.)
Unpacking dash (from .../dash_0.5.5.1-7.4em1_armel.deb) ...
/bin/ln: creating symbolic link `/usr/share/man/man1/sh.1.gz.tmp': No such file or directory
dpkg: error processing /var/cache/apt/archives/dash_0.5.5.1-7.4em1_armel.deb (--install):
subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/dash_0.5.5.1-7.4em1_armel.deb

由于/usr/share/man文件夹不存在,所以无法创建软链接,创建文件夹:

mkdir -p /usr/share/man/man1/

然后再次执行:

/debootstrap/debootstrap --second-stage  

再执行下面的命令进行配置:

echo "deb http://www.emdebian.org/grip/ squeeze main" >> rootfs/etc/apt/sources.list
printf "auto eth0\niface eth0 inet dhcp\n" >> /etc/network/interfaces

然后再将该采用nfs启用根文件系统方式启动mini2440,但是进入bash前有个错误提示:

bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell

这个问题暂时作为遗留问题,有空再来研究。

该文件系统大小在7、80M左右。

2.我下面选择用CDebootsrap(用c语言开发的debootstrap类似工具,比debootstrap快很多)来制作基于debian的根文件系统,执行下面命令:

cdebootstrap --foreign --arch armel wheezy rootfs http://ftp.debian.org/debian/

然后仍然用nfs启动根文件系统(选择和上面一样的bootargs),就能进入刚才制作的根文件系统。

然后用下面命令来完成deb包的解压缩和安装:

/sbin/cdebootstrap-foreign

然后执行下面的命令对所有未配置的deb包进行配置:

PATH=/usr/bin:/bin:/usr/sbin:/sbin dpkg --configure -a

现在基础的一些配置就弄好了,当前rootfs大小在200多M左右。

整个过程非常流畅,没有出现关键性错误导致安装失败的情况发生。

然后在对系统进行配置:

mount -t proc proc /proc
route add default gw 192.168.211.1

然后再根据自己需要对/etc/apt/sources.list进行配置(可参考https://lug.ustc.edu.cn/repogen/

3.接着使用CDebootstrap来制作基于emdebian的跟文件系统,执行下面的命令:

cdebootstrap --foreign --arch armel --keyring=/usr/share/keyrings/emdebian-archive-keyring.gpg squeeze rootfs http://www.emdebian.org/grip

但是显示了下面的错误信息:

P: Retrieving InRelease
P: Validating InRelease
I: Good signature from "Emdebian Archive Signing Key"
P: Parsing InRelease
W: parser_rfc822: Iek! Don't find end of field, it seems to be after the end of the line!
E: Couldn't parse InRelease!

所以后续过程也无法继续下去了。

最后使用multistrap制作根文件系统。

先用multistrap制作基于debian的根文件系统:

创建配置文件,名称为multistrap_debian.conf,内容如下:

[General]
noauth=true
unpack=true
debootstrap=Squeeze
aptsources=Squeeze
arch=armel [Squeeze]
packages=wpasupplicant wireless-tools firmware-ralink busybox netbase net-tools makedev
source=http://ftp.au.debian.org/debian/
keyring=debian-archive-keyring
components=main non-free
suite=squeeze

然后执行下面的命令下载deb包并解压缩:

multistrap -a armel -d rootfs -f multistrap_debian.conf

执行完毕后将qemu-arm-static拷贝到rootfs/usr/bin下

cp /usr/bin/qemu-arm-static  rootfs/usr/bin

然后chroot进入rootfs,进行配置:

chroot rootfs
touch /etc/fstab
mount -t proc proc /proc
dpkg --configure -a

然后在mini2440下设置nfs启动根文件系统,配置与前面配置相同,但会有错误提示(不影响一般使用):

bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell

暂时作为遗留问题,留待解决。

整个文件系统大小在160M左右。

4.最后用multistrap制作基于emdebian的根文件系统。

先创建配置文件,名称为multistrap_emdebian.conf,内容如下:

[General]
noauth=true
unpack=true
debootstrap=Grip
aptsources=Grip [Grip]
# space separated package list
packages=busybox netbase net-tools ifupdown makedev
source=http://www.emdebian.org/grip
suite=squeeze

该文件中需要注意的是suite,suite类型有四种:etch,lenny,squeeze,sid分别对应oldstabe,stable,tesing,sid。

看名字基本能明白含义,只有sid不容易看明白,实际上sid表示滚动更新版本

执行下面命令制作根文件系统:

multistrap -a armel -d rootfs -f multistrap_emdebian.conf

很快就可以下载成功,并自动将deb包解压缩根文件系统下。

将/usr/bin/qemu-arm-static拷贝到rootfs/usr/bin下,然后执行如下命令进行安装后的配置:

chroot rootfs
dpkg --configure -a

在配置过程中需要选择时区,分别选择6(Asia)和65(Shanghai).

重启mini2440,采用nfs启动根文件系统(和本文前面的配置一样),但仍然会有一个错误(不影响一般使用):

bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell

这个问题仍然留待后续再解决。

生成根文件系统大小在50M左右

从前面陈述的根文件系统制作过程可以看到,mutlstrap比较利于扩展,使用也比较方便,所以我倾向于以后采用multistrap来制作根文件系统

[boostrap]debian下为arm创建debian和emdebian文件系统的更多相关文章

  1. debian下为arm开发板创建基于debian或emdebian的根文件系统

    Debian系统本身包含对arm的支持,其包含的软件包最多,但是最终的文件系统要大一些. emdebian 是一个非常好用的嵌入式linux操作系统,其基于debian的特点对于熟悉debian系统的 ...

  2. debian下安装zendframework

    第一步,打开apache的rewrite模块,因为在debian下使用apache必须执行这一步 a2enmod rewrite #激活rewrite模块 /etc/init.d/apache2 re ...

  3. debian下使用gitosis+gitweb搭建SSH认证的git服务器

    搭建完成Git服务器后,需要使用两台机器进行测试,一台机器作为服务器端server,一台服务器作为客户端client.整个系统,需要三个计算机账户,这里假设server端的账户名为git,client ...

  4. Debian下自动备份文件并上传到远程FTP服务器且删除指定日期前的备份Shell脚本

    说明:  1.备份目录/home/osyunwei下面所有的文件到/home/osyunweibak里面,并且保存为osyunwei20120701.tar.gz的压缩文件格式(2012_07_01是 ...

  5. Debian下配置防火墙iptables

    debian下iptables输入命令后即时生效,但重启之后配置就会消失,可用iptables-save快速保存配置,因为Debian上iptables是不会保存规则的,然后在开机自动的时候让ipta ...

  6. debian下使用dynamic printk分析usb网卡驱动

    在<debian下使用dynamic printk分析usb转串口驱动执行流程>中使用了usb转串口,当前例子使用usb网卡分析驱动(dm9601芯片). 仍然需要使能dynamic pr ...

  7. debian下使用dynamic printk分析usb转串口驱动执行流程

    看了一篇文章<debug by printing>,文中提到了多种通过printk来调试驱动的方法,其中最有用的就是"Dynamic debugging". “Dyna ...

  8. debian下为stm32f429i-discovery编译uboot、linux内核和根文件系统

    交叉编译器:arm-uclinuxeabi-2010q1 交叉编译器下载下来后解压,然后将其中bin文件夹路径加入到PATH变量中. 根据<debian下烧写stm32f429I discove ...

  9. debian下使用ft232为stm32f429i-discovery烧写uboot和uImage

    操作系统:debian 软件: openocd  minicom 硬件:  MiniUSB线.stm32f429i-discovery, WaveShare FT232串口模块(可以在淘宝上买到) 关 ...

随机推荐

  1. 转adb Shell root 权限

    永久root带文件 因为开发需要,我经常会用到adb这个工具(Android Debug Bridge),我们都知道adb shell默认是没有root权限的,修改系统文件就很不方便了,adb pus ...

  2. Android 实现透明效果的 Activity

    Android系统提供了将Activity设置为透明的主题:@android:style/Theme.Translucent 该属性同一时候支持隐藏TitleBar和全屏显示. 仅仅须要在Androi ...

  3. 微信/易信公共平台开发(四):公众号调试器 (仿真微信平台,提供PHP源码)

    开发微信/易信公共平台时,调试往往很麻烦,一般只能在手机上边试边改, 或在服务器写日志.当你的服务器脚本有Bug时,手机上没有显示,追查是不容易的.我在开发过程中,编写了一个调试器, 能仿真微信/易信 ...

  4. 基于Python Tornado的在线问答系统

    概述 本项目使用最新的Tornado开发.实现了在线提问,回答,评论等功能.使用到Tornado的generator,长轮询等等技术, 支持MySQL的异步连接. 详细 代码下载:http://www ...

  5. cat /proc/iomem

    在proc目录下有iomem和ioports文件,其主要描述了系统的io内存和io端口资源分布. 对于外设的访问,最终都是通过读写设备上的寄存器实现的,寄存器不外乎:控制寄存器.状态寄存器和数据寄存器 ...

  6. [译]聊聊C#中的泛型的使用(新手勿入) Seaching TreeVIew WPF 可编辑树Ztree的使用(包括对后台数据库的增删改查) 字段和属性的区别 C# 遍历Dictionary并修改其中的Value 学习笔记——异步 程序员常说的「哈希表」是个什么鬼?

    [译]聊聊C#中的泛型的使用(新手勿入)   写在前面 今天忙里偷闲在浏览外文的时候看到一篇讲C#中泛型的使用的文章,因此加上本人的理解以及四级没过的英语水平斗胆给大伙进行了翻译,当然在翻译的过程中发 ...

  7. python --subprocess 范例

    范例1:查看ipconfig -all命令的输出,并将将输出保存到文件tmp.log中: import subprocess handle = open(r'd:\tmp.log','w') p=su ...

  8. unity, stateMachine, change state name

    如图,假设wingsLayer下有个state,叫“New State“,现在想给它改名,则一定要保证当前wingsLayer为选中状态,然后才能在Inspector中可以为其改名.否则若当前选中的不 ...

  9. Object-C中的字符串对象2-可变字符串

    // // main.m // 字符串-可变字符串 // // Created by zhangqs008 on 14-2-13. // Copyright (c) 2014年 zhangqs008. ...

  10. 如何查看Linux操作系统的位数

    如何查看Linux操作系统的位数 1.编程实现: 在程序中返回sizeof(int)的值,返回的结果是操作系统的字节数.若返回4则是32位操作系统,返回8即是64位. 2.2.getconf命令: g ...