Re: [PATCH] MIPS: add U-boot uImage build target to arch Makefile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



More comments below:

On Mon, Jan 17, 2011 at 5:07 PM, Xiangfu Liu <xiangfu@xxxxxxxxxx> wrote:
[...]
>
> +# u-boot
> +uImage: vmlinux.bin FORCE
> +       $(Q)$(MAKE) $(build)=arch/mips/boot/u-boot \
> +         VMLINUX=$(vmlinux-32) VMLINUXBIN=arch/mips/boot/vmlinux.bin \
> +         VMLINUX_LOAD_ADDRESS=$(load-y) arch/mips/boot/u-boot/$@
>

As the comments in my previous reply, we may be possible to add the
uImage target to the line for vmlinuz, then, only one line need to be
changed.

>  CLEAN_FILES += vmlinux.32 vmlinux.64
>
> @@ -313,6 +318,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)'

If more compression algos added, then, above "(gzip)" can be removed.
and seems we forgot adding uImage to the "install:" and "archclean:"
target ;-)

arch/mips/Makefile:

install:
        here....

archclean:
        and here ....

If we move arch/mips/boot/u-boot/Makefile to
arch/mips/boot/compressed/Makefile, then, we can simply and uImage to
the last line of that Makefile:

clean-files := .... uImage

>        echo
>        echo '  These will be default as apropriate for a configured platform.'
>  endef
> diff --git a/arch/mips/boot/u-boot/.gitignore b/arch/mips/boot/u-boot/.gitignore
> new file mode 100644
> index 0000000..1080c94
> --- /dev/null
> +++ b/arch/mips/boot/u-boot/.gitignore
> @@ -0,0 +1,2 @@
> +vmlinux.bin.gz
> +uImage

If we move the uImage target to arch/mips/boot/compressed/Makefile,
the uImage ignore can be added to arch/mips/boot/.gitignore

> diff --git a/arch/mips/boot/u-boot/Makefile b/arch/mips/boot/u-boot/Makefile
> new file mode 100644
> index 0000000..318dc50
> --- /dev/null
> +++ b/arch/mips/boot/u-boot/Makefile
> @@ -0,0 +1,15 @@
> +targets += vmlinux.bin.gz
> +quiet_cmd_gzip = GZIP $@
> +cmd_gzip = gzip -c9 $(VMLINUXBIN) $(obj)/vmlinux.bin.gz
> +$(obj)/vmlinux.bin.gz: $(obj)/../vmlinux.bin FORCE
> +       $(call if_changed,gzip)

If we share the vmlinux.bin.z with vmlinuz, then, the above can be removed.

> +
> +MKIMAGE = mkimage

As your previous reply, the above line can be replaced with
$(srctree)/scripts/mkuboot.sh

> +
> +targets += uImage
> +quiet_cmd_uImage = MKIMAGE $@
> +cmd_uImage = $(MKIMAGE) -A mips -O linux -T kernel -C gzip -a $(VMLINUX_LOAD_ADDRESS) \

We can align it with quiet_cmd_uImage above ;-)

quiet_cmd_uImage =  ...
         cmd_uImage = ...

And we can substitute "$(tool_y)" for the 'hardcoded' gzip above.

> +-e 0x$(shell $(NM) $(VMLINUX) | grep ' kernel_entry' | cut -f1 -d ' ') \

Seems this duplicates the KERNEL_ENTRY calculation of kernel_entry
address, perhaps we can make a common one and share them, here is a
minimal change of the old Makefile:

-KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUILD_AFLAGS) \
-       -DKERNEL_ENTRY=0x$(shell $(NM) $(objtree)/$(KBUILD_IMAGE)
2>/dev/null | grep " kernel_entry" | cut -f1 -d \ )
+KERNEL_ENTRY=0x$(shell $(NM) $(objtree)/$(KBUILD_IMAGE) 2>/dev/null |
grep " kernel_entry" | cut -f1 -d ' ')
+
+KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUILD_AFLAGS)
-DKERNEL_ENTRY=$(KERNEL_ENTRY)

Then, we can use $(KERNEL_ENTRY) directly.

> +-n MIPS -d $(obj)/vmlinux.bin.gz $(obj)/uImage

Here, $(obj)/vmlinux.bin.z can be replaced with $(obj)/vmlinux.bin.z,
or we can simply use $< to simplify it.

> +$(obj)/uImage: $(obj)/vmlinux.bin.gz FORCE

$(obj)/vmlinux.bin.gz -> $(obj)/vmlinux.bin.z, and perhaps we can use
uImage instead of $(obj)/uImage too ;-)

> +       $(call if_changed,uImage)

Regards,
Wu Zhangjin



[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux