linux 内核启动过程移植uboot和linux内核.docx_第1页
linux 内核启动过程移植uboot和linux内核.docx_第2页
linux 内核启动过程移植uboot和linux内核.docx_第3页
linux 内核启动过程移植uboot和linux内核.docx_第4页
linux 内核启动过程移植uboot和linux内核.docx_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

移植UbootLinux整理 由于按照NFS不小心,Ubuntu罢工,不得以,自己重新把移植uboot和linux工作重新做一次,权当复习. 自己移植的是Uboot-1.2.0和 linux- 到恒丰锐科(hfrk) 2410 的板子.用busybox-1.2.0 和cramfs-1.1 制作camfs. 该板子没有nor,只要64M的nand. 1.=uboot按照编译器= sudo tar -jxvf arm-linux-gcc-3.3.2.tar.bz2 -C / /for uboot have hard float . 2.=uboot1.2.0 移植 = 见附件 ubootclay2010Feb05.patch . 以下是移植说明. 修改根目录的Makefile的 cross compiler CROSS_COMPILE ?= /usr/local/arm/3.3.2/bin/arm-linux- 修改 /home/clay/u-boot-1.2.0/cpu/arm920t/config.mk 见7(13) 屏蔽 -msoft-float 不要浮点 ,也可以自己编译带软件浮点的编译器. make distclean /清除上一次的配置 make smdk2410_config /选用2410 默认配置 make /编译,在去掉浮点后,能编译通过 修改 /home/clay/u-boot-1.2.0/board/smdk2410/lowlevel_in it.S /2410 DDR时序配置 /home/clay/u-boot-1.2.0/cpu/arm920t/start.S / 添加copy uboot到ddr的代码,注意copy的页面数量要比编译出来的uboot.bin大 /home/clay/u-boot-1.2.0/include/configs/smdk2410.h /修改 nand boot的配置,nand命令,uboot启动kernel命令,传递给kernel的参数,串口波特率等等 for nand cmd & load CONFIG_BOOTARGS CONFIG_BOOTCOMMAND /home/clay/u-boot-1.2.0/include/linux/mtd/nand_ids .h /添加 nand_flash_ids nand flash id /home/clay/u-boot-1.2.0/lib_arm/board.c /可以添加一些打印信息,可以不添加 /home/clay/u-boot-1.2.0/common/cmd_boot.c /uboot的go 没有带CUP的id参数,所以添加,见7(9) /home/clay/u-boot-1.2.0/drivers/nand/nand.c /for nand 的操作用到的具体的读写见7(12) 重新编译,可以进入到 uboot的命令界面 3.=ubuntu tftp = $ sudo apt-get install xinetd tftpd tftp 失败,vsftp也不能tftp访问,见7(11) 以下是成功的方法 sudo apt-get install tftpd-hpa tftp-hpa sudo update-rc.d -f tftpd-hpa remove claypan:/home$ sudo mkdir tftp claypan:/home$ sudo chmod 777 -R tftp/ claypan:/home$ sudo chown -R nobody tftp/ sudo apt-get install xinetd sudo gedit /etc/xinetd.d/tftp 添加以下 server = /usr/sbin/in.tftpd #server_args = /home/tftp disable = no server_args = -s /home/tftpd -p -c -U 077 -u tftpd #/表示tftp操作目录在/home/tftpd上 log_on_success = PID HOST DURATION log_on_failure = HOST sudo gedit /etc/inetd.conf 屏蔽以下语句 #tftp dgram udp wait root /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot 如果tftp不能工作,执行/etc/init.d/xinetd restart 即可 到这里,在uboot 可以用 tftp 的命令下载zImage等,用go可以执行 4=kernel= = 移植linux-内核,见附件linuxclay2010feb04.patch. 修改 arch/arm/mach-s3c2410/devs.c /添加nand 分区 struct drivers/mtd/nand/s3c2410.c /禁止nand ecc ,因为uboot和kernel的ecc不一样 linux/arch/arm/mach-s3c2410/mach-smdk2410.c,smdk24 10_devices添加 &s3c_device_nand,让系统开机初始化nand,能从中读取cramfs 参照arch/arm/configs/s3c2410_defconfig 配置内核,也可以用make menuconfig 然后在以下步骤添加 -Boot options :noinitrd root=/dev/mtdblock2 init=/linuxrc devfs=mount console=ttySAC0,115200 same as uboot -file system - network file system - NFS -miscellaneous filesystem-cramfs make (zImage)/可以成功用修改后的go运行,只是找不到rootfs 制作bootm引导的uImage sudo cp ./u-boot-1.2.0/tools/mkimage /usr/local/bin/ gedit arch/arm/boot/Makefile - quiet_cmd_uimage = UIMAGE $ cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel -C none -a $(ZRELADDR) -e 0x30008040 #/使用bootm,原因见7(6)的解释 -n Linux-$(KERNELRELEASE) -d $ $ - make uImage - tftp 0x30008000 uImage nand erase 0x00040000 nand write 0x30008000 0x00040000 0x001c0000 5=cramfs busybox= 添加zlib,因为ubuntu没带,见7(17) $tar -xvzf zlib-1.2.3.tar.gz $cd zlib-1.2.3.tar.gz $./configure $make $sudo make install cramfs-1.1/: make make make install 的到制作cramfs的工具的执行程序 编译busybox/最好和内核用一样的编译器,见7(16) menuconfig -设置 compiler /usr/local/arm/3.4.1/bin/arm-linux- -install option dont use /usr & set out file path -general CONFIG_FEATURE_SUID=y ? make 后,在指定的目录的到bin sbin linuxrc,他们都是busybox的链接 6=rootfs= 在编译出来 busybox 目录下 claypan:/rootfs$ mkdir dev etc home lib mnt proc sys tmp var usr /bin sbin no need rm linuxrc/编译出来的这文件不能执行,不合适,所以要修改,见7(17) gedit linuxrc #!/bin/sh echo mount /etc as ramfs /bin/mount -f -t cramfs -o remount,ro /dev/bon/2 / /bin/mount -t ramfs ramfs /var /bin/mkdir -p /var/tmp /bin/mkdir -p /var/run /bin/mkdir -p /var/log /bin/mkdir -p /var/lock /bin/mkdir -p /var/empty #/bin/mount -t usbdevfs none /proc/bus/usb exec /sbin/init /添加rcS 文件gedit rcS - - #!/bin/sh /bin/mount -a - - chmod 775 linuxrc rcS claypan:/rootfs$ mkdir -p etc/init.d/ claypan:/rootfs$ mv rcS etc/init.d/ claypan:/etc$ gedit inittab/添加inittab以下内容 # This is run first except when booting :sysinit:/etc/init.d/rcS # Start an askfirst shell on the console #:askfirst:-/bin/bash :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 gedit fstab/添加以下内容 - - none /proc proc defaults 0 0 none /dev/pts devpts mode=0622 0 0 tmpfs /dev/shm tmpfs defaults 0 0 - - claypan:/rootfs$ chmod 777 inittab fstab claypan:/rootfs$ mv fstab etc/ claypan:/rootfs$ mv inittab etc/ claypan:/rootfs$ cd dev/ claypan:/rootfs/dev$ sudo mknod console c 5 1 sudo password for clay: claypan:/rootfs/dev$ sudo mknod null c 1 3 claypan:$ gedit libcopy.sh/制作一个sh程序,去复制编译器中动态库, - # cd /usr/local/arm/3.4.1/arm-linux/lib/ /到编译内核的编译器目录里 for file in libc libcrypt libdl libm libpthread libresolv libutil do cp $file-*.so /home/clay/rootfs/lib cp -d $file.so.*0-9 /home/clay/rootfs/lib done cp -d ld*.so* /home/clay/rootfs/lib - / claypan:$ sudo cp libcopy.sh /usr/local/arm/3.4.1/arm-linux/lib/ claypan:$ cd /usr/local/arm/3.4.1/arm-linux/lib claypan:/usr/local/arm/3.4.1/arm-linux/lib$ sudo sh libcopy.sh 制作cramfs claypan:$ ./mkcramfs rootfs/ rootfs.cramfs /下载 tftp 0x30008000 rootfs.cramfs nand erase 0x00200000 0x02800000 nand write 0x30008000 0x00200000 0x00300000 完成.kernel可以引导rootfs 7 =遇见的问题和参考的网站= /网址不不一定对,可以按照关键字去搜 (1)Error: unrecognized/unsupported machine ID (r1 = 0x33f60264). / cmd_boot.c or kernel head.S add id = 0xc1 (2)Warning: unable to open an initial console. Failed to execute /linuxrc. Attempting defaults. Kernel panic - not syncing: No init found. Try passing init= option to kernel. /linuxrc 不能用busybox的,需要修改 (3)# Booting image at 30008000 . Bad Magic Number / 使用bootm的启动,必须是uImage的内核 (/linux/dosc1/59/linux-393120 .htm) (4)VFS: Cannot open root device hda1 or unknown-block(2,0) Please append a correct root= boot option Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0) / kernel没有找到rootfs (5)内核kernel以及根文件系统rootfs是如何映射到对应的nand flash的地址的(/course/6_system/linux/Linuxj s/20100204/194702.html) (6)U-BOOT下使用bootm引导内核方法 bootm kernel(/lanmanck/archive/2009/ 06/16/4273967.aspx) 比较详细解释了bootm用法,好文章 (7)uboot中利用TFTP和NFS加载内核镜像和根文件系统(/u3/108239/showart_21443 75.html) 介绍了tftp nfs 中配置 (8)uImage的制作(/sunxuxi/blog/item/bf3bd62f1a6 f0d3b1f3089cb.html) 2.6.14内核已经有操作,只需要mkimage文件放到/usr/bin,及修改arch/arm/boot/Makefile,改变引导参数,见(6) (10)常用UBoot命令(/zhandoushi1982/archive/2009/ 10/15/4677728.aspx) (11) 解决uboot-1.1.6 tftp命令不能成功下载文件的问题(/u3/93291/showart_206163 0.html) 解决方法及查问题过程 (12)移植UBoot.1.2.0到博创2410S 移植UBoot.1.2.0到友善之臂SBC2440V4 uboot

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论