📄 2.6.14移植详细过程.rtf
字号:
config DEVFS_DEBUG bool "Debug devfs" depends on DEVFS_FS help If you say Y here, then the /dev file system code will generate debugging messages. See the file for more details. If unsure, say N. b.进入内核主目录 #make menuconfig 进入Device Drivers->Memory Technology Devices(MTD)目录,配置界面如下:<*>Memory Technology Device (MTD) support[ ] Debugging │ │[ ] MTD concatenating support │ │--- MTD partitioning support [ *] RedBoot partition table parsing │ │[ ] Command line partition table parsing │ │[ ] ARM Firmware Suite partition parsing │ │--- User Modules And Translation Layers │ │[*] Direct char device access to MTD devices │ │[*] Caching block device access to MTD devices │ │[ ] FTL (Flash Translation Layer) support │ │[ ] NFTL (NAND Flash Translation Layer) support │ │[ ] INFTL (Inverse NAND Flash Translation Layer) support │ │RAM/ROM/Flash chip drivers ---> │ │Mapping drivers for chip access ---> │ │Self-contained MTD device drivers ---> │ │NAND Flash Device Drivers ---> │ │ [*] NAND Device Support [ ] Verify NAND page writes │ │ <*> NAND Flash support for S3C2410/S3C2440 SoC │ │ [*] S3C2410 NAND driver debug │ │ [ ] S3C2410 NAND Hardware ECC │ │ < > DiskOnChip 2000, Millennium and Millennium Plus (NAND reimplement│ │ [ ] Support for NAND Flash Simulator │ │ 在File systems中选择[*] /dev file system support (OBSOLETE) [*] Automatically mount at boot │ │[*] Debug devfs │ │<*> Kernel automounter support 在File systems->Pseudo filesystems目录里面可以后到devfs的配置选项如下:[*] /proc file system support │ │[*] Virtual memory file system support (former shm fs) │ │[ ] Relayfs file system support 回到File systems->Miscellaneous filesystems目录,配置信息如下: <*> Yet Another Flash Filing System(YAFFS) file system support [*] NAND mtd support │ │ │ │ [ ] yaffsram file system support │ │ │ │ [*] Use ECC functions of the generic MTD-NAND driver │ │ │ │ [*] Use the same ecc byte order as Steven Hill's nand_ecc.c │ │ │ │ [*] Use Linux file caching layer │ │ │ │ [*] Use object header size │ │ │ │ [*] Turn off debug chunk erase check 九、make bzImage等编译完成以后,会生成镜像文件arch/arm/boot/zImage,把这个文件下载到开发板上,就会看到linux2.6的内核启动信息,迈出了linux2.6内核移植的第一步!如果编译出错信息如下所示: LD init/built-in.o LD .tmp_vmlinux1fs/built-in.o(.text+0x60c74): In function `yaffs_readpage_nolock':fs/yaffs/yaffs_fs.c:463: undefined reference to `PAGE_BUG'则找到include/asm-generic/bug.h(这个头文件被include/asm-arm/bug.h包含)第13行后加入:#ifndef HAVE_ARCH_PAGE_BUG#define PAGE_BUG(page) do { \ printk("page BUG for page at %p\n", page); \ BUG(); \} while (0)#endif然后重新用make bzImage编译内核。#make bzImage#cp arch/arm/boot/zImage /root十、用busybox1.2.1制作根文件系统 a.进入busybox1.2.1目录,运行make menuconfig (最关键是要配置交叉编译器的路径)General Configuration应该选的选项Show verbose applet usage messagesRuntime SUID/SGID configuration via /etc/busybox.confBuild BusyBox as a static binary (no shared libs)这个选项是一定要选择的,这样才能把busybox编译成静态链接的可执行文件,运行时才独立于其他函数库。否则必需要其他库文件才能运行,在单一个linux内核不能使他正常工作Installation OptionsDon't use /usr这个选项也一定要选,否则make install 后busybox将安装在原系统的/usr下,这将覆盖掉系统原有的命令b.输入命令:#make#make install上几条命令的结果会在busybox目录下产生一个_intall目录,下面即为根文件系统的一些内容,包括linuxrc,bin,sbinc.进入_install目录,然后输入下列命令:#mkdir etc usr var tmp proc home root dev进入刚创建的目录usr#mkdir bin sbin进入var#mkdir lib lock log run tmp进入proc#mkdir self self/fd进入dev#mkdir pts其中etc,proc和dev是一定要建的,bin和sbin不用建,因为busybox中已经有了。d,建立设备文件名手工建立的方法:#ls -l /dev/consolecrw------- 1 root root 5, 1 11月 30 09:02 /dev/console这样就查看到了console设备的主设备号是5,辅设备号是1,是一个标记为C的字符设备。于是,可以用mknod建立一个同样的设备文件:#mknod console c 5 1但是手工方法建立太麻烦了,通常直接从/dev下把需要的设备文件拷贝过来。这些设备文件是特殊文件,在拷贝时一定要加上-R参数才能拷贝。#cp -R /dev/console ./#cp -R /dev/null ./#cp -R /dev/zero ./...进入/dev#cp -R fb fb0 loop1 tty0 tty1 tty2 ttyS0 ram initctl ./#mkdir bus#cp -R bus/* ./bus/#cp -R /dev/pts/0 ./pts#ln -s ../proc/self/fd fd#ln -s fd/0 stdin#ln -s fd/1 stdout#ln -s fd/2 stderr进入proc/self/fd/#ln -s ../../../dev/pts/0 0#ln -s ../../../dev/pts/0 1#ln -s ../../../dev/pts/0 2e.建立etc目录下的配置文件busybox.conf group inittab motd passwd resolv.conffstab init.d issue mtab profile shadow modules.conf执行:touch busybox.conf group inittab motd passwd resolv.conftouch fstab issue mtab profile shadow modules.conf其中init.d是一个目录,从busybox源代码目录下拷贝过来。#cp -R 你的目录/examples/bootflopyp/etc/init.d /mnt/rootfs/etc/#vi /etc/fstab:none /proc proc defaults 0 0none /dev/pts devpts mode=0622 0 0#vi /etc/inittab:::sysinit:/etc/init.d/rcS#console::once:/usr/sbin/inetd#::respawn:/sbin/getty 115200 ttySAC0#::respawn:/bin/sh::askfirst:-/bin/sh# Stuff to do when restarting the init process::restart:/sbin/init# Stuff to do before rebooting::ctrlaltdel:/sbin/reboot::shutdown:/bin/umount -a -r > /dev/null 2>&1::shutdown:/sbin/swapoff -a > /dev/null 2>&1#vi /etc/init.d/rcS:#! /bin/shPATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin/bin/mount -arunlevel=Sprevlevel=Numask 022export PATH runlevel prevleveltrap ":" INT QUIT TSTP/sbin/ifconfig lo 127.0.0.1/sbin/ifconfig eth0 192.168.0.69 netmask 255.255.255.0#/bin/mount -t proc none /proc#/sbin/mount -t tmpfs none /root#/sbin/mount -t tmpfs none /tmp#/sbin/mount -t tmpfs none /var#/sbin/insmod /www/spca5xx.ko#/sbin/insmod /www/rt73.ko/bin/mkdir -p /var/lib/bin/mkdir -p /var/run/bin/mkdir -p /var/log/bin/mount -aln -s /dev/scsi/host0/bus0/target0/lun0/part1 /dev/sda1ln -s /dev/v4l/video0 /dev/video0cd /devcd /#mount -t yaffs /dev/mtdblock3 /mnt/sbin/insmod /www/armrt73.ko/sbin/insmod /www/spca5xx.ko#chmod a+x rcS# vi etc/profile# /etc/profile: system-wide .profile file for the Bourne shells#Ash profileulimit -S -c 0 > /dev/null 2>&1USER="'id -un'"LONGNAME=$USER#export PS1="[\u@\h \w]\#"export PS1="[\u@\w]\#"alias du='du -h'alias df='df -h'alias rm='rm -i'PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbinexport PATH LONGNAMEf,建立lib目录下文件进入交叉编译器的库文件目录:arm-cross-3.4.1/usr/local/arm/3.4.1/arm-linux/lib /*完整glibc链接库*/#cp *-*.so _install/lib#cp *.so.[*0-9] _install/lib#cp libSegFault.so libmemusage.so libpcprofile.so _install/lib#arm-linux-strip _install/lib/*.sog.制作好文件系统后,烧到开发板中进入busybox-1.2.1目录,执行 #./mkyaffsimage _install rootfor2.6.14.img#cp rootfor2.6.14.img /root十一、编译/烧写bootloader: 1.将vivi_note_yaffs.tar.gz解压后直接运行make命令即可生成文件vivi,也可以使用附件里的vivi_yaffs,它编译好的可执行文件 使用JTAG烧写bootloader:附件里的Jflash-s3c2410是linux下的JTAG工具 2. 编译/烧写内核: 烧写内核:在启动嵌入式板子的同时按住空格键启动vivi,使用命令“load flash kernel x”,然后使用xmodem接收内核映象 3. 制作/烧写yaffs文件系统映象: 使用“loadyaffs root x”命令,然后使用xmodem接收yaffs映象 4. 在bootloader里设置启动参数: param set linux_cmd_line "noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0" 如果要使用nfs(使用原来的根文件系统),则运行命令(命令中/WirelessCard/busybox-1.2.1/_install为根文件系统的路径):param set linux_cmd_line "console=ttySAC0 root=/dev/nfs nfsroot=192.168.0.101:/WirelessCard/busybox-1.2.1/_install ip=192.168.0.69:192.168.0.101:192.168.0.101:255.255.255.0:matrix4.arm9.net:eth0:off" 5.param save 6.boot__________________________________________________________________________________也可通过下列方法烧录:1.烧录vivi ./Jflash --help (用该命令查询使用方法)2.按住空格键的同时启动嵌入式系统,进入vivi3.vivi>load flash kernel x (烧录内核)4.使用nfs(使用原来的根文件系统),则运行命令(命令中/WirelessCard/busybox-1.2.1/_install为根文件系统的路径,需预先设置/etc/exports:/WirelessCard/busybox-1.2.1/_install *(rw,sync,no_root_squash) #service nfs restart)param set linux_cmd_line "console=ttySAC0 root=/dev/nfs nfsroot=192.168.0.101:/WirelessCard/busybox-1.2.1/_install ip=192.168.0.69:192.168.0.101:192.168.0.101:255.255.255.0:matrix4.arm9.net:eth0:off" 5.param save6.boot7.提示符下执行“bk35”命令,最后执行“bs35”命令。Bk(是一个脚本)命令首先使用imagewrite(其使用方法方法可参考其帮助)对flash进行分区,然后烧写bootloader和kernel. bk执行完毕,按照提示,复位系统,再次使用nfs启动系统(仍需按空格键启动vivi,然后输入param set linux_cmd_line “root=/dev/nfs .......”;param save;boot),然后使用”bs(是一个脚本)”命令先对flash进行格式化,再安装根文件系统。__________________________________________________________________________________嵌入式系统web服务器的建立过程(可使用BOA和appweb):Boa是一种单任务的HTTP服务器, 这就意味着Boa不对每个进入服务器的连接开辟进程, 更不为处理多路复用而开辟子进程。仅仅对正在进行的HTTP连接进行复用, 而且也只为那些独立CGI程序开辟进程。测试表明Boa服务器的速度比常规的Web服务器, 如Apache服务器, 快2倍以上。 Boa服务器最大的优点就是速度快。http://www.boa.org/ 处下载在客户端输入:http://192.168.0.69/index.html
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -