UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Participant eduardoparra
Participant
1,495 Views
Registered: ‎06-28-2016

Modify u-boot enviroment from Linux

Hi, i'm working on a Zcu102 EvaluationBoard (ZynqUltraScale+), and i'm trying to modify an u-boot env parameter from UserSpace on Linux. The idea is that my software can change the boot mode and reset the board. I'm using "fw_setenv" to modify the parameter but it's not worknig, i receive the following :

 

root@Petalinux_Project:~# fw_setenv boolPrueba 1
Warning: Bad CRC, using default environment
[   73.741483] random: nonblocking pool is initialized
[   73.837745] m25p80 spi0.0: SPI transfer timed out
[   73.842398] m25p80 spi0.0: error -110 reading 5
[   73.846892] error -110 reading SR
[   76.841758] m25p80 spi0.0: SPI transfer timed out
[   76.846401] m25p80 spi0.0: error -110 reading 5
[   76.850900] error -110 reading SR
[   76.989743] m25p80 spi0.0: SPI transfer timed out
[   76.994384] m25p80 spi0.0: error -110 reading 70
[   76.998972] error -110 reading FSR
[   77.004898] irq 206: nobody cared (try booting with the "irqpoll" option)
[   77.020150] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G           O    4.6.0 #93
[   77.027263] Hardware name: ZynqMP ZCU102 (DT)
[   77.031602] Call trace:
[   77.034039] [<ffffff8008089860>] dump_backtrace+0x0/0x198
[   77.039418] [<ffffff8008089a0c>] show_stack+0x14/0x20
[   77.044452] [<ffffff80083badec>] dump_stack+0x94/0xb8
[   77.049487] [<ffffff80080d9a88>] __report_bad_irq+0x38/0xe8
[   77.055041] [<ffffff80080d9e1c>] note_interrupt+0x20c/0x2f0
[   77.060596] [<ffffff80080d71f4>] handle_irq_event_percpu+0xd4/0x140
[   77.066845] [<ffffff80080d72a4>] handle_irq_event+0x44/0x78
[   77.072401] [<ffffff80080da99c>] handle_fasteoi_irq+0xb4/0x1a8
[   77.078216] [<ffffff80080d678c>] generic_handle_irq+0x24/0x38
[   77.083945] [<ffffff80080d6ac4>] __handle_domain_irq+0x5c/0xb8
   77.089741] m25p80 spi0.0: SPI transfer timed out
[   77.089753] m25p80 spi0.0: error -110 reading 5
[   77.089754] error -110 reading SR
[   77.113282] [<ffffff80080824bc>] gic_handle_irq+0x64/0xc0
[   77.118664] Exception stack(0xffffffc86ff52e00 to 0xffffffc86ff52f20)
[   77.125089] 2e00: ffffffc86ff52e30 0000000000000000 ffffffc86ff52f50 ffffff800809efdc
[   77.132907] 2e20: 0000000040000145 ffffff8008050000 0000000000000000 ffffff8008b33c00
[   77.140719] 2e40: ffffff8008ab1000 ffffff800861c9c0 000000001999999a 0000000000000020
[   77.148530] 2e60: 0009c67100000000 ffffff80087c0ec8 0000000000000020 00003d0900000000
[   77.156342] 2e80: ffffffc86ff58030 ffffff80087c0e9c 0000000000000000 0000000000000000
[   77.164154] 2ea0: 0000000000000000 0000000000000019 0000000000000001 0000000000000007
[   77.171966] 2ec0: 000000000000000e ffffff8008ab1000 0000000000000000 ffffff8008a8b000
[   77.179779] 2ee0: 0000000000000001 ffffff8008b33c00 ffffff8008050000 ffffff8008aac000
[   77.187590] 2f00: 00000000ffff2628 0000000000000082 ffffff8008aac000 ffffffc86ff52f50
Could not set obsolete flag: Connection timed out[   77.189741] m25p80 spi0.0: SPI transfer timed out
[   77.189752] m25p80 spi0.0: error -110 reading 5
[   77.189754] error -110 reading SR
[   77.212321] [<ffffff8008085720>] el1_irq+0xa0/0x100
[   77.217183] [<ffffff800809f3d0>] irq_exit+0x88/0xd0
[   77.222043] [<ffffff80080d6ac8>] __handle_domain_irq+0x60/0xb8
[   77.227859] [<ffffff80080824bc>] gic_handle_irq+0x64/0xc0
[   77.233239] Exception stack(0xffffffc86ff53050 to 0xffffffc86ff53170)
[   77.239663] 3040:                                   ffffff8008aafe00 ffffff8008aac000
[   77.247483] 3060: ffffff8008aaff20 ffffff8008086680 0000000060000145 ffffff8008a8ecf8
[   77.255294] 3080: ffffff8008aaff20 ffffff8008aafe00 0000000000000000 0000000000000000
[   77.263106] 30a0: ffffffc86b96af00 0000000000000000 0000000000000000 0000000000000000
[   77.270918] 30c0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[   77.278730] 30e0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[   77.286542] 3100: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[   77.294354] 3120: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[   77.302166] 3140: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[   77.309977] 3160: 0000000000000000 0000000000000000
[   77.314832] [<ffffff8008085720>] el1_irq+0xa0/0x100
[   77.319693] [<ffffff8008086680>] arch_cpu_idle+0x10/0x18
[   77.324990] [<ffffff80080cf79c>] cpu_startup_entry+0x144/0x1d8
[   77.330805] [<ffffff80087ace9c>] rest_init+0x6c/0x78
[   77.335754] [<ffffff8008a418d0>] start_kernel+0x308/0x31c
[   77.341132] [<ffffff80080811d8>] 0xffffff80080811d8
[   77.345991] handlers:
[   77.348251] [<ffffff8008542c20>] zynqmp_qspi_irq
[   77.352847] Disabling IRQ #206

In addition, if i reboot the board, it can't boot Linux, which i have stored on a differente partition on the flash than tjhe u-boot env, so i think that it has written on a wrong place of the QSPI

 

Any idea??

Thank you

0 Kudos
3 Replies
Participant eduardoparra
Participant
1,467 Views
Registered: ‎06-28-2016

Re: Modify u-boot enviroment from Linux

I have my fw_env.config wrong, now i have fixed it (i think):

 

# MTD device name    Device offset    Env. size    Flash sector size    Number of sectors
/dev/mtd1        0x0000        0x40000        0x2000

 

Now i can print my stored u-boot environment, but when i try to fw_setenv :

 

root@Petalinux_Project:~# fw_setenv a 1
[  113.963824] irq 206: nobody cared (try booting with the "irqpoll" option)
[  113.970541] CPU: 0 PID: 1583 Comm: fw_setenv Tainted: G           O    4.6.0 #93
[  113.977916] Hardware name: ZynqMP ZCU102 (DT)
[  113.982249] Call trace:
[  113.984686] [<ffffff8008089860>] dump_backtrace+0x0/0x198
[  113.990065] [<ffffff8008089a0c>] show_stack+0x14/0x20
[  113.995099] [<ffffff80083badec>] dump_stack+0x94/0xb8
[  114.000134] [<ffffff80080d9a88>] __report_bad_irq+0x38/0xe8
[  114.005688] [<ffffff80080d9e1c>] note_interrupt+0x20c/0x2f0
[  114.011243] [<ffffff80080d71f4>] handle_irq_event_percpu+0xd4/0x140
[  114.017492] [<ffffff80080d72a4>] handle_irq_event+0x44/0x78
[  114.023048] [<ffffff80080da99c>] handle_fasteoi_irq+0xb4/0x1a8
[  114.028863] [<ffffff80080d678c>] generic_handle_irq+0x24/0x38
[  114.034592] [<ffffff80080d6ac4>] __handle_domain_irq+0x5c/0xb8
[  114.040407] [<ffffff80080824bc>] gic_handle_irq+0x64/0xc0
[  114.045788] Exception stack(0xffffffc86ff52e00 to 0xffffffc86ff52f20)
[  114.052213] 2e00: ffffffc86ff52e30 0000000000000000 ffffffc86ff52f50 ffffff800809efdc
[  114.060031] 2e20: 0000000040000145 ffffff8008050000 0000000000000000 ffffff8008b33c00
[  114.067843] 2e40: ffffff8008ab1000 ffffff800861c9c0 000000001999999a 0000000000000020
[  114.075655] 2e60: 0010736d00000000 7fffffffffffffff 0000000000000020 ffffffc063bbe580
[  114.083467] 2e80: ffffffc86ff58030 ffffff80087c0e9c 0000000000000201 0000000000000000
[  114.091278] 2ea0: 0000000000000201 0000000000000019 0000000000000001 0000000000000007
[  114.099091] 2ec0: 000000000000000e ffffff8008ab1000 0000000000000000 ffffff8008a8b000
[  114.106903] 2ee0: 0000000000000001 ffffff8008b33c00 ffffff8008050000 ffffffc86bbd8000
[  114.114714] 2f00: 00000000ffff4a29 0000000000000002 ffffffc86bbd8000 ffffffc86ff52f50
[  114.122526] [<ffffff8008085720>] el1_irq+0xa0/0x100
[  114.127381] [<ffffff800809f3d0>] irq_exit+0x88/0xd0
[  114.132241] [<ffffff80080d6ac8>] __handle_domain_irq+0x60/0xb8
[  114.138056] [<ffffff80080824bc>] gic_handle_irq+0x64/0xc0
[  114.143437] Exception stack(0xffffffc86ff53050 to 0xffffffc86ff53170)
[  114.149862] 3040:                                   ffffffc86bbdb690 ffffffc86ad0c2d0
[  114.157681] 3060: ffffffc86bbdb7b0 ffffff80087b2438 0000000080000145 ffffffc86bbd8000
[  114.165493] 3080: ffffffc86bbdb7b0 ffffffc86bbdb690 0000000000000000 0000000000000000
[  114.173304] 30a0: ffffffc063bbed00 0000000000000000 0000000000000000 0000000000000000
[  114.181116] 30c0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[  114.188928] 30e0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[  114.196740] 3100: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[  114.204552] 3120: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[  114.212364] 3140: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[  114.220175] 3160: 0000000000000000 0000000000000000
[  114.225030] [<ffffff8008085720>] el1_irq+0xa0/0x100
[  114.229894] [<ffffff80087b2438>] schedule_timeout+0x20/0x1b0
[  114.235534] [<ffffff80087b06cc>] wait_for_common+0xcc/0x170
[  114.241089] [<ffffff80087b07a0>] wait_for_completion_timeout+0x10/0x18
[  114.247602] [<ffffff800853f1c0>] spi_transfer_one_message+0xf8/0x328
[  114.253936] [<ffffff800853f9f8>] __spi_pump_messages+0x320/0x470
[  114.259925] [<ffffff800853fd8c>] __spi_sync+0x21c/0x238
[  114.265133] [<ffffff800853ff18>] spi_write_then_read+0x138/0x220
[  114.271123] [<ffffff800852f8cc>] m25p80_read_reg+0x34/0x78
[  114.276590] [<ffffff8008539ca0>] read_sr+0x28/0x90
[  114.281364] [<ffffff8008539ee8>] spi_nor_wait_till_ready_with_timeout+0x50/0x140
[  114.288748] [<ffffff800853a3ac>] spi_nor_unlock+0x7c/0x168
[  114.294210] [<ffffff800851c158>] part_unlock+0x20/0x28
[  114.299333] [<ffffff8008519184>] mtd_unlock+0x44/0x60
[  114.304365] [<ffffff800851e46c>] mtdchar_ioctl+0x644/0xe08
[  114.309834] [<ffffff800851ec6c>] mtdchar_unlocked_ioctl+0x3c/0x60
[  114.315912] [<ffffff800818ff3c>] do_vfs_ioctl+0xa4/0x748
[  114.321205] [<ffffff8008190624>] SyS_ioctl+0x44/0x80
[  114.326152] [<ffffff8008085e30>] el0_svc_naked+0x24/0x28
[  114.331445] handlers:
[  114.333703] [<ffffff8008542c20>] zynqmp_qspi_irq
[  114.338300] Disabling IRQ #206
[  114.437721] m25p80 spi0.0: SPI transfer timed out
[  114.442356] m25p80 spi0.0: error -110 reading 5
[  114.446862] error -110 reading SR
[  114.553714] m25p80 spi0.0: SPI transfer timed out
[  114.558345] m25p80 spi0.0: error -110 reading 5
[  114.562852] error -110 reading SR
MTD erase error on /dev/mtd1: Connection timed out
Error: can't write fw_env to flash
0 Kudos
Voyager
Voyager
1,435 Views
Registered: ‎09-14-2016

Re: Modify u-boot enviroment from Linux

0 Kudos
Contributor
Contributor
48 Views
Registered: ‎10-02-2018

Re: Modify u-boot enviroment from Linux

Hi, Once I writing as “is-dual = <0>” in my device tree and build. Then I program flash

I can't get kernel image:

SF: Detected n25q512a with page size 256 Bytes, erase size 64 KiB, total 64 MiB
device 0 offset 0xf40000, size 0x1400000
SF: 20971520 bytes @ 0xf40000 Read: OK
Wrong Image Format for bootm command
ERROR: can't get kernel image!
ZynqMP>

if writing as “is-dual = <0x1>, I can build and boot successfull from flash.

How do you solve this problem

0 Kudos