这次,还是把基本的基于我目前最新的Linux源码进行移植到OK6410吧,同时也写下我移植过程中遇到的问题及解决方法,不过有些方法是借鉴网上的,有些是自己加的,会有一些小bug。
一、基本工作
1. 源码下载 https://www.kernel.org/ ,最好是下载stable版本,否则会有小bug。(我现在调试的是stable版本, linux-3.14.4)
2. 拷到自己的文件夹下解压,我下的是.xz后缀的,这样文件比较小,只是解压时多一个步骤。
$ xz –d linux-3.14.4.tar.xz
$ tar xvf linux-3.14.4.tar
3. 解压完后,进入解压后的目录
二、源码修改
1. 修改根目录下的Makefile,针对修改arch和cross_compile,如下:
ARCH ?= arm CROSS_COMPILE ?= arm-linux-
2. 添加相关型号mach文件
目前最新内核已经支持好几种开发板,我们先从最基本的6410开始,选择mini6410,基于mini6410来修改配置,因此,进入arch/arm/mach-s3c64xx目录,拷贝mach-mini6410.c,重命名为mach-ok6410.c,下面需要对该文件进行一些修改:
2.1 将代码中替换为6410, 如下: mini6410->ok6410; MINI6410->OK6410
2.2 然后修改nand分区信息,修改static struct mtd_partition ok6410_nand_part[],这个修改需要结合你之前移植Uboot及你自己定义的分区布局。我的是这样的。
2.3 既然我们添加了一个文件,依据linux添加文件的规则,我们还修改相对应目录下Makefile和Kconfig
修改kconfig,参照MINI6410的配置,添加OK6410,如下:
修改Makefile,加入ok6410
3. 修改arch/arm/tools/mach-types文件,加入OK6410的mach-type,这个必须和U-BOOT中的MACH-TYPE一致,这里选用smdk6410的mach-type:1626
4. Menuconfig配置
回到主目录下,我们选用针对6400的默认配置,在此基础上进行配置。复制config下的s3c6400_defconfig到主目录并重命名为.config文件
$ cp arch/arm/configs/s3c6400_defconfig ./.config
$ make menuconfig
进入后做如下配置:(这里说一下:此情况下删除你的输入,需要按delete+shift,按backspace是没用的)
4.1 选择General Setup,打开Cross_compiler tool perfix,输入arm-linux-
4.4 选择System Type, 取消其他6410,只选择OK6410
4.3 选择Kernel Features , 选择以下两项
4.4 为了调试方便,我们顺便把nand flash的debug也打开,并选择硬件ECC。
Device Drivers—>Memory Technology Device(MTD) support—>NAND Device Support—>
完成以上配置后,保存退出!
在主目录下执行,make uImage( 前提是你已经把Uboot tools/下的mkimage工具拷贝到/bin目录下)
最后在编译完成后,输出信息如下:
通过tftp下载到板子上,运行后界面如下:
从上面我们可以看出,内核加载地址和入口地址是一样的:50008000,这是不合理的,入口地址应该是50008000,因为是uImage,需要在入口处添加文件头。
因此我们进行如下修改:
修改scripts/下的makefile.lib文件:将UIMAGE_ENTRYADDR ?= $(UIMAGE_LOADADDR) 改为:
IMAGE_ENTRYADDR ?= $(shell echo $(UIMAGE_LOADADDR) | sed -e 's/..$$/40/')
# U-Boot mkimage
# ---------------------------------------------------------------------------
MKIMAGE := $(srctree)/scripts/mkuboot.sh
# SRCARCH just happens to match slightly more than ARCH (on sparc), so reduces
# the number of overrides in arch makefiles
UIMAGE_ARCH ?= $(SRCARCH)
UIMAGE_COMPRESSION ?= $(if $(2),$(2),none)
UIMAGE_OPTS-y ?=
UIMAGE_TYPE ?= kernel
UIMAGE_LOADADDR ?= arch_must_set_this
#UIMAGE_ENTRYADDR ?= $(UIMAGE_LOADADDR)
UIMAGE_ENTRYADDR ?= $(shell echo $(UIMAGE_LOADADDR) | sed -e 's/..$$/40/')
UIMAGE_NAME ?= 'Linux-$(KERNELRELEASE)'
UIMAGE_IN ?= $<
UIMAGE_OUT ?= $@
修改后,再次make uImage, 编译完后的输出信息如下:
从上面我们可以看出,入口地址已经变为50008040,
下载到板子上,已经可以引导内核了。
从log可以看出,我们的nand flash并没有识别到,因为出错在这里:
[06/08-11:25:41:371]s3c24xx-nand s3c6400-nand: failed to get clock
[06/08-11:25:41:371]s3c24xx-nand: probe of s3c6400-nand failed with error –2
为了方便阅读,我还是在下一篇文章写吧,目前这个问题是需要解决的。
完整启动log如下:
[06/08-11:25:33:478]U-Boot 2010.03-svn3 (May 06 2014 - 22:13:20) for SMDK6410
[06/08-11:25:33:478]
[06/08-11:25:33:478]*******************************************************
[06/08-11:25:33:492] Welcome to Embedded System
[06/08-11:25:33:494] Base On S3C6410 Devolopment
[06/08-11:25:33:494] Date: 2014/4/15 22:00 PM
[06/08-11:25:33:503]*******************************************************
[06/08-11:25:33:503]
[06/08-11:25:33:504]CPU: S3C6410@533MHz
[06/08-11:25:33:531] Fclk = 533MHz, Hclk = 133MHz, Pclk = 66MHz (ASYNC Mode)
[06/08-11:25:33:531]Board: SMDK6410
[06/08-11:25:33:533]DRAM: 256 MB
[06/08-11:25:33:549]Flash: 0 kB
[06/08-11:25:33:549]NAND Flash: 2048 MB
[06/08-11:25:34:671]********************************************************
[06/08-11:25:34:671]Initial LCD controller
[06/08-11:25:34:684] clk_freq:9 MHz, div_freq:13 ,rea_freq:9 MHz
[06/08-11:25:34:684]
[06/08-11:25:34:685] HBP = 2 HFP = 2 HSW = 41,Hpixs:480
[06/08-11:25:34:685] VBP = 2 VFP = 2 VSW = 10,Vpixs:272
[06/08-11:25:34:703]FrameBuff:57e7a000
[06/08-11:25:34:703] LCD initialization Finished.
[06/08-11:25:34:704]********************************************************
[06/08-11:25:34:724]In: serial
[06/08-11:25:34:724]
[06/08-11:25:34:724]Out: lcd
[06/08-11:25:34:726]
[06/08-11:25:34:726]Err: lcd
[06/08-11:25:34:728]
[06/08-11:25:35:082]Net: DM9000
[06/08-11:25:36:099]Hit any key to stop autoboot: 0
[06/08-11:25:36:099]
[06/08-11:25:36:099]NAND read:
[06/08-11:25:36:100]device 0 offset 0x100000, size 0x500000
[06/08-11:25:36:101]
[06/08-11:25:39:365] 5242880 bytes read: OK
[06/08-11:25:39:365]
[06/08-11:25:39:365]## Booting kernel from Legacy Image at 50008000 ...
[06/08-11:25:39:365]
[06/08-11:25:39:367] Image Name: Linux-3.14.4
[06/08-11:25:39:383]
[06/08-11:25:39:385] Image Type: ARM Linux Kernel Image (uncompressed)
[06/08-11:25:39:402]
[06/08-11:25:39:403] Data Size: 1638488 Bytes = 1.6 MB
[06/08-11:25:39:418]
[06/08-11:25:39:419] Load Address: 50008000
[06/08-11:25:39:443]
[06/08-11:25:39:443] Entry Point: 50008040
[06/08-11:25:39:456]
[06/08-11:25:39:780] Verifying Checksum ... OK
[06/08-11:25:39:798]
[06/08-11:25:39:799] XIP Kernel Image ... OK
[06/08-11:25:39:811]
[06/08-11:25:39:812]OK
[06/08-11:25:39:829]
[06/08-11:25:39:830]
[06/08-11:25:39:830]Starting kernel ...
[06/08-11:25:39:830]
[06/08-11:25:39:842]
[06/08-11:25:39:860]
[06/08-11:25:39:874]
[06/08-11:25:40:162]Uncompressing Linux... done, booting the kernel.
[06/08-11:25:40:960]Booting Linux on physical CPU 0x0
[06/08-11:25:40:972]Linux version 3.14.4 (simiar@Embedded) (gcc version 4.4.3 (ctng-1.6.1) ) #1 Sun Jun 8 11:10:52 CST 2014
[06/08-11:25:40:976]CPU: ARMv6-compatible processor [410fb766] revision 6 (ARMv7), cr=00c5387d
[06/08-11:25:40:984]CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
[06/08-11:25:40:984]Machine: OK6410
[06/08-11:25:40:985]Ignoring unrecognised tag 0x54410008
[06/08-11:25:40:995]Memory policy: Data cache writeback
[06/08-11:25:40:995]CPU S3C6410 (id 0x36410101)
[06/08-11:25:40:995]CPU: found DTCM0 8k @ 00000000, not enabled
[06/08-11:25:40:996]CPU: moved DTCM0 8k to fffe8000, enabled
[06/08-11:25:41:006]CPU: found DTCM1 8k @ 00000000, not enabled
[06/08-11:25:41:006]CPU: moved DTCM1 8k to fffea000, enabled
[06/08-11:25:41:006]CPU: found ITCM0 8k @ 00000000, not enabled
[06/08-11:25:41:017]CPU: moved ITCM0 8k to fffe0000, enabled
[06/08-11:25:41:017]CPU: found ITCM1 8k @ 00000000, not enabled
[06/08-11:25:41:018]CPU: moved ITCM1 8k to fffe2000, enabled
[06/08-11:25:41:027]Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024
[06/08-11:25:41:038]Kernel command line: root=/dev/nfs nfsroot=192.168.1.100:/home/simiar/share/myproject/ok6410/filesystem/ok6410_fs ip=192.168.1.50:192.168.1.100:192.168.1.1:255.255.255.0::eth0:off console=ttySAC0,115200
[06/08-11:25:41:050]PID hash table entries: 1024 (order: 0, 4096 bytes)
[06/08-11:25:41:061]Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[06/08-11:25:41:061]Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[06/08-11:25:41:077]Memory: 256464K/262144K available (2173K kernel code, 175K rwdata, 664K rodata, 118K init, 198K bss, 5680K reserved)
[06/08-11:25:41:080]Virtual kernel memory layout:
[06/08-11:25:41:084] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[06/08-11:25:41:084] DTCM : 0xfffe8000 - 0xfffec000 ( 16 kB)
[06/08-11:25:41:085] ITCM : 0xfffe0000 - 0xfffe4000 ( 16 kB)
[06/08-11:25:41:094] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
[06/08-11:25:41:095] vmalloc : 0xd0800000 - 0xff000000 ( 744 MB)
[06/08-11:25:41:106] lowmem : 0xc0000000 - 0xd0000000 ( 256 MB)
[06/08-11:25:41:106] modules : 0xbf000000 - 0xc0000000 ( 16 MB)
[06/08-11:25:41:107] .text : 0xc0008000 - 0xc02cd674 (2838 kB)
[06/08-11:25:41:117] .init : 0xc02ce000 - 0xc02eb99c ( 119 kB)
[06/08-11:25:41:118] .data : 0xc02ec000 - 0xc0317f00 ( 176 kB)
[06/08-11:25:41:128] .bss : 0xc0318000 - 0xc0349ac8 ( 199 kB)
[06/08-11:25:41:128]SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[06/08-11:25:41:128]NR_IRQS:246
[06/08-11:25:41:139]S3C6410 clocks: apll = 533000000, mpll = 533000000
[06/08-11:25:41:139] epll = 24000000, arm_clk = 533000000
[06/08-11:25:41:140]VIC @f6000000: id 0x00041192, vendor 0x41
[06/08-11:25:41:151]VIC @f6010000: id 0x00041192, vendor 0x41
[06/08-11:25:41:151]sched_clock: 32 bits at 33MHz, resolution 30ns, wraps every 128929599457ns
[06/08-11:25:41:152]Console: colour dummy device 80x30
[06/08-11:25:41:161]Calibrating delay loop... 531.66 BogoMIPS (lpj=2658304)
[06/08-11:25:41:161]pid_max: default: 32768 minimum: 301
[06/08-11:25:41:172]Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[06/08-11:25:41:172]Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[06/08-11:25:41:173]CPU: Testing write buffer coherency: ok
[06/08-11:25:41:187]Setting up static identity map for 0x50214f90 - 0x50214fec
[06/08-11:25:41:194]VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
[06/08-11:25:41:194]DMA: preallocated 256 KiB pool for atomic coherent allocations
[06/08-11:25:41:195]OK6410: Option string ok6410=0
[06/08-11:25:41:205]OK6410: selected LCD display is 480x272
[06/08-11:25:41:205]S3C6410: Initialising architecture
上一篇:S3C6410嵌入式应用平台构建(五)——linux-3.14.4移植到OK6410-(Nand分区问题)
下一篇:S3C6410嵌入式应用平台构建(三)
推荐阅读最新更新时间:2024-11-10 11:00
设计资源 培训 开发板 精华推荐
- M52235EVB: MCF52235 Evaluation Board
- 1.01.05_USB WIFI
- OP113FSZ-REEL7精密称重传感器秤放大器的典型应用
- ADF4118EBZ1,用于无线局域网 ADF4118 PLL 时钟发生器的评估板
- SPIRIT1-低数据速率收发器-868 MHz-子板
- #第五届立创电子设计大赛#智能助听器/USB声卡
- 超迷你EV2400 Ti锂保芯片调试器
- 使用 Analog Devices 的 LTC3646EMSE 的参考设计
- DER-701 - 27 W USB PD 3.0,采用 3.3 V-11 V PPS 电源,使用 InnoSwitch3-Pro 和 VIA Labs VP302 控制器
- ESP32挂件