In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces how to migrate linux kernel and yaffs2 file system images with busybox, the content is very detailed, interested friends can refer to, hope to be helpful to you.
First, establish the root file system directory
Go to the / opt/studyarm directory, create a new script file create_rootfs_bash to establish the root file system directory, use the command chmod + x create_rootfs_bash to change the executable permissions of the file, and. / create_rootfs_bash run the script to complete the creation of the root file system directory.
#! / bin/shecho "- Create rootfs directons start...-" mkdir rootfscd rootfsecho "- Create root Dev....- "mkdir root dev etc boot tmp var sys proc lib mnt home usrmkdir etc/init.d etc/rc.d etc/sysconfig mkdir usr/sbin usr/bin usr/lib usr/modulesecho" make node in dev/console dev/null "mknod-m 600 dev/console c 5 1mknod-m 600 dev/null c 1 3mkdir mnt/etc mnt/jffs2 mnt/yaffs mnt/data mnt/tempmkdir var/lib var/lock var/run var/tmpchmod 1777 tmpchmod 1777 var/tmpecho" -make direction done- "
Change the right to use the tmp directory to turn on the sticky bit for the right to use the tmp directory, ensuring that only the user who created it has the right to delete the files created under the tmp directory. Although most embedded systems are single-user, some embedded applications do not necessarily use the permissions of root, so they need to be designed in accordance with the basic provisions of the permission bits of the root file system.
Second, establish a dynamic link library
Cd rootfs/libcp-fr / home/working/arm-linux-gcc/usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/lib/*. /
Copy the corresponding library file under the cross compiler to rootfs/lib
Note: the cross compiler used in this article is: arm-linux-gcc 4.3.2
Third, cross-compile Bosybox
Bosybox is an open source project that follows the GPL v2 protocol. It always optimizes the file size in the writing process, and takes into account the limited system resources (such as memory, etc.). Using Busybox can automatically generate bin, sbin, usr directories and linuxrc files needed by the root file system.
1. Decompress busybox cd / mnt/hgfs/share
Tar-zxvf busybox-1.13.3.tar.tgz-C / opt/studyarm 2, enter the source code, modify the Makefile file: cd / opt/studyarm/busybox-1.13.3 modify: CROSS_COMPILE? = arm-linux- / / line 164 ARCH? = arm/ / line 189 line 3, configure busybox
Enter make menuconfig for configuration
(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- >
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 Universe 2.4 Linux kernels
[*] Support tainted module checking with new kernels
[*] Support for module .aliases file
[*] support for modules.symbols file
(3) configure the support for device types under dev in busybox
There are three ways to create a dev:
Manual creation: when creating the root file system, create the device files to be used in the dev directory. After the system attaches the root file system, you can use the device files in the dev directory. Using the devfs file system: this approach is outdated, with uncertain device mappings, insufficient primary / secondary device numbers, and devfs consumes a lot of memory.
Udev: it is a user program that can dynamically update device files according to the status of hardware devices in the system, including the creation and deletion of device files. Its operation is relatively complex, but it is very flexible.
Mdev is a simplified version of udev that comes with busybox, which is suitable for embedded applications. The utility model has the characteristics of simple use. Its function is to automatically generate the node files required by the driver when the system starts and hot-plugs or dynamically loads the driver. When building the root file system of embedded linux based on busybox, using it is the best choice. The following options will add support for mdev.
Linux System Utilities->
[*] Support / etc/mdev.conf
[*] Support command execution at device addition/removal
4. Compile busybox
Compile busybox to the specified directory: cd / opt/studyarm/busybox-1.13.3
Make CONFIG_PREFIX=/opt/studyarm/rootfs install
The contents of the directories bin, sbin, usr, and the file linuxrc are generated under the rootfs directory.
4. Set up the configuration file under the etc directory
1. Etc/mdev.conf file, which is empty.
2. Copy the passwd, group and shadow files in the host etc directory to the rootfs/etc directory.
3. Create a new file HOSTNAME under the etc/sysconfig directory with the content "MrFeng".
4. Etc/inittab file:
# etc/inittab::sysinit:/etc/init.d/rcS::askfirst:-/bin/sh::ctrlaltdel:/sbin/reboot::shutdown:/bin/umount-a-r
5. Etc/init.d/rcS file:
#! / bin/shPATH=/sbin:/bin:/usr/sbin:/usr/binrunlevel=Sprevlevel=Numask 022export PATH runlevel prevlevelecho "- munt all-" mount-aecho / sbin/mdev > / proc/sys/kernel/hotplug mdev-secho "* * "echo" * BENJAMIN ARM* "echo" Kernel version:linux-2.6.32.2 "echo" Student:Benjamin "echo" Date:2015.12.02 "echo" * * * "/ bin/hostname-F / etc/sysconfig/HOSTNAME
Use the following command to change the execution permissions of rcS: Chmod + x rcS
6. Etc/fstab file:
# device mount-point type option dump fsck orderproc / proc proc defaults 0 0none / tmp ramfs defaults 0 0sysfs / sys sysfs defaults 0 0mdev / dev ramfs defaults 0 0
7. Etc/profile file:
# Ash profile#vim:syntax=sh#No core file by defaults#ulimit-S-c 0 > / dev/null 2 > & 1USER = "id-un" LOGNAME=$USERPS1=' [\ u @\ h]\ $'PATH=$PATHHOSTNAME='/bin/hostname'export USER LOGNAME PS1 PATHalias ll= "ls-l" mknod-m 600 / dev/console c 5 1mknod-m 600 / dev/null c 1 3
Fifth, create the root file system image file
Install the yaffs file system authoring tool using the following command: cd / mnt/hgfs/share
Tar-zxvf mkyaffs2image.tgz-C /
In the / opt/studyarm directory, use the command mkyaffs2image rootfs rootfs.img to generate the root file system image file
Note: the mkyaffs2image-128M tool I used
On how to migrate linux kernel and yaffs2 file system images with busybox to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.