[OpenWrt-Devel] [PATCH 2/2 v3] linux: add support of Synopsys ARC770-based boards

Felix Fietkau nbd at openwrt.org
Tue Nov 3 12:02:41 EST 2015


On 2015-11-03 17:49, Alexey Brodkin wrote:
>> > diff --git a/target/linux/arc770/image/Makefile b/target/linux/arc770/image/Makefile
>> > --- /dev/null
>> > +++ b/target/linux/arc770/image/Makefile
>> > @@ -0,0 +1,42 @@
>> > +#
>> > +# Copyright (C) 2015 OpenWrt.org
>> > +#
>> > +# This is free software, licensed under the GNU General Public License v2.
>> > +# See /LICENSE for more information.
>> > +#
>> > +include $(TOPDIR)/rules.mk
>> > +include $(INCLUDE_DIR)/image.mk
>> > +
>> > +Image/Build/Initramfs=$(call Image/Build/Profile/$(PROFILE),initramfs)
>> > +
>> > +# $(1), lowercase board name like "axs101"
>> > +# $(2), DTS filename without .dts extension
>> > +# $(3), optional filename suffix, e.g. "-initramfs"
>> > +define PatchKernelDtb
>> > +	cp $(KDIR)/vmlinux$(3).elf $(KDIR)/vmlinux-$(1)$(3).elf
>> > +	$(LINUX_DIR)/scripts/dtc/dtc -O dtb -o $(KDIR)/$(2).dtb ../dts/$(2).dts
>> > +	$(STAGING_DIR_HOST)/bin/patch-dtb $(KDIR)/vmlinux-$(1)$(3).elf $(KDIR)/$(2).dtb
>> > +endef
>> > +
>> > +# $(1), lowercase board name
>> > +# $(2), DTS filename without .dts extension
>> > +# $(3), optional filename suffix, e.g. "-initramfs"
>> > +MkImageDtb=$(call PatchKernelDtb,$(1),$(2),$(3))
>> > +
>> > +# $(1), squashfs/initramfs
>> > +# $(2), lowercase board name
>> > +# $(3), DTS filename without .dts extension
>> > +BuildFirmware/OF/initramfs=$(call MkImageDtb,$(2),$(3),-initramfs)
>> > +
>> > +BuildFirmware/axs101/initramfs=$(call BuildFirmware/OF/initramfs,$(1),axs101,axs101)
>> > +BuildFirmware/nsim_700/initramfs=$(call BuildFirmware/OF/initramfs,$(1),nsim_700,nsim_700)
>> > +
>> > +Image/Build/Profile/axs101=$(call BuildFirmware/axs101/$(1),$(1))
>> > +Image/Build/Profile/nsim_700=$(call BuildFirmware/nsim_700/$(1),$(1))
>> > +
>> > +define Image/Build/Profile/Default
>> > +	$(call Image/Build/Profile/axs101,$(1))
>> > +	$(call Image/Build/Profile/nsim_700,$(1))
>> > +endef
>> > +
>> > +$(eval $(call BuildImage))
>> Please use the new image building code instead. You can find examples in
>> the bcm53xx image Makefile.
> 
> Could you please elaborate a little bit why this is necessary?
> IMHO my current implementation is quite clean and understandable.
> What is also important it allows for more flexibility.
Eventually I would like to have all targets use the new image build
code, so we can get rid of the old stuff. Adding more code that uses the
old infrastructure will make this harder than it already is.

The new code is faster because it allows parallel build, and it has
better integration for handling profiles. It is also cleaner for targets
with different image types, because it makes it easier to chain and
recombine small image build recipes.

> For example I may deal with vmlinux.elf instead of objcopied vmlinux
> (which doesn't include elf header any longer) etc.
You can use easily use vmlinux.elf with that code as well.

> Moreover bcm53xx has no profiles so it's hard for me to figure out how to deal with
> profiles properly with this new build code.
Many ar71xx devices have been ported over already, and they use
profiles. Limiting a device to one or more profiles is easy:
Setting PROFILES = foo bar in the device template will ensure that the
device image is only built for profiles 'foo' and 'bar'.

- Felix
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list