[LEDE-DEV] Adding new targets/subtargets

Philip Prindeville philipp_subx at redfish-solutions.com
Thu Dec 29 11:29:45 PST 2016


On Dec 28, 2016, at 7:57 PM, Yousong Zhou <yszhou4tech at gmail.com> wrote:
> 
> On 29 December 2016 at 10:04, Philip Prindeville
> <philipp_subx at redfish-solutions.com> wrote:
>> I wanted to add a new target for x86, or possibly several.
>> 
>> I have an immediate need for an optimized build to run on Xeon-based 1U servers for a project that I’m working on.  My work in progress is here:
>> 
>> https://github.com/pprindeville/openwrt/commit/67a11380ed69351e320a410ec18c04e62fb548d3
>> 
>> but I’m not clear on what ARCH_PACKAGES is or when it’s used… or why only target/linux/x86/ seems to use it.
>> 
>> Looked on the Wiki but there doesn’t seem to be a blow-by-blow decomposition of what a target directory looks like.
>> 
>> Also, I wanted to build targets with virtio drivers (net and scsi) for running on Parallels or KVM/Qemu… so that none-platform stuff could be tested, possibly in an automated testing environment.
> 
> Very likely you can just add xeon-specific bits to x86/64 subtarget.
> I think it's intended to be both "modern" and "generic".  It already
> contains various virtio device drivers and we even have qemu-2.6.2
> with kvm support ready for it.


The x86/64/config-default is missing the following switches:

CONFIG_MCORE2=y
CONFIG_MDIO=y
CONFIG_X86_USE_PPRO_CHECKSUM=y

otherwise they should be identical (unless I’ve overlooked other values which are needed).


> 
> I cannot find direct reference to ARCH_PACKAGES in target/ dir.  I
> think it's a string intended to represent the arch of packages built
> for current target/subtarget.  Previously in OpenWrt, we build
> packages like pppd separately for targets like ramips and ar71xx, even
> though they are of the same arch "mips_24kc" (there was a time ar71xx
> was optimized for 34kc though).  Now these packages are arch-specific
> and will reside in dir bin/packages/<CONFIG_TARGET_ARCH_PACKAGES>.

Doing the following:

openwrt$ grep -r -n -E -e ‘\<ARCH\>' -e ‘\<ARCH_PACKAGES\>’ include/ target/
include/image.mk:122:	mkimage -A $(ARCH) -O linux -T kernel -C $(1) -a $(2) -e $(3) \
include/image.mk:123:		-n '$(call toupper,$(ARCH)) OpenWrt Linux-$(LINUX_VERSION)' -d $(4) $(5)
include/image.mk:129:		-A $(ARCH) -v $(LINUX_VERSION)
include/image.mk:345:		-A $(ARCH) -v $(LINUX_VERSION)
include/toplevel.mk:35:unexport C_INCLUDE_PATH CROSS_COMPILE ARCH
include/package-defaults.mk:43:  ifneq ($(ARCH_PACKAGES),)
include/package-defaults.mk:44:    PKGARCH:=$(ARCH_PACKAGES)
include/package-defaults.mk:134:	ARCH="$(ARCH)"
include/kernel.mk:65:else ifneq (,$(findstring $(ARCH) , aarch64 aarch64_be ))
include/kernel.mk:67:else ifneq (,$(findstring $(ARCH) , arceb ))
include/kernel.mk:69:else ifneq (,$(findstring $(ARCH) , armeb ))
include/kernel.mk:71:else ifneq (,$(findstring $(ARCH) , mipsel mips64 mips64el ))
include/kernel.mk:73:else ifneq (,$(findstring $(ARCH) , sh2 sh3 sh4 ))
include/kernel.mk:75:else ifneq (,$(findstring $(ARCH) , i386 x86_64 ))
include/kernel.mk:78:  LINUX_KARCH := $(ARCH)
include/package.mk:105:CONFIG_SITE:=$(INCLUDE_DIR)/site/$(ARCH)
include/target.mk:205:  ifneq ($(findstring mips,$(ARCH)),)
include/target.mk:206:    ifneq ($(findstring mips64,$(ARCH)),)
include/target.mk:224:  ifeq ($(ARCH),i386)
include/target.mk:230:  ifneq ($(findstring arm,$(ARCH)),)
include/target.mk:252:  ifeq ($(ARCH),powerpc)
include/target.mk:258:  ifeq ($(ARCH),sparc)
include/target.mk:262:  ifeq ($(ARCH),aarch64)
include/target.mk:266:  ifeq ($(ARCH),arc)
include/target.mk:283:	 echo 'Target-Arch: $(ARCH)'; \
include/target.mk:284:	 echo 'Target-Arch-Packages: $(if $(ARCH_PACKAGES),$(ARCH_PACKAGES),$(BOARD))'; \
include/cmake.mk:45:			-DCMAKE_SYSTEM_PROCESSOR=$(ARCH) \
include/kernel-defaults.mk:11:	ARCH="$(LINUX_KARCH)" \
target/linux/ramips/Makefile:9:ARCH:=mipsel
target/linux/malta/le/target.mk:1:ARCH:=mipsel
target/linux/malta/be64/target.mk:1:ARCH:=mips64
target/linux/malta/be/target.mk:1:ARCH:=mips
target/linux/malta/le64/target.mk:1:ARCH:=mips64el
target/linux/mpc85xx/Makefile:9:ARCH:=powerpc
target/linux/archs38/Makefile:9:ARCH:=arc
target/linux/uml/Makefile:13:ARCH:=$(shell uname -m | sed \
target/linux/uml/Makefile:36:LINUX_TARGET_CONFIG:=$(CURDIR)/config/$(ARCH)
target/linux/brcm2708/Makefile:10:ARCH:=arm
target/linux/cns3xxx/Makefile:9:ARCH:=arm
target/linux/adm5120/router_le/target.mk:1:ARCH:=mipsel
target/linux/adm5120/rb1xx/target.mk:1:ARCH:=mipsel
target/linux/adm5120/router_be/target.mk:1:ARCH:=mips
target/linux/mediatek/Makefile:5:ARCH:=arm
target/linux/mxs/Makefile:9:ARCH:=arm
target/linux/ipq806x/Makefile:5:ARCH:=arm
target/linux/netlogic/Makefile:9:ARCH:=mips64
target/linux/x86/xeon/target.mk:1:ARCH:=x86_64
target/linux/x86/xeon/target.mk:5:ARCH_PACKAGES:=xeon
target/linux/x86/64/target.mk:1:ARCH:=x86_64
target/linux/x86/64/target.mk:4:ARCH_PACKAGES:=x86_64
target/linux/x86/Makefile:9:ARCH:=i386
target/linux/omap24xx/Makefile:9:ARCH:=arm
target/linux/imx6/Makefile:9:ARCH:=arm
target/linux/imx6/image/Makefile:34:		$(CP) $(LINUX_DIR)/arch/$(ARCH)/boot/dts/$(dts).dtb \
target/linux/imx6/image/Makefile:36:		$(CP) $(LINUX_DIR)/arch/$(ARCH)/boot/dts/$(dts).dtb \
target/linux/imx6/image/Makefile:78:		$(CP) $(LINUX_DIR)/arch/$(ARCH)/boot/dts/$(dts).dtb \
target/linux/imx6/image/Makefile:80:		$(CP) $(LINUX_DIR)/arch/$(ARCH)/boot/dts/$(dts).dtb \
target/linux/mvebu/Makefile:9:ARCH:=arm
target/linux/adm8668/Makefile:9:ARCH:=mipsel
target/linux/kirkwood/Makefile:9:ARCH:=arm
target/linux/oxnas/Makefile:9:ARCH:=arm
target/linux/realview/Makefile:9:ARCH:=arm
target/linux/mcs814x/Makefile:9:ARCH:=arm
target/linux/mcs814x/image/Makefile:28:	cat $(LINUX_DIR)/arch/$(ARCH)/boot/$(DTBS_DIR)$(1).dtb >> $(KDIR)/zImage$(2)-$(1);
target/linux/ar7/Makefile:9:ARCH:=mipsel
target/linux/au1000/Makefile:9:ARCH:=mipsel
target/linux/octeon/Makefile:9:ARCH:=mips64
target/linux/zynq/Makefile:10:ARCH:=arm
target/linux/zynq/image/Makefile:42:		-A $(ARCH) -v $(LINUX_VERSION) \
target/linux/zynq/image/mkits.sh:37:		A ) ARCH=$OPTARG;;
target/linux/zynq/image/mkits.sh:54:if [ -z "${ARCH}" ] || [ -z "${COMPRESS}" ] || [ -z "${LOAD_ADDR}" ] || \
target/linux/zynq/image/mkits.sh:60:ARCH_UPPER=`echo $ARCH | tr '[:lower:]' '[:upper:]'`
target/linux/zynq/image/mkits.sh:69:			arch = \"${ARCH}\";
target/linux/zynq/image/mkits.sh:90:			arch = \"${ARCH}\";
target/linux/zynq/image/mkits.sh:121:			arch = \"${ARCH}\";
target/linux/ar71xx/Makefile:9:ARCH:=mips
target/linux/socfpga/Makefile:9:ARCH:=arm
target/linux/arm64/Makefile:9:ARCH:=aarch64
target/linux/omap/Makefile:9:ARCH:=arm
target/linux/at91/Makefile:9:ARCH:=arm
target/linux/gemini/Makefile:9:ARCH:=arm
target/linux/sunxi/Makefile:10:ARCH:=arm
target/linux/bcm53xx/Makefile:9:ARCH:=arm
target/linux/brcm63xx/Makefile:10:ARCH:=mips
target/linux/arc770/Makefile:9:ARCH:=arc
target/linux/rb532/Makefile:9:ARCH:=mipsel
target/linux/xburst/Makefile:9:ARCH:=mipsel
target/linux/orion/Makefile:9:ARCH:=arm
target/linux/brcm47xx/Makefile:9:ARCH:=mipsel
target/linux/lantiq/xway/target.mk:1:ARCH:=mips
target/linux/lantiq/xway_legacy/target.mk:1:ARCH:=mips
target/linux/lantiq/xrx200/target.mk:1:ARCH:=mips
target/linux/ath25/Makefile:9:ARCH:=mips
target/linux/ixp4xx/Makefile:9:ARCH:=armeb
target/linux/ppc40x/Makefile:9:ARCH:=powerpc
target/linux/ppc44x/Makefile:9:ARCH:=powerpc
target/toolchain/Makefile:28:TOOLCHAIN_PREFIX:=$(TOOLCHAIN_BUILD_DIR)/toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)$(DIR_SUFFIX)
target/toolchain/Makefile:34:	       toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)$(DIR_SUFFIX) | \
target/toolchain/Config.in:6:	  OpenWrt-Toolchain-$(BOARD)-for-$(ARCH)$(ARCH_SUFFIX)-gcc-$(GCCV)$(DIR_SUFFIX).
target/sdk/Makefile:19:STAGING_SUBDIR_TOOLCHAIN := staging_dir/toolchain-$(ARCH)$(ARCH_SUFFIX)_gcc-$(GCCV)_$(LIBC)-$(LIBCV)$(if $(CONFIG_arm),_eabi)
target/imagebuilder/Makefile:20:IB_DTSDIR:=$(patsubst $(TOPDIR)/%,$(PKG_BUILD_DIR)/%,$(LINUX_DIR))/arch/$(ARCH)/boot/dts/
target/imagebuilder/Makefile:70:	if [ -d $(LINUX_DIR)/arch/$(ARCH)/boot/dts ]; then \
target/imagebuilder/Makefile:71:		$(CP) $(LINUX_DIR)/arch/$(ARCH)/boot/dts/* $(IB_DTSDIR); \
target/imagebuilder/files/Makefile:73:	--add-arch $(ARCH_PACKAGES):200
target/Config.in:185:config ARCH
openwrt$ 


so it seems to be used for a few different things including image naming.  ARCH also seems to be overloaded, from what I can tell…

ARCH_SUFFIX is taken from CONFIG_CPU_TYPE, but in my setup that value seems to have been set to “ “ which I can’t say I understand. 



>> 
>> Is there any unofficial documentation (i.e. not on the wiki) about how to go about adding platforms?
>> 
>> There’s a wiki entry on “adding a new device” but doesn’t seem to be applicable to what I’m doing.
>> 
>> Any pointers are appreciated.
> 
> Adding target/subtarget does not happen very often, but the build
> system changes a lot in various aspects.  Probably nobody bothers to
> add such doc.  But we can always consult git log/mail history to see
> how previous ones are added.
> 
>                yousong


Actually, all the subtargets have been purged, from what I can tell.  I don’t see any subtargets (just profiles?) so I don’t even know if the subtarget machinery is still intact or not.

-Philip




More information about the Lede-dev mailing list