6410_Linux系統系統移植 和 驅動載入
阿新 • • 發佈:2019-02-01
echo "-------make direction done---------"
改變了tmp目錄的使用權,讓它開啟 sticky位,為tmp目錄的使用權開啟此位,可確保tmp目錄底下建立的檔案,只有建立它的使用者有權刪除。儘管嵌入式系統多半是單使用者,不過有些嵌入 式應用不一定用root的許可權來執行,因此需要遵照根檔案系統許可權位的基本規定來設計。
2.2.2、建立動態連結庫
動態連結庫直接用友善之臂的,先解壓友善之臂的根檔案包,拷貝lib的內容到新建的根檔案目錄lib內。
cd /mnt/hgfs/share
tar –zxvf root_qtopia.tgz –C /opt/studyarm
cp –rfd /opt/studyarm/root_qtopia/lib/* /opt/studyarm/rootfs/lib/*
2.2.3 交叉編譯Bosybox
Bosybox是一個遵循GPL v2協議的開源專案,它在編寫過程總對檔案大小進行優化,並考慮了系統資源有限(比如記憶體等)的情況,使用Busybox可以自動生成根檔案系統所需的bin、sbin、usr目錄和linuxrc檔案。
1、解壓busybox
cd /mnt/hgfs/share
tar –zxvf busybox-1.13.3.tar.tgz –C /opt/studyarm
2、進入原始碼,修改Makefile檔案:
cd /opt/studyarm/busybox-1.13.3
修改:
CROSS_COMPILE ?=arm-linux- //第164行
ARCH ?=arm //第189行
3、配置busybox
輸入make menuconfig進行配置
(1)、Busybox Settings--->
General Configuration--->
[*] Show verbose applet usage messages
[*] Store applet usage messages in compressed form
[*] Support –install [-s] to install applet links at runtime
[*] Enable locale support(system needs locale for this to work)
[*] Support for –long-options
[*] Use the devpts filesystem for unix98 PTYs
[*] Support writing pidfiles
[*] Runtime SUID/SGID configuration via /etc/busybox.config
[*] Suppress warning message if /etc/busybox.conf is not readable
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
Busybox Library Tuning --->
(6)Minimum password legth
(2)MD5:Trade Bytes for Speed
[*]Fsater /proc scanning code(+100bytes)
[*]Command line editing
(1024)Maximum length of input
[*] vi-style line editing commands
(15) History size
[*] History saving
[*] Tab completion
[*]Fancy shell prompts
(4) Copy buffer size ,in kilobytes
[*]Use ioctl names rather than hex values in error messages
[*]Support infiniband HW
(2)、Linux Module Utilities--->
(/lib/modules)Default directory containing modules
(modules.dep)Default name of modules.dep
[*] 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
(3)、在busybox中配置對dev下裝置型別的支援
dev的建立有三種方法:
手動建立:在製作根檔案系統的時候,就在dev目錄下建立好要使用的裝置檔案,系統掛接根檔案系統後,就可以使用dev目錄下的裝置檔案了。
使用devfs檔案系統:這種方法已經過時,具有不確定的裝置對映、沒有足夠的主/次裝置號、devfs消耗大量的記憶體。
udev:它是個使用者程式,能根據系統中硬體裝置的狀態動態的更新裝置檔案,包括裝置檔案的建立、刪除等。它的操作相對複雜,但靈活性很高
mdev 是busybox自帶的一個簡化版的udev,適合於嵌入式的應用埸合。其具有使用簡單的特點。它的作用,就是在系統啟動和熱插拔或動態載入驅動程式時, 自動產生驅動程式所需的節點檔案。在以busybox為基礎構建嵌入式linux的根檔案系統時,使用它是最優的選擇。下面的選項將增加對mdev的支 持。
Linux System Utilities --->
[*]Support /etc/mdev.conf
[*]Support command execution at device addition/removal
4、 編譯busybox
編譯busybox到指定目錄:
cd /opt/studyarm/busybox-1.13.3
make CONFIG_PREFIX=/opt/studyarm/rootfs install
在rootfs目錄下會生成目錄bin、sbin、usr和檔案linuxrc的內容。
2.2.4 建立etc目錄下的配置檔案
1、etc/mdev.conf檔案,內容為空。
2、拷貝主機etc目錄下的passwd、group、shadow檔案到rootfs/etc目錄下。
3、etc/sysconfig目錄下新建檔案HOSTNAME,內容為”MrFeng”。
4、etc/inittab檔案:
#etc/inittab
::sysinit:/etc/init.d/rcS
::askfirst:-/bin/sh
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a –r
5、etc/init.d/rcS檔案:
#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
runlevel=S
prevlevel=N
umask 022
export PATH runlevel prevlevel
改變了tmp目錄的使用權,讓它開啟 sticky位,為tmp目錄的使用權開啟此位,可確保tmp目錄底下建立的檔案,只有建立它的使用者有權刪除。儘管嵌入式系統多半是單使用者,不過有些嵌入 式應用不一定用root的許可權來執行,因此需要遵照根檔案系統許可權位的基本規定來設計。
2.2.2、建立動態連結庫
動態連結庫直接用友善之臂的,先解壓友善之臂的根檔案包,拷貝lib的內容到新建的根檔案目錄lib內。
cd /mnt/hgfs/share
tar –zxvf root_qtopia.tgz –C /opt/studyarm
cp –rfd /opt/studyarm/root_qtopia/lib/* /opt/studyarm/rootfs/lib/*
2.2.3 交叉編譯Bosybox
Bosybox是一個遵循GPL v2協議的開源專案,它在編寫過程總對檔案大小進行優化,並考慮了系統資源有限(比如記憶體等)的情況,使用Busybox可以自動生成根檔案系統所需的bin、sbin、usr目錄和linuxrc檔案。
1、解壓busybox
cd /mnt/hgfs/share
tar –zxvf busybox-1.13.3.tar.tgz –C /opt/studyarm
2、進入原始碼,修改Makefile檔案:
cd /opt/studyarm/busybox-1.13.3
修改:
CROSS_COMPILE ?=arm-linux- //第164行
ARCH ?=arm //第189行
3、配置busybox
輸入make menuconfig進行配置
(1)、Busybox Settings--->
General Configuration--->
[*] Show verbose applet usage messages
[*] Store applet usage messages in compressed form
[*] Support –install [-s] to install applet links at runtime
[*] Enable locale support(system needs locale for this to work)
[*] Support for –long-options
[*] Use the devpts filesystem for unix98 PTYs
[*] Support writing pidfiles
[*] Runtime SUID/SGID configuration via /etc/busybox.config
[*] Suppress warning message if /etc/busybox.conf is not readable
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
Busybox Library Tuning --->
(6)Minimum password legth
(2)MD5:Trade Bytes for Speed
[*]Fsater /proc scanning code(+100bytes)
[*]Command line editing
(1024)Maximum length of input
[*] vi-style line editing commands
(15) History size
[*] History saving
[*] Tab completion
[*]Fancy shell prompts
(4) Copy buffer size ,in kilobytes
[*]Use ioctl names rather than hex values in error messages
[*]Support infiniband HW
(2)、Linux Module Utilities--->
(/lib/modules)Default directory containing modules
(modules.dep)Default name of modules.dep
[*] 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
(3)、在busybox中配置對dev下裝置型別的支援
dev的建立有三種方法:
手動建立:在製作根檔案系統的時候,就在dev目錄下建立好要使用的裝置檔案,系統掛接根檔案系統後,就可以使用dev目錄下的裝置檔案了。
使用devfs檔案系統:這種方法已經過時,具有不確定的裝置對映、沒有足夠的主/次裝置號、devfs消耗大量的記憶體。
udev:它是個使用者程式,能根據系統中硬體裝置的狀態動態的更新裝置檔案,包括裝置檔案的建立、刪除等。它的操作相對複雜,但靈活性很高
mdev 是busybox自帶的一個簡化版的udev,適合於嵌入式的應用埸合。其具有使用簡單的特點。它的作用,就是在系統啟動和熱插拔或動態載入驅動程式時, 自動產生驅動程式所需的節點檔案。在以busybox為基礎構建嵌入式linux的根檔案系統時,使用它是最優的選擇。下面的選項將增加對mdev的支 持。
Linux System Utilities --->
[*]Support /etc/mdev.conf
[*]Support command execution at device addition/removal
4、 編譯busybox
編譯busybox到指定目錄:
cd /opt/studyarm/busybox-1.13.3
make CONFIG_PREFIX=/opt/studyarm/rootfs install
在rootfs目錄下會生成目錄bin、sbin、usr和檔案linuxrc的內容。
2.2.4 建立etc目錄下的配置檔案
1、etc/mdev.conf檔案,內容為空。
2、拷貝主機etc目錄下的passwd、group、shadow檔案到rootfs/etc目錄下。
3、etc/sysconfig目錄下新建檔案HOSTNAME,內容為”MrFeng”。
4、etc/inittab檔案:
#etc/inittab
::sysinit:/etc/init.d/rcS
::askfirst:-/bin/sh
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a –r
5、etc/init.d/rcS檔案:
#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
runlevel=S
prevlevel=N
umask 022
export PATH runlevel prevlevel