OpenNuvoton / NUC970_U-Boot_v2016.11

U-Boot v2016.11 for NUC970, N9H30, and NUC980
28 stars 45 forks source link

how to support device tree? #5

Closed rainwonder closed 5 years ago

rainwonder commented 5 years ago

───────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │
│ │ [] Support Flattened Image Tree │ │
│ │ [ ] Support Flattened Image Tree within SPL │ │
│ │ [ ] Display verbose messages on FIT boot │ │
│ │ [ ] Select the best match for the kernel device tree │ │
│ │ [ ] Show verbose messages when FIT images fails │ │
│ │ () Extra Options (DEPRECATED) │ │
│ │ [ ] Enable SPL loading U-Boot as a FIT │ │
│ │ [ ] Enable SPL with DFU to load binaries to memory device │ │
│ │ [
] Enable arch_fixup_fdt() call and then

U-Boot 2016.11 (Aug 24 2018 - 14:23:53 +0800)

CPU: NUC972 Board: NUC970 DRAM: 64 MiB NAND: 4863 MiB

can not start uboot

yachen commented 5 years ago

Hi,

Currently NUC970 driver in U-Boot does not support device tree.

Sincerely,

Yi-An Chen

rainwonder commented 5 years ago

Hi

If I want to support the device tree to start the kernel, how should I modify the uboot and kernel?

Sincerely

yachen commented 5 years ago

Hi,

970's U-Boot driver does not support device tree. But U-Boot can still pass .dtb to kernel.

Enable following kernel options in menuconfig. [] Flattened Device Tree support [] Support for the traditional ATAGS boot data passing

Enable following u-boot option

define CONFIG_OF_LIBFDT

define CONFIG_FIT

Sincerely,

Yi-An Chen

rainwonder commented 5 years ago

Hi, Yes, I have chosen these two options, but can not start uboot.

rainwonder commented 5 years ago

default

yachen commented 5 years ago

Hmmm, my u-boot works fine with those two options enabled. So your u-boot works fine without those two options? What NAND flash are you using?

Sincerely,

Yi-An Chen

rainwonder commented 5 years ago

The NAND I used is H27U1G8F2B (Rev0.1) -nand flash 128M.

yachen commented 5 years ago

U-boot shows NAND capacity as 4351MB... What is PA[6:9] power on setting status on your board? Please keep them as high.

rainwonder commented 5 years ago

My PA[6:9] is full of pins, I'm not sure whether it is high, I use a voltmeter to try

yachen commented 5 years ago

What board are you using?

rainwonder commented 5 years ago

default

yachen commented 5 years ago

Please check SW35 on your board.

rainwonder commented 5 years ago

default SW35 choose on

yachen commented 5 years ago

If you re-build uboot with nuc970_defconfig, can it boot on your board?

rainwonder commented 5 years ago

Do not choose those two options?

rainwonder commented 5 years ago

use >make nuc970_defconfig

make all

rainwonder commented 5 years ago

Hmmmm,This setting can start uboot.

rainwonder commented 5 years ago

But when I choose those two options, I can't start uboot.

rainwonder commented 5 years ago

default make menuconfig in uboot,i choose those two options,

yachen commented 5 years ago

Un-select support flattened image tree within SPL and test again. You only need to trun on following two options.

define CONFIG_OF_LIBFDT

define CONFIG_FIT

And after restore default config, does your U-Boot shows correct NAND size?

rainwonder commented 5 years ago

yes,it shows correct NAND size,iwill try agin,I just need to modify include/configs/nuc970_evb.h ,and then make nuc970_defconfig,Do I not need to specify the address of *dtb in uboot?

rainwonder commented 5 years ago

Yeah, Two options were opened, but the compiler failed. default

Do I need to open some more options?

yachen commented 5 years ago

Please paste your .config file here.

rainwonder commented 5 years ago

config.txt

rainwonder commented 5 years ago

This is my .config

yachen commented 5 years ago

Can you sync your repository and test again. I have to answer some config options while trying to build your config. But the build is fine, didn't see the error you reported.

rainwonder commented 5 years ago

After I try again,still see the error reported.No need to answer some config option when I build my config. i show you my command to build uboot,

vim include/configs/nuc970_evb.h -> add #define CONFIG_OF_LIBFDT #define CONFIG_FIT make nuc970_defconfig make ARCH=arm CROSS_COMPILE=arm-linux- all

yachen commented 5 years ago

Enable those two options in header file seems break some dependency rule. Please enable them with menuconfig. Anyway, attached is my config file. config_ok.txt

rainwonder commented 5 years ago

Oh,There is no need to add #define CONFIG_OF_LIBFDT #define CONFIG_FIT to inlcude/configs/nuc970_evb.h. just make menuconfig is ok. default default

But didn't start uboot whith nand,

yachen commented 5 years ago

Can you attach the u-boot.bin that failed to boot up here?

rainwonder commented 5 years ago

u-boot.txt this is my uboot.bin

yachen commented 5 years ago

Did you enable other features except device tree? Your u-boot.bin exceed CONFIG_SYS_NAND_U_BOOT_SIZE defined in nuc970_evb.h. Please enlarge this value and rebuild u-boot SPL.

U-Boot 2016.11 (Aug 30 2018 - 11:33:20 +0800)

CPU: NUC972 Board: NUC970 DRAM: 64 MiB NAND: 128 MiB *** Warning - bad CRC, using default environment

In: serial Out: serial Err: serial Net: emac Error: emac address not set.

rain=>

rainwonder commented 5 years ago

Yeah,it is ok! Thanks a lot for your help.

rainwonder commented 5 years ago

An error occurred when I added the FDT address. err: libfdt fdt_check_header(): FDT_ERR_BADMAGIC

I look for source code. (fdt_magic(fdt) == FDT_MAGIC) is not eq. Is the address of command(FDT ad) fixed?

yachen commented 5 years ago

How do you set the FDT address? Have you try to pass the address to bootm command?

rainwonder commented 5 years ago

command ->: fdt addr 0x600000

rainwonder commented 5 years ago

Hi, What is the problem of my command

yachen commented 5 years ago

nothing's wrong. You need to load the dtb file to the offset first.

=> nand read 0x600000 0x200000 0x100000

NAND read: device 0 offset 0x200000, size 0x100000 1048576 bytes read: OK => fdt addr 0x600000 =>

rainwonder commented 5 years ago

I have download the dtb and kernel,then just use command =>bootm 0x7fc0 default spi pin is off. The nuc972.dts in kernel needs to be modified .

yachen commented 5 years ago

That message's from U-Boot. Please rebuid U-Boot with SPI disabled if you don't need it.

rainwonder commented 5 years ago

image I have already SPI disabled and rebuild U-boot

yachen commented 5 years ago

That string is coming from U-Boot, not kernel. Please check again. SPI flash support is still enabled in U-Boot.

rainwonder commented 5 years ago

image

rainwonder commented 5 years ago

I have disabled spi-flash and rebuid u-boot, but the same error occurred during startup

yachen commented 5 years ago

Please check your .config file make make sure SPI related stuffs are disabled.

rainwonder commented 5 years ago

default dtb is not correct?

yachen commented 5 years ago

You need to pass the dtb address to kernel.