Patchwork [U-Boot,v5,1/2] qi_lb60: add nand spl support

login
register
mail settings
Submitter Xiangfu Liu
Date Oct. 13, 2012, 12:24 p.m.
Message ID <50795D9A.9010908@openmobilefree.net>
Download mbox | patch
Permalink /patch/191297/
State Changes Requested
Delegated to: Daniel Schwierzeck
Headers show

Comments

Xiangfu Liu - Oct. 13, 2012, 12:24 p.m.
On 10/13/2012 10:59 AM, Marek Vasut wrote:
>> From: Xiangfu <xiangfu@openmobilefree.net>
>> > 
>> >   The JZ4740 CPU can load 8KB from two different addresses:
>> >    1. the normal area up to 8KB starting from NAND flash address 0x00000000
>> >    2. the backup area up to 8KB starting from NAND flash address 0x00002000
>> > 
>> >   After create u-boot-spl.bin. it needs those 4 commands create final image
>> > for jz4740 cpu. ~~~~
>> >     dd if=spl/u-boot-spl.bin of=u-boot-nand.bin conv=sync bs=8192 count=1
>> >     dd if=spl/u-boot-spl.bin of=u-boot-nand.bin conv=sync,notrunc
>> > oflag=append bs=8192 count=1 tr '\0' '\377' < /dev/zero | dd
>> > of=u-boot-nand.bin conv=sync,notrunc oflag=append bs=16384 count=1 cat
>> > u-boot-nand.bin u-boot.bin > u-boot-nand-final.bin
>> >   ~~~~
> Can you not do this in the linker script? Or implement CPU-specific build target 
> that does this?

Hi Marex

Thanks for reply, I don't know how to do this in linker script. but I have plan
to send out a patch on Makefile. 

Attachment is the patch. do you think it is ok for upstream? if it's ok. I will
send out this patch in another email.

Xiangfu
Marek Vasut - Oct. 13, 2012, 12:50 p.m.
Dear Xiangfu Liu,

> On 10/13/2012 10:59 AM, Marek Vasut wrote:
> >> From: Xiangfu <xiangfu@openmobilefree.net>
> >> 
> >> >   The JZ4740 CPU can load 8KB from two different addresses:
> >> >    1. the normal area up to 8KB starting from NAND flash address
> >> >    0x00000000 2. the backup area up to 8KB starting from NAND flash
> >> >    address 0x00002000
> >> >   
> >> >   After create u-boot-spl.bin. it needs those 4 commands create final
> >> >   image
> >> > 
> >> > for jz4740 cpu. ~~~~
> >> > 
> >> >     dd if=spl/u-boot-spl.bin of=u-boot-nand.bin conv=sync bs=8192
> >> >     count=1 dd if=spl/u-boot-spl.bin of=u-boot-nand.bin
> >> >     conv=sync,notrunc
> >> > 
> >> > oflag=append bs=8192 count=1 tr '\0' '\377' < /dev/zero | dd
> >> > of=u-boot-nand.bin conv=sync,notrunc oflag=append bs=16384 count=1 cat
> >> > u-boot-nand.bin u-boot.bin > u-boot-nand-final.bin
> >> > 
> >> >   ~~~~
> > 
> > Can you not do this in the linker script? Or implement CPU-specific build
> > target that does this?
> 
> Hi Marex
> 
> Thanks for reply, I don't know how to do this in linker script. but I have
> plan to send out a patch on Makefile.
> 
> Attachment is the patch. do you think it is ok for upstream? if it's ok. I
> will send out this patch in another email.

This is CPU-specific , right? So it should be some kind of CPU-specific override 
in CPU-specific directory, not polute the main Makefile.

Best regards,
Marek Vasut
Xiangfu Liu - Oct. 13, 2012, 1:12 p.m.
Hi Marek

I will look into CPU-specific. come out with new patches.

Xiangfu
On 10/13/2012 08:50 PM, Marek Vasut wrote:
> This is CPU-specific , right? So it should be some kind of CPU-specific override 
> in CPU-specific directory, not polute the main Makefile.
> 
> Best regards,
> Marek Vasut
>

Patch

diff --git a/Makefile b/Makefile
index 34d9075..55fc72d 100644
--- a/Makefile
+++ b/Makefile
@@ -554,8 +554,16 @@  $(obj)u-boot.lds: $(LDSCRIPT)
 nand_spl:	$(TIMESTAMP_FILE) $(VERSION_FILE) depend
 		$(MAKE) -C nand_spl/board/$(BOARDDIR) all
 
+ifdef CONFIG_JZ4740
+$(obj)u-boot-nand.bin:	$(obj)u-boot.bin $(obj)spl/u-boot-spl.bin
+		dd if=$(obj)spl/u-boot-spl.bin of=$(obj)spl/u-boot-nand.bin conv=sync bs=8192 count=1
+		dd if=$(obj)spl/u-boot-spl.bin of=$(obj)spl/u-boot-nand.bin conv=sync,notrunc oflag=append bs=8192 count=1
+		tr '\0' '\377' < /dev/zero | dd of=$(obj)spl/u-boot-nand.bin conv=sync,notrunc oflag=append bs=16384 count=1
+		cat $(obj)spl/u-boot-nand.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
+else
 $(obj)u-boot-nand.bin:	nand_spl $(obj)u-boot.bin
 		cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
+endif
 
 $(obj)spl/u-boot-spl.bin:	$(SUBDIR_TOOLS) depend
 		$(MAKE) -C spl all