Is flash_header.S file relevant with newer android O uboot

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is flash_header.S file relevant with newer android O uboot

773 Views
mrigendra_chaub
Contributor III

I am using uboot 2017.03 for sabreauto android, and I am trying to use flash_header.S

I still do not understand how plugin image works.

When I flash my uboot.bin with fsl-sdcard-partition.sh. I will show 

 

mrigendra.chaubey@CPU-384U:~/uboot-imx_android_sabreauto$ sudo hexdump -C /dev/sdf
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001c0 01 00 ee fe ff ff 01 00 00 00 ff af e2 0e 00 00 |................|
000001d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
00000200 45 46 49 20 50 41 52 54 00 00 01 00 5c 00 00 00 |EFI PART....\...|
00000210 ff 8a 6c dd 00 00 00 00 01 00 00 00 00 00 00 00 |..l.............|
00000220 ff af e2 0e 00 00 00 00 22 00 00 00 00 00 00 00 |........".......|
00000230 de af e2 0e 00 00 00 00 8b 43 02 05 72 4d ed 4a |.........C..rM.J|
00000240 be 85 17 f1 e3 69 c2 32 02 00 00 00 00 00 00 00 |.....i.2........|
00000250 80 00 00 00 80 00 00 00 86 d2 54 ab 00 00 00 00 |..........T.....|
00000260 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000400 36 07 00 ea 00 00 00 00 00 00 00 00 00 00 00 00 |6...............| ---------> b _start at 1KiB
00000410 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000800 d1 00 20 40 58 74 90 00 00 00 00 00 00 00 00 00 |.. @Xt..........| ---------------> ivt header at 2KiB

 

above dump is taken when I created a GPT partition table on the sd card using gparted.

Then I put my uboot.bin as 

 

sudo dd if=u-boot.bin of=/dev/sdf bs=512 seek=2

 

This do not work? Why?

 

Now if I overwrite over partition table as 

 

sudo dd if=u-boot.bin of=/dev/sdf bs=512K count=1

 

and hexdump 

 

00000000 36 07 00 ea 00 00 00 00 00 00 00 00 00 00 00 00 |6...............|  ---------> b _start at 0
00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000400 d1 00 20 40 58 74 90 00 00 00 00 00 00 00 00 00 |.. @Xt..........|  ---------> ivt header at 1kiB
00000410 20 74 90 00 00 74 90 00 00 00 00 00 00 00 00 00 | t...t..........|
00000420 00 70 90 00 00 20 00 00 01 00 00 00 d1 00 20 40 |.p... ........ @|

 

This works after flashing.

 

So my problem is, with gpt partition table my image is not working. Somehow offsets are getting wrong as I can see that gpt header is at 0x800 or at 2KiB offset.

I want to flash this image using  fsl-sdcard-partition.sh,that also creates gpt partition table. In that case also it will not work. Then how can I use this uboot for android?

  

How big chunk ROM code copies from SD card  for plugin image?

From the TRM it says that load region is 4 Kbyte. That means ROM takes first 4k from SD card with gpt partition table too? 

If thats the case why ROM code can't find ivt header because still my ivt header is inside that 4k?

Can you tell where I am wrong? 

flash_header.S reference i am taking from here,

 

https://git.congatec.com/arm/qmx6_uboot/commit/476a853fac44b27c6a84f52b002e15e957f06d4f 

P.S.

I cannot track changes that what is done in order to change flash_header.S and it become plugin.S. on git log plugin.S nothing useful comes up.

on further search I saw this thread 

https://community.nxp.com/docs/DOC-340444 

but with no answer, but my question is same.

Labels (1)
0 Kudos
2 Replies

515 Views
diegoadrian
NXP Employee
NXP Employee

Hello,

Are you using our BSP? Since the build output does not provide the boot.bin.

Probably the error comes for that reason, you need to use the uboot.imx, since that image has the ivt header and the DRD list. Something that the boot.bin does not have.

Please try using the uboot.imx image.

Best Regards,

Diego.

0 Kudos

515 Views
mrigendra_chaub
Contributor III

In past there must be a flash_header.S file provided by NXP.

u-boot.imx6/flash_header.S at master · rabeeh/u-boot.imx6 · GitHub 

I am trying to customize newer android BSP with flash_header.S . my uboot.bin have the IVT header, but it is hardcoded. In newer versions its dynamically generated.

flash_header.S have one extra thing that is 

b _start

that instruction only changes the offset and then uboot.bin can't be used in place of android bsp's uboot.

I am currently changing flash_header.S file so that it can be used to generate uboot.imx. But I don't know much of assembly

Can you tell me in the newer mx6_plugin.S file, after ROM code finish working with it, where the control goes?

Does it go to start.S or Vector.S?

Also in newer code why this is done

push {r0-r4, lr}

and not 

push {r0-r6, lr}

I am asking it because I am trying to use the later as those are needed in my case.

pop {r0-r6, lr} /* pop r0,..., lr from stack*/
push {r5}
ldr r5, boot_data2
str r5, [r0]
ldr r5, image_len2
str r5, [r1]
ldr r5, second_ivt_offset
str r5, [r2]
mov r0, #1
pop {r5}

/* return back to ROM code */
bx lr

Does ROM code decides in this code where the uboot code will start? I can't decide whether my changes are effective or not because I don't see any 

b _start  or b _reset happening to uboot code. So how does mx6_plugin.S file work successfully? In my case I have kept this file as it is but changes some code for my use case like this

adr r0, boot_data2 /*load boot_data2 address in r0*/
adr r1, image_len2
adr r2, boot_data2

this, 

pop {r0-r6, lr} /* pop r0,..., lr from stack*/
push {r5}
ldr r5, boot_data2
str r5, [r0]
ldr r5, image_len2
str r5, [r1]
ldr r5, second_ivt_offset
str r5, [r2]
mov r0, #1
pop {r5}

/* return back to ROM code */
bx lr

and this 

second_ivt_offset: .long (ivt2_header + 0x2C + FLASH_OFFSET)

/*
* The following is the second IVT header plus the second boot data
*/
ivt2_header: .long 0x0
app2_code_jump_v: .long 0x0
reserv3: .long 0x0
dcd2_ptr: .long 0x0
boot_data2_ptr: .long 0x0
self_ptr2: .long 0x0
app_code_csf2: .long 0x0
reserv4: .long 0x0
boot_data2: .long 0x0
image_len2: .long 0x0
plugin2: .long 0x0

All of this code is inside my changes mx6_plugin.S.

So can I be sure that my u-boot.imx will get to the starting point of uboot after plugin finishes its work? Aren there any size limitation to plugin image or any register usage restriction like r4 to r6 can't be used?

0 Kudos