[boostrap]debian下为arm创建debian和emdebian文件系统

   2023-02-10 学习力0
核心提示:转自:http://www.cnblogs.com/qiaoqiao2003/p/3738552.htmlDebian系统本身包含对arm的支持,其包含的软件包最多,但是最终的文件系统要大一些。emdebian 是一个非常好用的嵌入式linux操作系统,其基于debian的特点对于熟悉debian系统的人来说很容易就能得心

转自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”可以得到下面的输出信息:

[boostrap]debian下为arm创建debian和emdebian文件系统
(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
[boostrap]debian下为arm创建debian和emdebian文件系统

由于/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

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

[boostrap]debian下为arm创建debian和emdebian文件系统
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!
[boostrap]debian下为arm创建debian和emdebian文件系统

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

 

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

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

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

[boostrap]debian下为arm创建debian和emdebian文件系统
[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
[boostrap]debian下为arm创建debian和emdebian文件系统

然后执行下面的命令下载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,内容如下:

[boostrap]debian下为arm创建debian和emdebian文件系统
[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
[boostrap]debian下为arm创建debian和emdebian文件系统

该文件中需要注意的是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来制作根文件系统

 
反对 0举报 0 评论 0
 

免责声明:本文仅代表作者个人观点,与乐学笔记(本网)无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
    本网站有部分内容均转载自其它媒体,转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责,若因作品内容、知识产权、版权和其他问题,请及时提供相关证明等材料并与我们留言联系,本网站将在规定时间内给予删除等相关处理.

  • 【树莓派】树莓派(Debian)- root用户无法使用SSH登录
    【树莓派】树莓派(Debian)- root用户无法使用
    在树莓派4B上安装了最新的Debian64位系统默认账户密码:pi/raspberryroot/    ------无密码(通过sudo passwd root修改root密码后)问题root修改密码后还是无法登录解决这个系统默认不允许root使用SSH登录登录root用户su 打开配置文件 nano /etc/ssh/sshd_
    03-08
  • windows10环境下安装Linux子系统---debian
    windows10环境下安装Linux子系统---debian
    windows10环境下安装Linux子系统---debian一、前提1、在控制面板-程序-启用与关闭Windows功能中,勾选“适用于Linux的Windows子系统”  2、首先需要创建一个文件夹,用来存放子系统,在需要的位置创建即可,文件夹名任意3、手动下载Windows子系统发行版包,
    03-08
  • Debian 环境安装新版 nginx
    Debian 环境安装新版 nginx
    在 Debian 系统中,我们可以通过 apt-get 安装系统自带的 nginx,这样安装的 nginx 版本略旧。Nginx 官网提供了一些编辑绎好的 deb 安装包,我们只需更新安装源,就可以通过 apt-get 来安装最新的稳定版 Nginx 了。 加载安装源并导入key$ echo deb http://ng
    03-08
  • 使用apt-mirror建立本地debian仓库源
     先介绍一下环境:主机:Win7虚拟机:VirtualBox + Debian7由于软件源的体积比较大,所以我又给虚拟机添加了一块50GB的虚拟硬盘(给虚拟机添加虚拟硬盘的方法参见:http://www.cnblogs.com/pengdonglin137/p/3366589.html , 其中介绍了如何在Vmware和Virtua
    03-08
  • Debian其实有提供附带了各种桌面的安装镜像
    我之前试着装Debian,但它的安装程序我感觉很难用,装上去了之后也有许许多多的问题,比如中文不显示。今天我发现带Live CD的Debian镜像有带了各个桌面的版本,于是我就试着下载KDE版本的Debian。由于我房间的WLAN质量不佳,用500kb/s的速度下了几个小时,那
    02-10
  • Debian镜像使用帮助 Debian镜像下载
    Debian镜像使用帮助 Debian镜像下载
    http://mirrors.163.com/.help/debian.html
    02-10
  • Debian 11 安装Nvidia闭源驱动
    目录通过APT安装Nvidia驱动为Nvidia驱动注册Secure Boot参考文档本人的系统是Debian11,最近一阵子在捣鼓用apt安装英伟达的闭源驱动,同时支持Secure Boot,查阅了Debian Wiki之类的资料之后,在这里整理一下。通过APT安装Nvidia驱动首先,需要确保你的Debian
    02-10
  • Debian时区和时间自动同步
    时区和时间自动同步(1)时间设置及其同步#date  -s 07/26/2005 //2005年7月26日    //修改系统日期时间为当前正确时间#date -s 11:12:00     //11点12分0秒#vim /etc/default/rcS  //设定 BIOS 时间使用 UTC 时区将选项 UTC 的值设定成 yes
    02-10
  • debian/ubuntu系统vi无法删除字符的解决办法
    之前在 Linux 下操作,一直使用的是 Centos 系统,使用 vi 编辑命令一直很顺畅。 最近,入手了一台 debian 操作系统的 vps。在操作 vi 命令时,发现当输入 i 要进行文件编辑时,上下左右的光标无法移动,屏幕上总会出现字符,而且 backspace 只能后退,无法
    02-10
  • Debian安装JAVA环境 debian安装jdk11
     http://blog.csdn.net/gongora/archive/2009/05/15/4190469.aspxDebian官方没有维护专门的Java软件包,所以不能直接用apt-get工具来安装。在Debian系统中要安装Java,有两种方式,一种是用传统方式;一种是Debian方式。1. 传统方式在 sun 下载了最新的 JDK
    02-10
点击排行