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

Alexey Brodkin Alexey.Brodkin at synopsys.com
Tue Nov 3 11:49:57 EST 2015


Hi Felix,

On Tue, 2015-11-03 at 08:43 +0100, Felix Fietkau wrote:
> On 2015-11-03 00:27, Alexey Brodkin wrote:
> > This patch introduces support of new boards with ARC cores.

[snip]

> > diff --git a/include/kernel.mk b/include/kernel.mk
> > index 6a613fe..878a366 100644
> > --- a/include/kernel.mk
> > +++ b/include/kernel.mk
> > @@ -64,6 +64,8 @@ ifneq (,$(findstring uml,$(BOARD)))
> >    LINUX_KARCH=um
> >  else ifneq (,$(findstring $(ARCH) , aarch64 aarch64_be ))
> >    LINUX_KARCH := arm64
> > +else ifneq (,$(findstring $(ARCH) , arceb ))
> > +  LINUX_KARCH := arc
> >  else ifneq (,$(findstring $(ARCH) , armeb ))
> >    LINUX_KARCH := arm
> >  else ifneq (,$(findstring $(ARCH) , mipsel mips64 mips64el ))
> > diff --git a/target/Config.in b/target/Config.in
> > index baae8d6..571b06e 100644
> > --- a/target/Config.in
> > +++ b/target/Config.in
> > @@ -100,6 +100,13 @@ config aarch64_be
> >  	select BIG_ENDIAN
> >  	bool
> >  
> > +config arc
> > +	bool
> > +
> > +config arceb
> > +	select BIG_ENDIAN
> > +	bool
> > +
> >  config arm
> >  	bool
> >  
> > @@ -179,6 +186,8 @@ config ARCH
> >  	string
> >  	default "aarch64"   if aarch64
> >  	default "aarch64_be" if aarch64_be
> > +	default "arc"       if arc
> > +	default "arceb"     if arceb
> >  	default "arm"       if arm
> >  	default "armeb"     if armeb
> >  	default "i386"      if i386
> Minor nitpick: The above parts should be folded into the previous patch.

Ok, will move it in toolchain patch.

> > diff --git a/target/linux/arc770/config-4.3 b/target/linux/arc770/config-4.3
> > new file mode 100644
> > index 0000000..aba6908
> > --- /dev/null
> > +++ b/target/linux/arc770/config-4.3
> > @@ -0,0 +1,142 @@
> > +#
> > +# ARC Architecture Configuration
> > +#
> > +CONFIG_ARC=y
> > +
> [...]
> Please run make kernel_oldconfig to refresh the target kernel config.
> This file is not meant to be hand-written. If you want to make changes
> to it, you can use make kernel_menuconfig.

Ok will do that too.

> > 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.

For example I may deal with vmlinux.elf instead of objcopied vmlinux
(which doesn't include elf header any longer) etc.

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.

-Alexey
_______________________________________________
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