<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > ARM根文件系統(tǒng)制作

          ARM根文件系統(tǒng)制作

          作者: 時(shí)間:2016-11-21 來源:網(wǎng)絡(luò) 收藏
          1.準(zhǔn)備工作

          Busybox源碼:http://www.busybox.net/downloads/

          本文引用地址:http://www.ex-cimer.com/article/201611/319536.htm

          # cd /home/liao

          # tar –jxvf busybox-1.13.3.tar.bz2

          # cd busybox-1.13.3

          2. busybox編譯

          2.1修改Makefile

          CROSS_COMPILE ?=arm-linux-

          ARCH ?=arm

          2.2配置busybox

          # make menuconfig

          Busybox Settings--->

          Build Options--->

          [*] Build BusyBox as a static binary(no shared libs)

          [*] Build with Large File Support(for accessing files>2GB)

          Installation Options->

          []Don’t use /usr

          Applets links (as soft-links) --->

          (./_install) BusyBox installation prefix修改(./_install)為/utu2440/rootfs

          Busybox Library Tuning --->

          [*] vi-style line editing commands

          [*]Fancy shell prompts

          Linux Module Utilities--->

          (/lib/modules)Default directory containing modules

          (modules.dep)Default name of modules.dep

          [ ] simplified modutils

          [*] insmod

          [*] rmmod

          [*] lsmod

          [*] modprobe

          -----options common to multiple modutils

          [ ] support version 2.2/2.4 Linux kernels

          [*]Support tainted module checking with new kernels

          [*]Support for module .aliases file

          [*] support for modules.symbols file

          Linux System Utilities --->

          [*]Support /etc/mdev.conf

          [*]Support command execution at device addition/removal

          # make

          # make install

          編譯出錯(cuò):

          networking/interface.c:818: error: `ARPHRD_INFINIBAND undeclared here (not in a function)

          networking/interface.c:818: error: initializer element is not constant

          networking/interface.c:818: error: (near initialization for `ib_hwtype.type)

          make[1]: *** [networking/interface.o]錯(cuò)誤1

          make: *** [networking]錯(cuò)誤2

          解決:在networking/interface.c文件中添加:

          #define ARPHRD_INFINIBAND 32

          編譯后,在rootfs目錄下會生成目錄bin、sbin、usr和文件linuxrc的內(nèi)容

          3.建立根文件目錄

          前面已經(jīng)生成了bin、sbin等目錄,這里建立一些必要的文件目錄

          # mkdir dev etc lib proc sys mnt tmp var home boot root

          # mkdir usr/lib usr/modules

          # mkdir etc/init.d etc/sysconfig

          # mkdir mnt/etc mnt/jffs2 mnt/data mnt/temp

          # mkdir var/lib var/lock var/run var/tmp

          # chmod 1777 tmp

          # chmod 1777 var/tmp

          # sudo mknod -m 600 dev/console c 5 1

          # sudo mknod -m 600 dev/null c 1 3

          這兩個(gè)設(shè)備節(jié)點(diǎn)需要root用戶建立,具體原因有待研究

          4.建立etc目錄配置文件

          4.1 etc/mdev.conf文件,內(nèi)容可有可無。

          4.2 passwd、group、shadow文件,手動、自動創(chuàng)建

          手動創(chuàng)建是根據(jù)規(guī)范手動編寫這三個(gè)文件內(nèi)容

          # cat passwd

          root:x:0:0:root:/root:/bin/sh

          passwd一共由7個(gè)字段組成,6個(gè)冒號將其隔開。它們的含義分別為:

          1用戶名

          2是否有加密口令,x表示有,不填表示無,采用MD5、DES加密。

          3用戶ID

          4組ID

          5注釋字段

          6登錄目錄

          7所使用的shell程序

          #cat group

          root:x:0:

          group一共由4個(gè)字段組成,3個(gè)冒號將其隔開,它們的含義分別為:

          1組名

          2是否有加密口令,同passwd

          3組ID

          4指向各用戶名指針的數(shù)組

          #cat shadow

          root:$1$3jZ93Mwq$oaeef6lWIuThavs8wD0Wh1:0:0:99999:7:::

          shadow一共由9個(gè)字段組成,8個(gè)冒號將其隔開,它們的含義分別為:

          1用戶名

          2加密后的口令,若為空,表示該用戶不需要口令即可登陸,若為*號,表示該賬號被禁用。上面的表示的是123456加密后的口令。

          3從1970年1月1日至口令最近一次被修改的天數(shù)

          4口令在多少天內(nèi)不能被用戶修改

          5口令在多少天后必須被修改(0為沒有修改過)

          6口令過期多少天后用戶賬號被禁止

          7口令在到期多少天內(nèi)給用戶發(fā)出警告

          8口令自1970年1月1日被禁止的天數(shù)

          9保留域

          自動創(chuàng)建是使用busybox提供的adduser和passwd

          在文件系統(tǒng)正常運(yùn)行起來后,使用adduser命令,使用方法為:

          #adduser root

          然后就會在etc目錄下自動生成passwd、group、shadow文件。但是運(yùn)行該命令后會打印出如下消息:

          passwd:unknown uid 0

          這表示不能為該用戶設(shè)置密碼,此時(shí)你會發(fā)現(xiàn)要passwd命令也無法使用。解決的辦法是,打開passwd文件,其內(nèi)容為:

          root:x:1000:1000:Linux User…:/home/root:/bin/sh

          將用戶ID和組ID均更改為0

          打開group文件,其內(nèi)容為:

          root:x:1000:

          同樣將組ID改為0

          然后,passwd命令就可以正常使用了。這時(shí)為root用戶設(shè)置口令:

          #passwd root

          根據(jù)提示輸入密碼。其中,root用戶登陸后的目錄可以手動進(jìn)行更改。

          4.3 etc/inittab文件:

          ::sysinit:/etc/init.d/rcS

          s3c2410_serial0::askfirst:-/bin/sh

          ::ctrlaltdel:/sbin/reboot

          ::shutdown:/bin/umount -a –r

          4.4 etc/init.d/rcS文件:

          #!/bin/sh

          PATH=/bin:/sbin:/usr/bin:/usr/sbin

          runlevel=S

          prevlevel=N

          umask 022

          export PATH runlevel prevlevel

          echo "---------------mount all--------------"

          mount -a

          echo "---------------Start mdev-------------"

          echo /sbin/mdev>/proc/sys/kernel/hotplug

          mdev -s

          echo "**************************************"

          echo "Kernel version:linux-2.6.24"

          echo "YC2440 rootfs"

          echo "Designer:zechin.liao"

          echo "Date:2010.12.22"

          echo "**************************************"

          /bin/hostname -F /etc/sysconfig/HOSTNAME

          # chmod +x etc/init.d/rcS

          4.5etc/fstab文件:

          #devicemount-pointtypeoptiondumpfackorder

          proc/procprocdefaults00

          none/tmpramfsdefaults00

          sysfs/syssysfsdefaults00

          mdev/devramfsdefaults00

          4.6etc/profile文件:

          #Ash profile

          #vim:syntax=sh

          #No core file by defaults

          #ulimit -S -c 0>/dev/null>&1

          export LD_LIBRARY_PATH=/lib:/usr/lib

          PATH=$PATH

          USER="id -un"

          LOGNAME=$USER

          PS1=[/u@/h /W]#

          HOSTNAME=/bin/hostname

          export USER LOGNAME PS1 PATH

          暫時(shí)使用nfs掛載根文件,后面將介紹制作yaffs、jffs文件。



          關(guān)鍵詞: ARM根文件系

          評論


          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();