分享好友 维修大全首页 维修大全分类 切换频道

吉日象维修app

怎么制作系统文件(linux制作根文件系统的必要步骤)

2023-11-16520

一、根文件系统预备知识

目录 内容

bin 存放所有用户都可以使用的、基本的命令。

sbin 存放的是基本的系统命令,它们用于启动系统、修复系统等。

usr 里面存放的是共享、只读的程序和数据。

proc 这是个空目录,常作为proc文件系统的挂载点。

dev 该目录存放设备文件和其它特殊文件。

etc 存放系统配置文件,包括启动文件。

lib 存放共享库和可加载块(即驱动程序),共享库用于启动系统、运行根文件系统中的可执行程序。

boot 引导加载程序使用的静态文件

home 用户主目录,包括供服务账号锁使用的主目录,如FTP

mnt 用于临时挂接某个文件系统的挂接点,通常是空目录。也可以在里面创建空的子目录。

opt 给主机额外安装软件所摆放的目录。

root root用户的主目录

tmp 存放临时文件,通常是空目录。

var 存放可变的数据。

1、建立根文件系统目录

#!/bin/shecho "------Create rootfs directons start...--------"mkdir rootfscd rootfsecho "--------Create root,dev....----------"mkdir root dev etc boot tmp var sys proc lib mnt homemkdir etc/init.d etc/rc.d etc/sysconfigmkdir 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 3 mkdir 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---------"

2、建立动态链接库

cd /mnt/hgfs/sharetar –zxvf root_qtopia.tgz –C /opt/studyarmcp –rfd /opt/studyarm/root_qtopia/lib/* /opt/studyarm/rootfs/lib/*

3、交叉编译Bosybox

1、解压busybox

cd /mnt/hgfs/sharetar –zxvf busybox-1.13.3.tar.tgz –C /opt/studyarm
cd /opt/studyarm/busybox-1.13.3
CROSS_COMPILE ?=arm-linux-   //第164行ARCH ?=arm //第189行

更多linux内核视频教程文档资料免费领取后台私信【内核】自行获取.

怎么制作系统文件(linux制作根文件系统的必要步骤)(1)

Linux内核源码/内存调优/文件系统/进程管理/设备驱动/网络协议栈-学习视频教程-腾讯课堂

4、配置busybox

(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 readableBuild Options--->     [*] Build BusyBox as a static binary(no shared libs)[*] Build with Large File Support(for accessing files>2GB)Installation Options->[]Don’t use /usrApplets links (as soft-links) --->(./_install) BusyBox installation prefixBusybox 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下设备类型的支持

Linux System Utilities  --->                   [*]Support /etc/mdev.conf             [*]Support command execution at device addition/removal

5、编译busybox

编译busybox到指定目录: cd /opt/studyarm/busybox-1.13.3 make CONFIG_PREFIX=/opt/studyarm/rootfs install 在rootfs目录下会生成目录bin、sbin、usr和文件linuxrc的内容。

  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

6、etc/init.d/rcS文件:

#!/bin/shPATH=/sbin:/bin:/usr/sbin:/usr/binrunlevel=Sprevlevel=Numask 022export PATH runlevel prevlevelecho "----------munt all----------------"mount -aecho /sbin/mdev>/proc/sys/kernel/hotplugmdev -secho "***********************************************"echo "****************Studying ARM*********************"echo "Kernel version:linux-2.6.29.1"echo "Student:Feng dong rui"echo "Date:2009.07.15"echo "***********************************************"/bin/hostname -F /etc/sysconfig/HOSTNAME
Chmod +x rcS

7、etc/fstab文件:

#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

8、etc/profile文件:

#Ash profile#vim:syntax=sh#No core file by defaults#ulimit -S -c 0>/dev/null 2>&1USER="id -un"LOGNAME=$USERPS1='[u@h=W]#'PATH=$PATHHOSTNAME='/bin/hostname'export USER LOGNAME PS1 PATH
cd /mnt/hgfs/sharetar –zxvf mkyaffs2image.tgz –C /

二、启动系统

VIVI version 0.1.4 (root@capcross) (gcc version 2.95.3 20010315 (release)) #0.1.4 Mon Oct 27 10:18:15 CST 2008MMU table base address = 0x33DFC000Succeed memory mapping.DIVN_UPLL0MPLLVal [M:7fh,P:2h,S:1h]CLKDIVN:5h+---------------------------------------------+| S3C2440A USB Downloader ver R0.03 2004 Jan  |+---------------------------------------------+USB: IN_ENDPOINT:1 OUT_ENDPOINT:3FORMAT: <ADDR(DATA):4>+<SIZE(n+10):4>+<data:n>+<CS:2>NOTE: Power off/on or press the reset button for 1 sec      in order to get a valid USB device address.NAND device: Manufacture ID: 0xec, Chip ID: 0x76 (Samsung K9D1208V0M)Found saved vivi parameters.Press Return to start the LINUX/Wince now, any other key for viviCopy linux kernel from 0x00050000 to 0x30008000, size = 0x00200000 ... donezImage magic = 0x016f2818Setup linux parameters at 0x30000100linux command line is: "noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0"MACH_TYPE = 362NOW, Booting Linux......Uncompressing Linux.......................................................................................................................... done, booting the kernel.Linux version 2.6.29.1 (root@localhost.localdomain) (gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72) ) #8 Sat Jul 18 10:37:22 CST 2009CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177CPU: VIVT data cache, VIVT instruction cacheMachine: Study-S3C2440ATAG_INITRD is deprecated; please update your bootloader.Memory policy: ECC disabled, Data cache writebackCPU S3C2440A (id 0x32440001)S3C24XX Clocks, (c) 2004 Simtec ElectronicsS3C244X: core 405.000 MHz, memory 101.250 MHz, peripheral 50.625 MHzCLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL onBuilt 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256Kernel command line: noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0irq: clearing pending status 02000000irq: clearing subpending status 00000002PID hash table entries: 256 (order: 8, 1024 bytes)Console: colour dummy device 80x30console [ttySAC0] enabledDentry cache hash table entries: 8192 (order: 3, 32768 bytes)Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)Memory: 64MB = 64MB totalMemory: 60876KB available (3536K code, 293K data, 136K init)Calibrating delay loop... 201.93 BogoMIPS (lpj=504832)Mount-cache hash table entries: 512CPU: Testing write buffer coherency: oknet_namespace: 296 bytesNET: Registered protocol family 16S3C2410 Power Management, (c) 2004 Simtec ElectronicsS3C2440: Initialising architectureS3C2440: IRQ SupportS3C24XX DMA Driver, (c) 2003-2004,2006 Simtec ElectronicsDMA channel 0 at c4808000, irq 33DMA channel 1 at c4808040, irq 34DMA channel 2 at c4808080, irq 35DMA channel 3 at c48080c0, irq 36S3C244X: Clock Support, DVS offbio: create slab <bio-0> at 0SCSI subsystem initializedusbcore: registered new interface driver usbfsusbcore: registered new interface driver hubusbcore: registered new device driver usbNET: Registered protocol family 2IP route cache hash table entries: 1024 (order: 0, 4096 bytes)TCP established hash table entries: 2048 (order: 2, 16384 bytes)TCP bind hash table entries: 2048 (order: 1, 8192 bytes)TCP: Hash tables configured (established 2048 bind 2048)TCP reno registeredNET: Registered protocol family 1NTFS driver 2.1.29 [Flags: R/O].yaffs Jul 18 2009 10:31:41 Installing. msgmni has been set to 119io scheduler noop registeredio scheduler anticipatory registered (default)io scheduler deadline registeredio scheduler cfq registeredConsole: switching to colour frame buffer device 30x40fb0: s3c2410fb frame buffer devicelp: driver loaded but no devices foundppdev: user-space parallel port driverSerial: 8250/16550 driver, 4 ports, IRQ sharing enableds3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440brd: module loadedloop: module loadeddm9000 Ethernet Driver, V1.31Uniform Multi-Platform E-IDE driveride-gd driver 1.18ide-cd driver 5.00Driver 'sd' needs updating - please use bus_type methodsS3C24XX NAND Driver, (c) 2004 Simtec Electronicss3c2440-nand s3c2440-nand: Tacls=1, 9ns Twrph0=4 39ns, Twrph1=1 9nsNAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit)Scanning device for bad blocksCreating 3 MTD partitions on "NAND 64MiB 3,3V 8-bit":0x000000000000-0x000000030000 : "boot"0x000000050000-0x000000250000 : "kernel"0x000000250000-0x000003ffc000 : "kernel"usbmon: debugfs is not availableohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Drivers3c2410-ohci s3c2410-ohci: S3C24XX OHCIs3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000usb usb1: New USB device found, idVendor=1d6b, idProduct=0001usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1usb usb1: Product: S3C24XX OHCIusb usb1: Manufacturer: Linux 2.6.29.1 ohci_hcdusb usb1: SerialNumber: s3c24xxusb usb1: configuration #1 chosen from 1 choicehub 1-0:1.0: USB hub foundhub 1-0:1.0: 2 ports detectedusbcore: registered new interface driver libusualusbcore: registered new interface driver usbserialUSB Serial support registered for genericusbcore: registered new interface driver usbserial_genericusbserial: USB Serial Driver coreUSB Serial support registered for FTDI USB Serial Deviceusbcore: registered new interface driver ftdi_sioftdi_sio: v1.4.3:USB FTDI Serial Converters DriverUSB Serial support registered for pl2303usbcore: registered new interface driver pl2303pl2303: Prolific PL2303 USB to serial adaptor drivers3c2410_udc: debugfs dir creation failed -19mice: PS/2 mouse device common for all micei2c /dev entries drivers3c2440-i2c s3c2440-i2c: slave address 0x10s3c2440-i2c s3c2440-i2c: bus frequency set to 98 KHzs3c2440-i2c s3c2440-i2c: i2c-0: S3C I2C adapterS3C2410 Watchdog Timer, (c) 2004 Simtec Electronicss3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabledTCP cubic registeredRPC: Registered udp transport module.RPC: Registered tcp transport module.yaffs: dev is 32505858 name is "mtdblock2"yaffs: passed flags ""yaffs: Attempting MTD mount on 31.2, "mtdblock2"yaffs_read_super: isCheckpointed 0VFS: Mounted root (yaffs filesystem) on device 31:2.Freeing init memory: 136K----------munt all----------------***********************************************Kernel version:linux-2.6.29.1USER:BaozhongchaoDate:2009.07.15***********************************************Please press Enter to activate this console. [@MrFeng=W]#lsbin         etc         linuxrc     proc        sys         varboot        home        lost+found  root        tmp         wwwdev         lib         mnt         sbin        usr[@MrFeng=W]#
举报
打赏
打赏主播是什么意思
打赏主播是指观众(用户)在观看网络直播节目时,自愿通过直播平台提供的支付渠道,将一定数额的金钱或虚拟礼物赠送给主播的行为

0评论2025-03-26870

主打是什么意思
“主打” 这个词常见的有以下几种意思:一、在商业、产品领域主要营销、重点推广当我们说某产品是公司的 “主打产品” 时,是指

0评论2025-03-26636

电台路是什么意思
“电台路” 通常是因与电台相关的因素而得名的道路,以下是一些具体例子:上海电台路:位于宝山区顾村镇,呈南北走向,南起宝安

0评论2025-03-26335

打狙的窍门是什么意思
“打狙的窍门” 通常是指在射击游戏或实际射击场景中,使用狙击步枪时能够提高射击准确性、效率和生存能力等的一些技巧和方法。

0评论2025-03-26647

路上的创作原声是什么意思
“路上的创作原声” 通常是指以 “在路上” 的状态、经历、感悟等为主题或灵感来源而创作的原始声音作品,在不同艺术领域有不同

0评论2025-03-26375

打印照片回执是什么意思
打印照片回执是指在完成照片拍摄并经相关系统审核通过后,将记录照片合格信息以及个人身份等相关内容的电子凭证,通过打印机输出

0评论2025-03-26283

棒打鸳鸯是什么意思
“棒打鸳鸯” 是一个汉语成语,意思是用木棒打散一对鸳鸯,比喻拆散恩爱的夫妻或情侣。该成语的来源和用法如下:来源与出处:出

0评论2025-03-26672

主打三棺是什么意思
“主打三棺” 是一种网络用语,用反语的方式讽刺人们没有正常的思维观念和底线。该梗起源于贴吧网友之间的讽刺话语,具体出自抗

0评论2025-03-26220

常用香料是什么意思
常用香料是指在烹饪、食品加工、香水制作、药品生产等领域中经常使用的具有独特香气和味道的物质。它们可以增添风味、改善气味、

0评论2025-03-26963

潮汕话香芋是什么意思
在潮汕话中,“香芋” 通常指的就是芋头。不过,潮汕方言中芋头的发音是 “麦筲”(mài shāo)。芋头在潮汕地区的饮食文化和民

0评论2025-03-26504

关于我们  |  网站留言
(c)2026 吉日象维修app www.mykuaidi.com