linux移植

分类: 操作系统 arm 2012-06-11 15:55  437人阅读  评论(0)  收藏  举报
linux interface linux内核 c makefile flash

目录(?)[+]

以前一直都是只移过u-boot没有移过linux,这次尝试下。

     现在能够启动的是barebox,我现在准备先做的事情是在天嵌科技提供的u-boot的基础上,启动linux内核。

一、关于机器码

      u-boot在启动linux内核的时候,会传过去3个参数,r0r1r2.分别是

r0=0

r1=平台编号

r2=参数地址

     内核在启动时,是通过bootloader传入的机器码(MACH_TYPE)确定应启动哪种目标平台的,

     u-boot(board/embedsky/XXXX.c)会对机器码进行设置:

      gd->bd->bi_arch_number = MACH_TYPE_S3C2440;

     还有启动参数

      gd->bd->bi_boot_params = 0x30000100;

      Linuxarch/arm/tools/mach_types中有机器码定义,linux内核启动的时候,在haed.s中会去查找机器码,看是否支持。

   Linux中的机器码是用下面两个宏定义的:

MACHINE_START()

MACHINE_END

      EmbedSkyu-boot中机器码使用的是MACH_TYPE_S3C2440=168

     存放参数的地址是0x30000100

      Linux中定义的

MACHINE_START(S3C2440, "TQ2440")

      .phys_io = S3C2410_PA_UART,

      .io_pg_offst  = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,

      .boot_params      =S3C2410_SDRAM_PA + 0x100,这个得和u-boot传进来的参数匹配

      .init_irq = s3c24xx_init_irq,

      .map_io        = tq2440_map_io,

      .init_machine      = tq2440_machine_init,

      .timer           = &s3c24xx_timer,

MACHINE_END

   在make menuconfig时,有菜单可以选择,其中的System Type中可以选择开发板,

可以看到有添加的EmbedSky选项了,当我们需要添加自己的开发板时,修改arch/arm/ mach-s3c2440/Kconfig文件

在arch/arm/plat-s3c24xx/Kconfig中有配置选项,

arch/arm/plat-s3c24xx/Makefile:48:

obj-$(CONFIG_MACH_EMBEDSKY)           += common-EmbedSky.o

如何添加自己的开发板

   当我们需要添加自己的开发板时,我们首先在arch/arm/mach-s3c2440/Kconfig中添加配置选项

   查看Kconfig看看SMDK2440的菜单配置情况(arch/arm/mach-s3c2440)

1.修改时钟

      arch/arm/mach-s3c2440/mach-smdk2440.c”文件的大概162行或163行,把16.9344MHz改为12MHz

2.修改机器码

     机器码保存在内核源码的“arch/arm/tools/mach-types”文件中,在大概379行,把原来的362改为168保存即可

3.编译内核

      Make zImage

4.下载内核

     到此处讲下分布,将zImage下载到nand0x00200000处了,u-boot在启动的时候,从nand中读取内核到0x30008000

setup_linux_param(boot_mem_base + LINUX_PARAM_OFFSET); 0x30000100

     这是设置内核参数地址

5.把镜像存放到指定位置

     

添加自己的的设备

1.arch/arm/mach-s3c2440/Kconfig文件中仿照ARCH_S3C2440添加如下语句:


2.搜索关键字ARCH_S3C2440


     所以添加了Kconfig选项后,得在Makefile中添加选项,在目录下添加文件

     修改Makefile文件天剑语句:


      cp mach-s3c2440.c  mach-my2440.c

3.搜索关键字MACH_SMDK

     arch/arm/plat-s3c24xx/目录下的KconfigMakefile文件中用到,修改

arch/arm/plat-s3c24xx/common-smdk.c”为“common-zhuanxu.c”,复制“arch/arm/plat-s3c24xx/include/plat/common-smdk.h”为“common- zhuanxu.h”。

     修改文件common-zhuanxu.cmach-my2440.c包含的头文件

     此时再次编译的选择新的平台就可以编译成功了。

     arch/arm/Kconfig文件中

     以上修改的情况下内核无法启动,什么原因呢??

     后来发现问题了,是没有修改arch/arm/tools/mach-types文件,修改里面的文件,将里面修改如下:


     现在分析下为什么?

     因为很多部分通过ARCH_S3C2440会产生mach-types.h文件,所以当们修改了Kconfig文件,此时就会选中ARCH_MY2440,而不是ARCH_S3C2440,就不会产生mach-types.h中的语句了。

#ifdef CONFIG_ARCH_S3C2440

# ifdef machine_arch_type

undef machine_arch_type

define machine_arch_type       __machine_arch_type

# else

define machine_arch_type       MACH_TYPE_S3C2440

# endif

# define machine_is_s3c2440()      (machine_arch_type == MACH_TYPE_S3C2440)

#else

# define machine_is_s3c2440()      (0)

#endif

     现在第二中修改方法:

     修改arch/arm/mach-s3c2440/Kconfig


        晶振的配置问题:

     当配置为12M的时候,会选择PLL_12M这个选项


     然后会去编译对应的PLL文件。

     

下面是第一次下载内核后出现的打印信息

Booting Linux ...

Copy linux kernel from 0x00200000 to 0x30008000, size = 0x00300000 ... Copy Kernel to SDRAM done,NOW, Booting Linux......

Uncompressing Linux.............................................................................................................. done, booting the kernel.

Linux version 2.6.32.2-zhuanxu (zhuanxu@zhuanxu-desktop) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-176) ) #2 PREEMPT Sun Jun 10 12:23:15 CST 2012

CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177

CPU: VIVT data cache, VIVT instruction cache

Machine: SMDK2440

ATAG_INITRD is deprecated; please update your bootloader.

Memory policy: ECC disabled, Data cache writeback

CPU S3C2440A (id 0x32440001)

S3C24XX Clocks, (c) 2004 Simtec Electronics

S3C244X: core 400.000 MHz, memory 100.000 MHz, peripheral 50.000 MHz

CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on

Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256

Kernel command line: console=ttySAC0 root=/dev/nfs nfsroot=10.42.0.21:/work/nfs_root/fs_mini ip=10.42.0.11:10.42.0.21:10.42.0.11:255.255.255.0:SKY2440.embedsky.net:eth0:off

PID hash table entries: 256 (order: -2, 1024 bytes)

Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)

Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)

Memory: 64MB = 64MB total

Memory: 61236KB available (3088K code, 353K data, 100K init, 0K highmem)

SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1

Hierarchical RCU implementation.

NR_IRQS:85

irq: clearing pending ext status 00080000

irq: clearing subpending status 00000002

Console: colour dummy device 80x30

console [ttySAC0] enabled

Calibrating delay loop... 199.47 BogoMIPS (lpj=498688)

Mount-cache hash table entries: 512

CPU: Testing write buffer coherency: ok

devtmpfs: initialized

NET: Registered protocol family 16

S3C2440: Initialising architecture

S3C2440: IRQ Support

S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics

DMA channel 0 at c4808000, irq 33

DMA channel 1 at c4808040, irq 34

DMA channel 2 at c4808080, irq 35

DMA channel 3 at c48080c0, irq 36

S3C244X: Clock Support, DVS off

bio: create slab at 0

usbcore: registered new interface driver usbfs

usbcore: registered new interface driver hub

usbcore: registered new device driver usb

NET: Registered protocol family 2

IP 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 registered

RPC: Registered udp transport module.

RPC: Registered tcp transport module.

RPC: Registered tcp NFSv4.1 backchannel transport module.

JFFS2 version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.

JFFS2: default compression mode: priority

msgmni has been set to 119

alg: No test for stdrng (krng)

io scheduler noop registered (default)

Console: switching to colour frame buffer device 30x40

fb0: s3c2410fb frame buffer device

Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled

s3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440

s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440

s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440

loop: module loaded

S3C24XX NAND Driver, (c) 2004 Simtec Electronics

s3c24xx-nand s3c2440-nand: Tacls=2, 20ns Twrph0=6 60ns, Twrph1=2 20ns

s3c24xx-nand s3c2440-nand: NAND soft ECC

NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)

Scanning device for bad blocks

Bad eraseblock 217 at 0x000001b20000

Bad eraseblock 282 at 0x000002340000

Bad eraseblock 1089 at 0x000008820000

Bad eraseblock 1232 at 0x000009a00000

Bad eraseblock 1335 at 0x00000a6e0000

Bad eraseblock 1602 at 0x00000c840000

Creating 8 MTD partitions on "NAND 256MiB 3,3V 8-bit":

0x000000000000-0x000000004000 : "Boot Agent"

mtd: partition "Boot Agent" doesn't end on an erase block -- force read-only

0x000000000000-0x000000200000 : "S3C2410 flash partition 1"

0x000000400000-0x000000800000 : "S3C2410 flash partition 2"

0x000000800000-0x000000a00000 : "S3C2410 flash partition 3"

0x000000a00000-0x000000e00000 : "S3C2410 flash partition 4"

0x000000e00000-0x000001800000 : "S3C2410 flash partition 5"

0x000001800000-0x000003000000 : "S3C2410 flash partition 6"

0x000003000000-0x000004000000 : "S3C2410 flash partition 7"

usbmon: debugfs is not available

ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver

s3c2410-ohci s3c2410-ohci: S3C24XX OHCI

s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1

s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000

usb usb1: configuration #1 chosen from 1 choice

hub 1-0:1.0: USB hub found

hub 1-0:1.0: 2 ports detected

usbcore: registered new interface driver libusual

usbcore: registered new interface driver usbserial

USB Serial support registered for generic

usbcore: registered new interface driver usbserial_generic

usbserial: USB Serial Driver core

USB Serial support registered for FTDI USB Serial Device

usbcore: registered new interface driver ftdi_sio

ftdi_sio: v1.5.0:USB FTDI Serial Converters Driver

USB Serial support registered for pl2303

usbcore: registered new interface driver pl2303

pl2303: Prolific PL2303 USB to serial adaptor driver

mice: PS/2 mouse device common for all mice

S3C24XX RTC, (c) 2004,2006 Simtec Electronics

S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics

s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled

TCP cubic registered

drivers/rtc/hctosys.c: unable to open rtc device (rtc0)

IP-Config: Device `eth0' not found.

Looking up port of RPC 100003/2 on 10.42.0.21

rpcbind: server 10.42.0.21 not responding, timed out

Root-NFS: Unable to get nfsd port number from server, using default

Looking up port of RPC 100005/1 on 10.42.0.21

rpcbind: server 10.42.0.21 not responding, timed out

Root-NFS: Unable to get mountd port number from server, using default

Root-NFS: Server returned error -5 while mounting /work/nfs_root/fs_mini

VFS: Unable to mount root fs via NFS, trying floppy.

VFS: Cannot open root device "nfs" or unknown-block(2,0)

Please append a correct "root=" boot option; here are the available partitions:

1f00              16 mtdblock0 (driver?)

1f01            2048 mtdblock1 (driver?)

1f02            4096 mtdblock2 (driver?)

1f03            2048 mtdblock3 (driver?)

1f04            4096 mtdblock4 (driver?)

1f05           10240 mtdblock5 (driver?)

1f06           24576 mtdblock6 (driver?)

1f07           16384 mtdblock7 (driver?)

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)

[] (unwind_backtrace+0x0/0xe8) from [] (panic+0x4c/0x134)

[] (panic+0x4c/0x134) from [] (mount_block_root+0x16c/0x224)

[] (mount_block_root+0x16c/0x224) from [] (prepare_namespace+0xf8/0x190)

[] (prepare_namespace+0xf8/0x190) from [] (kernel_init+0xec/0x120)

[] (kernel_init+0xec/0x120) from [] (kernel_thread_exit+0x0/0x8)

2013年03月05日相关推荐

  1. 2022年03月05日:宜未雨而绸缪,毋临渴而掘井

    目录 引子 关于去年 关于今年 小结 引子 去年(2021年03月30)的一天,我写下了<最近的一些思考>这篇文章.如今一年过去了,期间我把这篇文章忘了,但不得不说,这篇文章里提到事,这一 ...

  2. 2013年03月26日

    JAVA操作properties文件 java中的properties文件是一种配置文件,主要用于表达配置信息,文件类型为*.properties,格式为文本文件,文件的内容是格式是"键=值 ...

  3. 湖南卫视节目单2013年3月17日

    2013年3月17日周日 湖南卫视24小时节目预告单 早间节目 00:40 我是歌手 02:40 我是大美人 03:20 媳妇是怎样炼成的(22) 04:03 媳妇是怎样炼成的(23) 04:46 媳 ...

  4. 2013年11月26日 20:26:36 做某香米过程中问题总汇

    个人工作: A.图片编辑界面: ①图片旋转 ②滤镜效果[*] 使用GPU Image开源库,120种滤镜效果,3-4天之内 ③缩放 ④亮度[*] ⑤文字编辑 B.代码方面: ①代码合并 细节点比如一天 ...

  5. delphichm博客于2013年10月16日申请成功了!

    delphichm博客于2013年10月16日申请成功了! 感谢博客园提供给我们一个这样好的免费博客平台 博客园的整个系统设计的很完美,特别是登录后可以博客备份. 即安全稳定又安全易用,博客园真是个好 ...

  6. 【财经期刊FM-Radio|2021年03月04日】

    title: [财经期刊FM-Radio|2021年03月04日] 微信公众号: 张良信息咨询服务工作室 [今日热点新闻一览↓↓] 科技股拖累纳指跌超2%,ARKK跌入熊市,美债收益率又猛升,美国5年 ...

  7. 【06月05日】A股滚动市净率PB历史新低排名

    2010年01月01日 到 2019年06月05日 之间,滚动市净率历史新低排名. 上市三年以上的公司,2019年06月05日市净率在30以下的公司. 来源:A股滚动市净率(PB)历史新低排名. 1 ...

  8. 【03月04日】A股滚动市盈率PE历史新低排名

    2010年01月01日 到 2018年12月05日 之间,滚动市盈率历史新低排名. 上市三年以上的公司,2018年12月05日市盈率在300以下的公司. 1 - 青松股份(SZ300132) - 历史 ...

  9. 万兆无盘服务器,万兆无盘网吧解决方案 2013年3月15日.doc

    万兆无盘网吧解决方案 2013年3月15日 南京XX高等职业学校 五年制高职毕业设计(论文) 姓 名: 陈X 学 号: 05 系 部: 信息工程系 专 业: 计算机应用技术 设计题目: 万兆无盘网吧方 ...

最新文章

  1. Redisbook学习笔记(1)跳跃表
  2. DPM2010恢复exchange2010单个用户邮箱邮件
  3. SpringBoot @Value、 @ConfigurationProperties 与 @EnableConfigurationProperties 使用
  4. 用java分组查elasticsearch
  5. TCC两阶段补偿方案
  6. sql 12天内的数据_想要在12周内成为数据科学家吗?
  7. Realtek网卡如何识别具体型号是8111B/8111C/8111D还是8111E???
  8. 小学计算机表格制作教学,小学计算机年度教学工作计划表格(四篇).docx
  9. 3分钟搞定SpringBoot+Mybatis+druid多数据源和分布式事务
  10. python从入门到精通pdf-跟老齐学Python:从入门到精通 完整版PDF[7MB]
  11. Lightroom Classic教程:如何显示堆叠?
  12. Craps赌博游戏-python3
  13. 怎么隐藏电脑桌面的计算机图标,怎么隐藏电脑桌面右下角图标
  14. 怎么在计算机里有桌面快捷方式,桌面快捷方式不见了,小编教你桌面软件快捷方式图标不见了怎么办...
  15. 吾日三省吾身:三种光
  16. 【计算机毕业设计】java+mysql基于SSM的生鲜超市进销存管理系统
  17. 再见,搜不准的百度!你好,6个精准搜索技巧(还可以屏蔽广告哦~)
  18. wps 云文档的服务器地址,在WPS云文档保存、管理文件
  19. 港科夜闻|香港科技大学(广州)与广东联通签署多方位战略合作协议
  20. 【MFC】学习笔记:常用控件之组合框(Combo Box)

热门文章

  1. 典型相关分析(Canonical Correlation Analysis,CCA)
  2. 药企如何选型医药CRM
  3. LAMMPS后处理—如何构建二维云图-接触角呢?
  4. java eden s0 s1_JVM内存结构--新生代及新生代里的两个Survivor区(下一轮S0与S1交换角色,如此循环往复)、常见调优参数...
  5. 【QTdesigner】课时52.绘制各种图形(paintEevnt()))【pyqt5+QTdesigner模式】
  6. 两台电脑实现共用鼠标键盘的软件ShareMouse
  7. Mysql:数据库引擎
  8. 电力运检工人是如何被AI解放的?
  9. 水仙花数(Java语言)——最基础全面的讲解
  10. Day16-购物车页面-商品列表修改购物车商品的勾选状态