Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH] MIPS: add uImage build target
@ 2013-08-21 14:55 James Hogan
  2013-08-21 14:55 ` James Hogan
  2013-08-21 15:08 ` Florian Fainelli
  0 siblings, 2 replies; 5+ messages in thread
From: James Hogan @ 2013-08-21 14:55 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: James Hogan, linux-mips

Add a uImage build target for MIPS, which builds uImage.gz (a U-Boot
image of vmlinux.bin.gz), and then symlinks it to uImage. This allows
for the use of other compression algorithms in future, and is how a few
other architectures do it.

The load address and entry address are calculated from the address of
the _text and kernel_entry symbols, by running nm on the main vmlinux
(based on arch/mips/lasat/image/Makefile).

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---
 arch/mips/Makefile        |  3 ++-
 arch/mips/boot/.gitignore |  1 +
 arch/mips/boot/Makefile   | 15 +++++++++++++++
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index b2be6b8..c4f339e 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -284,7 +284,7 @@ vmlinux.64: vmlinux
 all:	$(all-y)
 
 # boot
-vmlinux.bin vmlinux.ecoff vmlinux.srec: $(vmlinux-32) FORCE
+vmlinux.bin vmlinux.ecoff vmlinux.srec uImage: $(vmlinux-32) FORCE
 	$(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) arch/mips/boot/$@
 
 # boot/compressed
@@ -327,6 +327,7 @@ define archhelp
 	echo '  vmlinuz.ecoff        - ECOFF zboot image'
 	echo '  vmlinuz.bin          - Raw binary zboot image'
 	echo '  vmlinuz.srec         - SREC zboot image'
+	echo '  uImage               - U-Boot image (gzip)'
 	echo
 	echo '  These will be default as appropriate for a configured platform.'
 endef
diff --git a/arch/mips/boot/.gitignore b/arch/mips/boot/.gitignore
index f210b09..a73d6e2 100644
--- a/arch/mips/boot/.gitignore
+++ b/arch/mips/boot/.gitignore
@@ -4,3 +4,4 @@ vmlinux.*
 zImage
 zImage.tmp
 calc_vmlinuz_load_addr
+uImage
diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile
index 851261e..8169d42 100644
--- a/arch/mips/boot/Makefile
+++ b/arch/mips/boot/Makefile
@@ -40,3 +40,18 @@ quiet_cmd_srec = OBJCOPY $@
       cmd_srec = $(OBJCOPY) -S -O srec $(strip-flags) $(VMLINUX) $@
 $(obj)/vmlinux.srec: $(VMLINUX) FORCE
 	$(call if_changed,srec)
+
+UIMAGE_LOADADDR  = $(shell $(NM) $(VMLINUX) | grep "\b_text\b"        | cut -f1 -d\ )
+UIMAGE_ENTRYADDR = $(shell $(NM) $(VMLINUX) | grep '\bkernel_entry\b' | cut -f1 -d\ )
+
+$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
+	$(call if_changed,gzip)
+
+targets += uImage.gz
+$(obj)/uImage.gz: $(obj)/vmlinux.bin.gz FORCE
+	$(call if_changed,uimage,gzip)
+
+targets += uImage
+$(obj)/uImage: $(obj)/uImage.gz FORCE
+	@ln -sf $(notdir $<) $@
+	@echo '  Image $@ is ready'
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] MIPS: add uImage build target
  2013-08-21 14:55 [PATCH] MIPS: add uImage build target James Hogan
@ 2013-08-21 14:55 ` James Hogan
  2013-08-21 15:08 ` Florian Fainelli
  1 sibling, 0 replies; 5+ messages in thread
From: James Hogan @ 2013-08-21 14:55 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: James Hogan, linux-mips

Add a uImage build target for MIPS, which builds uImage.gz (a U-Boot
image of vmlinux.bin.gz), and then symlinks it to uImage. This allows
for the use of other compression algorithms in future, and is how a few
other architectures do it.

The load address and entry address are calculated from the address of
the _text and kernel_entry symbols, by running nm on the main vmlinux
(based on arch/mips/lasat/image/Makefile).

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---
 arch/mips/Makefile        |  3 ++-
 arch/mips/boot/.gitignore |  1 +
 arch/mips/boot/Makefile   | 15 +++++++++++++++
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index b2be6b8..c4f339e 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -284,7 +284,7 @@ vmlinux.64: vmlinux
 all:	$(all-y)
 
 # boot
-vmlinux.bin vmlinux.ecoff vmlinux.srec: $(vmlinux-32) FORCE
+vmlinux.bin vmlinux.ecoff vmlinux.srec uImage: $(vmlinux-32) FORCE
 	$(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) arch/mips/boot/$@
 
 # boot/compressed
@@ -327,6 +327,7 @@ define archhelp
 	echo '  vmlinuz.ecoff        - ECOFF zboot image'
 	echo '  vmlinuz.bin          - Raw binary zboot image'
 	echo '  vmlinuz.srec         - SREC zboot image'
+	echo '  uImage               - U-Boot image (gzip)'
 	echo
 	echo '  These will be default as appropriate for a configured platform.'
 endef
diff --git a/arch/mips/boot/.gitignore b/arch/mips/boot/.gitignore
index f210b09..a73d6e2 100644
--- a/arch/mips/boot/.gitignore
+++ b/arch/mips/boot/.gitignore
@@ -4,3 +4,4 @@ vmlinux.*
 zImage
 zImage.tmp
 calc_vmlinuz_load_addr
+uImage
diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile
index 851261e..8169d42 100644
--- a/arch/mips/boot/Makefile
+++ b/arch/mips/boot/Makefile
@@ -40,3 +40,18 @@ quiet_cmd_srec = OBJCOPY $@
       cmd_srec = $(OBJCOPY) -S -O srec $(strip-flags) $(VMLINUX) $@
 $(obj)/vmlinux.srec: $(VMLINUX) FORCE
 	$(call if_changed,srec)
+
+UIMAGE_LOADADDR  = $(shell $(NM) $(VMLINUX) | grep "\b_text\b"        | cut -f1 -d\ )
+UIMAGE_ENTRYADDR = $(shell $(NM) $(VMLINUX) | grep '\bkernel_entry\b' | cut -f1 -d\ )
+
+$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
+	$(call if_changed,gzip)
+
+targets += uImage.gz
+$(obj)/uImage.gz: $(obj)/vmlinux.bin.gz FORCE
+	$(call if_changed,uimage,gzip)
+
+targets += uImage
+$(obj)/uImage: $(obj)/uImage.gz FORCE
+	@ln -sf $(notdir $<) $@
+	@echo '  Image $@ is ready'
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] MIPS: add uImage build target
  2013-08-21 14:55 [PATCH] MIPS: add uImage build target James Hogan
  2013-08-21 14:55 ` James Hogan
@ 2013-08-21 15:08 ` Florian Fainelli
  2013-08-21 15:44   ` James Hogan
  1 sibling, 1 reply; 5+ messages in thread
From: Florian Fainelli @ 2013-08-21 15:08 UTC (permalink / raw)
  To: James Hogan; +Cc: Ralf Baechle, Linux-MIPS

2013/8/21 James Hogan <james.hogan@imgtec.com>:
> Add a uImage build target for MIPS, which builds uImage.gz (a U-Boot
> image of vmlinux.bin.gz), and then symlinks it to uImage. This allows
> for the use of other compression algorithms in future, and is how a few
> other architectures do it.
>
> The load address and entry address are calculated from the address of
> the _text and kernel_entry symbols, by running nm on the main vmlinux
> (based on arch/mips/lasat/image/Makefile).
>
> Signed-off-by: James Hogan <james.hogan@imgtec.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: linux-mips@linux-mips.org
> ---
>  arch/mips/Makefile        |  3 ++-
>  arch/mips/boot/.gitignore |  1 +
>  arch/mips/boot/Makefile   | 15 +++++++++++++++
>  3 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/arch/mips/Makefile b/arch/mips/Makefile
> index b2be6b8..c4f339e 100644
> --- a/arch/mips/Makefile
> +++ b/arch/mips/Makefile
> @@ -284,7 +284,7 @@ vmlinux.64: vmlinux
>  all:   $(all-y)
>
>  # boot
> -vmlinux.bin vmlinux.ecoff vmlinux.srec: $(vmlinux-32) FORCE
> +vmlinux.bin vmlinux.ecoff vmlinux.srec uImage: $(vmlinux-32) FORCE
>         $(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) arch/mips/boot/$@
>
>  # boot/compressed
> @@ -327,6 +327,7 @@ define archhelp
>         echo '  vmlinuz.ecoff        - ECOFF zboot image'
>         echo '  vmlinuz.bin          - Raw binary zboot image'
>         echo '  vmlinuz.srec         - SREC zboot image'
> +       echo '  uImage               - U-Boot image (gzip)'

This is not quite accurate, since you introduce two new uImage
targets, this should be:

+       echo '  uImage               - U-Boot image'
+       echo '  uImage.gz               - U-Boot image (gzip)'

>         echo
>         echo '  These will be default as appropriate for a configured platform.'
>  endef
> diff --git a/arch/mips/boot/.gitignore b/arch/mips/boot/.gitignore
> index f210b09..a73d6e2 100644
> --- a/arch/mips/boot/.gitignore
> +++ b/arch/mips/boot/.gitignore
> @@ -4,3 +4,4 @@ vmlinux.*
>  zImage
>  zImage.tmp
>  calc_vmlinuz_load_addr
> +uImage
> diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile
> index 851261e..8169d42 100644
> --- a/arch/mips/boot/Makefile
> +++ b/arch/mips/boot/Makefile
> @@ -40,3 +40,18 @@ quiet_cmd_srec = OBJCOPY $@
>        cmd_srec = $(OBJCOPY) -S -O srec $(strip-flags) $(VMLINUX) $@
>  $(obj)/vmlinux.srec: $(VMLINUX) FORCE
>         $(call if_changed,srec)
> +
> +UIMAGE_LOADADDR  = $(shell $(NM) $(VMLINUX) | grep "\b_text\b"        | cut -f1 -d\ )

Is not VMLINUX_LOAD_ADDRESS suitable here?

> +UIMAGE_ENTRYADDR = $(shell $(NM) $(VMLINUX) | grep '\bkernel_entry\b' | cut -f1 -d\ )

This logic already exists in arch/mips/boot/compressed/Makefile, so we
might want to move this to arch/mips/Makefile? This could be a
preliminary or subsequent patch, your call.

> +
> +$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
> +       $(call if_changed,gzip)
> +
> +targets += uImage.gz
> +$(obj)/uImage.gz: $(obj)/vmlinux.bin.gz FORCE
> +       $(call if_changed,uimage,gzip)
> +
> +targets += uImage
> +$(obj)/uImage: $(obj)/uImage.gz FORCE
> +       @ln -sf $(notdir $<) $@
> +       @echo '  Image $@ is ready'
> --
> 1.8.1.2
>
>
>



-- 
Florian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] MIPS: add uImage build target
  2013-08-21 15:08 ` Florian Fainelli
@ 2013-08-21 15:44   ` James Hogan
  2013-08-21 15:59     ` Florian Fainelli
  0 siblings, 1 reply; 5+ messages in thread
From: James Hogan @ 2013-08-21 15:44 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: Ralf Baechle, Linux-MIPS

Hi Florian,

On 21/08/13 16:08, Florian Fainelli wrote:
> 2013/8/21 James Hogan <james.hogan@imgtec.com>:
>> diff --git a/arch/mips/Makefile b/arch/mips/Makefile
>> index b2be6b8..c4f339e 100644
>> --- a/arch/mips/Makefile
>> +++ b/arch/mips/Makefile
>> @@ -284,7 +284,7 @@ vmlinux.64: vmlinux
>>  all:   $(all-y)
>>
>>  # boot
>> -vmlinux.bin vmlinux.ecoff vmlinux.srec: $(vmlinux-32) FORCE
>> +vmlinux.bin vmlinux.ecoff vmlinux.srec uImage: $(vmlinux-32) FORCE
>>         $(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) arch/mips/boot/$@
>>
>>  # boot/compressed
>> @@ -327,6 +327,7 @@ define archhelp
>>         echo '  vmlinuz.ecoff        - ECOFF zboot image'
>>         echo '  vmlinuz.bin          - Raw binary zboot image'
>>         echo '  vmlinuz.srec         - SREC zboot image'
>> +       echo '  uImage               - U-Boot image (gzip)'
> 
> This is not quite accurate, since you introduce two new uImage
> targets, this should be:
> 
> +       echo '  uImage               - U-Boot image'
> +       echo '  uImage.gz               - U-Boot image (gzip)'

Only uImage is passed through to arch/mips/boot/Makefile, but yes, they
probably both should be.

> 
>>         echo
>>         echo '  These will be default as appropriate for a configured platform.'
>>  endef
>> diff --git a/arch/mips/boot/.gitignore b/arch/mips/boot/.gitignore
>> index f210b09..a73d6e2 100644
>> --- a/arch/mips/boot/.gitignore
>> +++ b/arch/mips/boot/.gitignore
>> @@ -4,3 +4,4 @@ vmlinux.*
>>  zImage
>>  zImage.tmp
>>  calc_vmlinuz_load_addr
>> +uImage
>> diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile
>> index 851261e..8169d42 100644
>> --- a/arch/mips/boot/Makefile
>> +++ b/arch/mips/boot/Makefile
>> @@ -40,3 +40,18 @@ quiet_cmd_srec = OBJCOPY $@
>>        cmd_srec = $(OBJCOPY) -S -O srec $(strip-flags) $(VMLINUX) $@
>>  $(obj)/vmlinux.srec: $(VMLINUX) FORCE
>>         $(call if_changed,srec)
>> +
>> +UIMAGE_LOADADDR  = $(shell $(NM) $(VMLINUX) | grep "\b_text\b"        | cut -f1 -d\ )
> 
> Is not VMLINUX_LOAD_ADDRESS suitable here?

It's only passed through to arch/mips/boot/compressed. It can always be
made to pass it to arch/mips/boot too though.

> 
>> +UIMAGE_ENTRYADDR = $(shell $(NM) $(VMLINUX) | grep '\bkernel_entry\b' | cut -f1 -d\ )
> 
> This logic already exists in arch/mips/boot/compressed/Makefile, so we
> might want to move this to arch/mips/Makefile? This could be a
> preliminary or subsequent patch, your call.

Thanks for the feedback. I'll refactor it a bit to avoid duplication.

Cheers
James

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] MIPS: add uImage build target
  2013-08-21 15:44   ` James Hogan
@ 2013-08-21 15:59     ` Florian Fainelli
  0 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2013-08-21 15:59 UTC (permalink / raw)
  To: James Hogan; +Cc: Ralf Baechle, Linux-MIPS

Hello James,

2013/8/21 James Hogan <james.hogan@imgtec.com>:
> Hi Florian,
>
> On 21/08/13 16:08, Florian Fainelli wrote:
>> 2013/8/21 James Hogan <james.hogan@imgtec.com>:
>>> diff --git a/arch/mips/Makefile b/arch/mips/Makefile
>>> index b2be6b8..c4f339e 100644
>>> --- a/arch/mips/Makefile
>>> +++ b/arch/mips/Makefile
>>> @@ -284,7 +284,7 @@ vmlinux.64: vmlinux
>>>  all:   $(all-y)
>>>
>>>  # boot
>>> -vmlinux.bin vmlinux.ecoff vmlinux.srec: $(vmlinux-32) FORCE
>>> +vmlinux.bin vmlinux.ecoff vmlinux.srec uImage: $(vmlinux-32) FORCE
>>>         $(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) arch/mips/boot/$@
>>>
>>>  # boot/compressed
>>> @@ -327,6 +327,7 @@ define archhelp
>>>         echo '  vmlinuz.ecoff        - ECOFF zboot image'
>>>         echo '  vmlinuz.bin          - Raw binary zboot image'
>>>         echo '  vmlinuz.srec         - SREC zboot image'
>>> +       echo '  uImage               - U-Boot image (gzip)'
>>
>> This is not quite accurate, since you introduce two new uImage
>> targets, this should be:
>>
>> +       echo '  uImage               - U-Boot image'
>> +       echo '  uImage.gz               - U-Boot image (gzip)'
>
> Only uImage is passed through to arch/mips/boot/Makefile, but yes, they
> probably both should be.
>
>>
>>>         echo
>>>         echo '  These will be default as appropriate for a configured platform.'
>>>  endef
>>> diff --git a/arch/mips/boot/.gitignore b/arch/mips/boot/.gitignore
>>> index f210b09..a73d6e2 100644
>>> --- a/arch/mips/boot/.gitignore
>>> +++ b/arch/mips/boot/.gitignore
>>> @@ -4,3 +4,4 @@ vmlinux.*
>>>  zImage
>>>  zImage.tmp
>>>  calc_vmlinuz_load_addr
>>> +uImage
>>> diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile
>>> index 851261e..8169d42 100644
>>> --- a/arch/mips/boot/Makefile
>>> +++ b/arch/mips/boot/Makefile
>>> @@ -40,3 +40,18 @@ quiet_cmd_srec = OBJCOPY $@
>>>        cmd_srec = $(OBJCOPY) -S -O srec $(strip-flags) $(VMLINUX) $@
>>>  $(obj)/vmlinux.srec: $(VMLINUX) FORCE
>>>         $(call if_changed,srec)
>>> +
>>> +UIMAGE_LOADADDR  = $(shell $(NM) $(VMLINUX) | grep "\b_text\b"        | cut -f1 -d\ )
>>
>> Is not VMLINUX_LOAD_ADDRESS suitable here?
>
> It's only passed through to arch/mips/boot/compressed. It can always be
> made to pass it to arch/mips/boot too though.

Right, in your case $(load-y) should do it.

>
>>
>>> +UIMAGE_ENTRYADDR = $(shell $(NM) $(VMLINUX) | grep '\bkernel_entry\b' | cut -f1 -d\ )
>>
>> This logic already exists in arch/mips/boot/compressed/Makefile, so we
>> might want to move this to arch/mips/Makefile? This could be a
>> preliminary or subsequent patch, your call.
>
> Thanks for the feedback. I'll refactor it a bit to avoid duplication.

Great, thanks!
-- 
Florian

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-08-21 16:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-21 14:55 [PATCH] MIPS: add uImage build target James Hogan
2013-08-21 14:55 ` James Hogan
2013-08-21 15:08 ` Florian Fainelli
2013-08-21 15:44   ` James Hogan
2013-08-21 15:59     ` Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox