免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5058 | 回复: 5
打印 上一主题 下一主题

关于linuxrc不能执行的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-03-06 21:06 |只看该作者 |倒序浏览
linux在2410上面启动时的打印信息

  1. NAND read: device 0 offset 0x100000, size 0x300000
  2. 3145728 bytes read: OK
  3. ## Starting application at 0x30008000 ...
  4. Uncompressing Linux.............................................................
  5. done, booting the kernel.
  6. Linux version 2.6.14.1 (jade@ubuntu) (gcc version 3.4.5) #2 Thu Mar 5 14:42:12 C
  7. ST 2009
  8. CPU: ARM920Tid(wb) [41129200] revision 0 (ARMv4T)
  9. Machine: SMDK2410
  10. Warning: bad configuration page, trying to continue
  11. Memory policy: ECC disabled, Data cache writeback
  12. CPU S3C2410A (id 0x32410002)
  13. S3C2410: core 202.800 MHz, memory 101.400 MHz, peripheral 50.700 MHz
  14. S3C2410 Clocks, (c) 2004 Simtec Electronics
  15. CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
  16. CPU0: D VIVT write-back cache
  17. CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
  18. CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
  19. Built 1 zonelists
  20. Kernel command line: noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0,
  21. 115200
  22. irq: clearing subpending status 00000002
  23. PID hash table entries: 128 (order: 7, 2048 bytes)
  24. timer tcon=00500000, tcnt a509, tcfg 00000200,00000000, usec 00001e4c
  25. Console: colour dummy device 80x30
  26. Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
  27. Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
  28. Memory: 16MB = 16MB total
  29. Memory: 14232KB available (1501K code, 342K data, 84K init)
  30. Mount-cache hash table entries: 512
  31. CPU: Testing write buffer coherency: ok
  32. softlockup thread 0 started up.
  33. NET: Registered protocol family 16
  34. S3C2410: Initialising architecture
  35. S3C2410 DMA Driver, (c) 2003-2004 Simtec Electronics
  36. DMA channel 0 at c1800000, irq 33
  37. DMA channel 1 at c1800040, irq 34
  38. DMA channel 2 at c1800080, irq 35
  39. DMA channel 3 at c18000c0, irq 36
  40. NetWinder Floating Point Emulator V0.97 (double precision)
  41. devfs: 2004-01-31 Richard Gooch ([email]rgooch@atnf.csiro.au[/email])
  42. devfs: boot_options: 0x1
  43. Console: switching to colour frame buffer device 80x25
  44. fb0: Virtual frame buffer device, using 1024K of video memory
  45. S3C2410 RTC, (c) 2004 Simtec Electronics
  46. s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2410
  47. s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2410
  48. s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2410
  49. io scheduler noop registered
  50. io scheduler anticipatory registered
  51. io scheduler deadline registered
  52. io scheduler cfq registered
  53. RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
  54. S3C24XX NAND Driver, (c) 2004 Simtec Electronics
  55. s3c2410-nand: mapped registers at c1980000
  56. s3c2410-nand: timing: Tacls 10ns, Twrph0 30ns, Twrph1 10ns
  57. NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit
  58. )
  59. NAND_ECC_NONE selected by board driver. This is not recommended !!
  60. Scanning device for bad blocks
  61. Creating 4 MTD partitions on "NAND 64MiB 3,3V 8-bit":
  62. 0x00000000-0x00100000 : "bootloader"
  63. 0x00100000-0x00400000 : "kernel"
  64. 0x00400000-0x02c00000 : "root"
  65. 0x02d00000-0x03c00000 : "user"
  66. mice: PS/2 mouse device common for all mice
  67. NET: Registered protocol family 2
  68. IP route cache hash table entries: 256 (order: -2, 1024 bytes)
  69. TCP established hash table entries: 1024 (order: 0, 4096 bytes)
  70. TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
  71. TCP: Hash tables configured (established 1024 bind 1024)
  72. TCP reno registered
  73. TCP bic registered
  74. NET: Registered protocol family 1
  75. Reading data from NAND FLASH without ECC is not recommended
  76. VFS: Mounted root (cramfs filesystem) readonly.
  77. Mounted devfs on /dev
  78. Freeing init memory: 84K
  79. Failed to execute /linuxrc.  Attempting defaults...
  80. Kernel panic - not syncing: No init found.  Try passing init= option to kernel.
复制代码


网上分析linuxrc不能运行无非三点原因
1 linuxrc不具备可执行属性
2 linuxrc的解释shell不在首行
3 linuxrc的解释shell不存在


  1. ls linuxrc -al
  2. -rwxrwxr-x 1 root root 687 1970-01-01 08:00 linuxrc
复制代码

说明第一条排除

root的结构

  1. |-- bin
  2. |   |-- ash -> busybox
  3. |   |-- busybox
  4. |   |-- cat -> busybox
  5. |   |-- cp -> busybox
  6. |   |-- echo -> busybox
  7. |   |-- ls -> busybox
  8. |   |-- mkdir -> busybox
  9. |   |-- mount -> busybox
  10. |   |-- mv -> busybox
  11. |   |-- pwd -> busybox
  12. |   |-- rm -> busybox
  13. |   |-- touch -> busybox
  14. |   |-- umount -> busybox
  15. |   `-- vi -> busybox
  16. |-- dev
  17. |-- etc
  18. |-- home
  19. |-- lib
  20. |-- linuxrc
  21. |-- linuxrc~
  22. |-- mnt
  23. |   `-- etc
  24. |-- proc
  25. |-- root
  26. |-- sbin
  27. |   |-- halt -> ../bin/busybox
  28. |   |-- init -> ../bin/busybox
  29. |   |-- poweroff -> ../bin/busybox
  30. |   |-- reboot -> ../bin/busybox
  31. |   `-- start-stop-daemon -> ../bin/busybox
  32. |-- sys
  33. |-- tmp
  34. `-- usr
  35.     |-- bin
  36.     |   |-- [ -> ../../bin/busybox
  37.     |   |-- [[ -> ../../bin/busybox
  38.     |   |-- env -> ../../bin/busybox
  39.     |   |-- mesg -> ../../bin/busybox
  40.     |   `-- test -> ../../bin/busybox
  41.     |-- lib
  42.     `-- sbin
复制代码


linuxrc的内容

  1. #!/bin/sh#挂载/etc 为 ramfs, 并从/mnt/etc 下拷贝文件到/etc 目录当中
  2. echo "mount /etc as ramfs"
  3. /bin/mount -n -t ramfs ramfs /etc
  4. /bin/cp -a /mnt/etc/* /etc
  5. echo "re-create the /etc/mtab entries"
  6. # re-create the /etc/mtab entries
  7. /bin/mount -f -t cramfs -o remount,ro /dev/mtdblock/2 /
  8. #mount some file system
  9. echo "------------mount /dev/shm as tmpfs"
  10. /bin/mount -n -t tmpfs tmpfs /dev/shm
  11. #挂载/proc 为 proc 文件系统
  12. echo "------------mount /proc as proc"
  13. /bin/mount -n -t proc none /proc
  14. #挂载/sys 为 sysfs 文件系统
  15. echo "------------mount /sys as sysfs"
  16. /bin/mount -n -t sysfs none /sys
  17. exec /sbin/init
复制代码


我把第一行改成了#!/bin/ash也不行,因为在/bin下面没看见sh,只看见ash。
请高手解答一下这是什么原因哦。
没有装tinylog什么的,是不是嵌入式linux默认的就是root用户啊?

论坛徽章:
0
2 [报告]
发表于 2009-03-06 21:10 |只看该作者
/bin/bash呢?
你/bin下有哪些shell?

cat /etc/shells
ls -l /bin/*sh*

论坛徽章:
0
3 [报告]
发表于 2009-03-07 09:02 |只看该作者
Kernel panic - not syncing: No init found.  Try passing init= option to kernel.
加上这个参数试试

论坛徽章:
0
4 [报告]
发表于 2009-03-07 09:28 |只看该作者
busybox重新编译试试呢,选择sh支持,去掉busybox自带的linuxrc支持。

论坛徽章:
0
5 [报告]
发表于 2009-03-07 14:04 |只看该作者
原帖由 marsaber 于 2009-3-6 21:10 发表
/bin/bash呢?
你/bin下有哪些shell?

cat /etc/shells
ls -l /bin/*sh*


  1. jade@ubuntu:~/tmp$ cat /etc/shells
  2. # /etc/shells: valid login shells
  3. /bin/csh
  4. /bin/sh
  5. /usr/bin/es
  6. /usr/bin/ksh
  7. /bin/ksh
  8. /usr/bin/rc
  9. /usr/bin/tcsh
  10. /bin/tcsh
  11. /usr/bin/esh
  12. /bin/dash
  13. /bin/bash
  14. /bin/rbash
  15. /usr/bin/screen
复制代码


  1. jade@ubuntu:~/tmp$ ls -l /bin/*sh*
  2. -rwxr-xr-x 1 root root 725136 2008-05-13 02:48 /bin/bash
  3. -rwxr-xr-x 1 root root  87924 2008-06-21 00:07 /bin/dash
  4. lrwxrwxrwx 1 root root      4 2009-03-04 22:53 /bin/rbash -> bash
  5. lrwxrwxrwx 1 root root      4 2009-03-04 22:53 /bin/sh -> dash
  6. lrwxrwxrwx 1 root root      4 2009-03-04 22:53 /bin/sh.distrib -> bash
复制代码

论坛徽章:
0
6 [报告]
发表于 2009-03-11 00:55 |只看该作者
卡了几天了,还是没搞出来哦。郁闷
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP