linux移植 id,linux-4.3 简易移植 (续)

,OK210 # nand info

Device 0: nand0, sector size 512 KiB

Page size       4096 b

OOB size         224 b

Erase size    524288 b

subpagesize     1024 b

options     0x   11000

bbt options 0x       0

OK210 #

现在修正好了。

然后将之前编译的uImage tftpboot下去执行看看会怎样。

OK210 # tftpboot 20000000 uImage

dm9000 i/o: 0x88000000, id: 0x90000a46

DM9000: running in 16 bit mode

MAC: 1a:2a:3a:4a:5a:6a

operating at 100M full duplex mode

Using dm9000 device

TFTP from server 192.168.80.2; our IP address is 192.168.80.1

Filename 'uImage'.

Load address: 0x20000000

Loading: #################################################################

######################################

3.5 MiB/s

done

Bytes transferred = 1508520 (1704a8 hex)

OK210 # nand info

Device 0: nand0, sector size 512 KiB

Page size 4096 b

OOB size 224 b

Erase size 524288 b

subpagesize 1024 b

options 0x 11000

bbt options 0x 0

OK210 # bootm 20000000

## Booting kernel from Legacy Image at 20000000 ...

Image Name: Linux-4.3.0

Image Type: ARM Linux Kernel Image (uncompressed)

Data Size: 1508456 Bytes = 1.4 MiB

Load Address: 20000000

Entry Point: 20000000

Verifying Checksum ... OK

Loading Kernel Image ... OK

FDT and ATAGS support not compiled in - hanging

### ERROR ### Please RESET the board ###

FDT and ATAGS support not compiled in,这句,FDT ATAGS不支持编译进内核?

不懂。但至少可以看到kernel镜像信息。

在.config中CONFIG_LIBFDT=y  CONFIG_ATAGS=y

这个是使用默认的s5pv210_defconfig。

FDT是什么?虽然在U-Boot中也见到过,但也不知道是什么。该怎么修改?

0818b9ca8b590ca3270a3433284dd417.png

在lib/Kconfig中,

./drivers/of/Kconfig:29:    select LIBFDT

./drivers/tty/serial/8250/Kconfig:364:    select LIBFDT

0818b9ca8b590ca3270a3433284dd417.png

新版本果然有很大变化,

System Type下ARM system type (Allow multiple platforms to be selected)  --->

支持多平台选择了。

选择了多平台支持,Multiple platform selection  --->

[*] ARMv7 based platforms (Cortex-A, PJ4, Scorpion, Krait)

[*] Samsung S5PV210/S5PC110

OK,暂时不管,既然是启动内核,那么这一句肯定是U-Boot输出的,看来还得修改。

arch/arm/lib/bootm.c:246:        printf("FDT and ATAGS support not compiled in - hanging\n");

if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len) {

#ifdef CONFIG_OF_LIBFDT

debug("using: FDT\n");

if (image_setup_linux(images)) {

printf("FDT creation failed! hanging...");

hang();

}

#endif

} else if (BOOTM_ENABLE_TAGS) {

只有这两种方式。

U-Boot中CONFIG_OF_LIBFDT=y选上了,所以按照这个来说,应该选择FDT。

#ifdef USE_HOSTCC

#include

/* new uImage format support enabled on host */

#define IMAGE_ENABLE_FIT        1

#define IMAGE_ENABLE_OF_LIBFDT  1

#define CONFIG_FIT_VERBOSE      1 /* enable fit_format_{error,warning}() */

#define IMAGE_ENABLE_IGNORE     0

#define IMAGE_INDENT_STRING     ""

#else

之前U-Boot中尝试过了,HOSTGCC是必选的,所以

#define IMAGE_ENABLE_OF_LIBFDT  1

./arch/arm/lib/bootm.c:347:        boot_prep_linux(images);

./arch/arm/lib/bootm.c:356:    boot_prep_linux(images);

---------------------------------------------------------------------------------------------

依linux community的要求,从linux-3.5后,新提交的code必须对device tree进行支持。下面介绍如何使u-boot支持device tree,以及fdt命令的使用。

1. u-boot对fdt(flattened device tree)的支持。

实现:只要加入

#

define CONFIG_OF_LIBFDT               /* Device Tree support */

重新编译u-boot,就可以实现对device tree的支持。

2. u-boot下的fdt命令使用

2.1 首先查看fdt的帮助信息。

------------------------------------------------

U-Boot> fdt

fdt - flattened device tree utility commands

Usage:

fdt addr [] - Set the fdt location to

fdt move - Copy the fdt to and make it active

fdt resize - Resize fdt to size + padding to 4k addr

fdt print [] - Recursive print starting at

fdt list [] - Print one level starting at

fdt set [] - Set [to ]

fdt mknode - Create a new node after

fdt rm [] - Delete the node or

fdt header - Display header info

fdt bootcpu - Set boot cpuid

fdt memory - Add/Update memory node

fdt rsvmem print - Show current mem reserves

fdt rsvmem add - Add a mem reserve

fdt rsvmem delete - Delete a mem reserves

fdt chosen [] - Add/update the /chosen branch in the tree

/ - initrd start/end addr

NOTE: Dereference aliases by omiting the leading '/', e.g. fdt print ethernet0.

U-Boot>

------------------------------------------------ 2.2 使用fdt命令

把device tree blob (dtb)文件下载到内存里。

-----------------------------------------

U-Boot> tftpboot 0x71000000 bshen/test-ek.dtb

-----------------------------------------

设置fdt的地址

-----------------------------------------

U-Boot> fdt addr 0x71000000

-----------------------------------------

然后就可以使用其余的命令参数了

-----------------------------------------

U-Boot> fdt header

magic: 0xd00dfeed

totalsize: 0x1887 (6279)

off_dt_struct: 0x38

off_dt_strings: 0x1648

off_mem_rsvmap: 0x28

version: 17

last_comp_version: 16

boot_cpuid_phys: 0x0

size_dt_strings: 0x23f

size_dt_struct: 0x1610

number mem_rsv: 0x0

-----------------------------------------

fdt print 不跟参数时,打印出整颗树

fdt print加path参数,则打path内容,如下(其中/memory是path):

-----------------------------------------

U-Boot> fdt print /memory

memory {

device_type = "memory";

reg = <0x70000000 0x4000000>;

};

-----------------------------------------

-----------------------------------------------------------------------------------------------------------

tftpboot 20000000 s5pv210-ok210.dtb

tftpboot 20010000 uImage

bootm 20000000 - 20010000

## Booting kernel from Legacy Image at 20010000 ...

Image Name:   Linux-4.3.0

Image Type:   ARM Linux Kernel Image (uncompressed)

Data Size:    1507472 Bytes = 1.4 MiB

Load Address: 20000000

Entry Point:  20000000

Verifying Checksum ... OK

## Flattened Device Tree blob at 20000000

Booting using the fdt blob at 0x20000000

Loading Kernel Image ... OK

ERROR: image is not a fdt - must RESET the board to recover.

FDT creation failed! hanging...### ERROR ### Please RESET the board ###

还是不行。

看了下网上资料,我傻了,拷贝的是U-Boot的,我说呢,U-Boot已经内嵌了,干嘛还要烧写。

我又傻了 20000000是uImage的load地址,dtb被覆盖了

OK210 # tftpboot 20010000 uImage

dm9000 i/o: 0x88000000, id: 0x90000a46

DM9000: running in 16 bit mode

MAC: 1a:2a:3a:4a:5a:6a

operating at 100M full duplex mode

Using dm9000 device

TFTP from server 192.168.80.2; our IP address is 192.168.80.1

Filename 'uImage'.

Load address: 0x20010000

Loading: #################################################################

######################################

3.5 MiB/s

done

Bytes transferred = 1507536 (1700d0 hex)

OK210 # tftpboot 20000000 s5pv210-goni.dtb

dm9000 i/o: 0x88000000, id: 0x90000a46

DM9000: running in 16 bit mode

MAC: 1a:2a:3a:4a:5a:6a

operating at 100M full duplex mode

Using dm9000 device

TFTP from server 192.168.80.2; our IP address is 192.168.80.1

Filename 's5pv210-goni.dtb'.

Load address: 0x20000000

Loading: ##

3.5 MiB/s

done

Bytes transferred = 29239 (7237 hex)

OK210 # bootm 20010000 - 20000000

## Booting kernel from Legacy Image at 20010000 ...

Image Name: Linux-4.3.0

Image Type: ARM Linux Kernel Image (uncompressed)

Data Size: 1507472 Bytes = 1.4 MiB

Load Address: 20010000

Entry Point: 20010000

Verifying Checksum ... OK

## Flattened Device Tree blob at 20000000

Booting using the fdt blob at 0x20000000

Loading Kernel Image ... OK

Loading Device Tree to 2fff5000, end 2ffff236 ... OK

Starting kernel ...       OK,下面就是要修正信息了,以符合OK210开发板的信息了。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值