OpenWrt Forum Archive

Topic: How to add a new target in OpenWrt from scratch

The content of this topic has been archived on 27 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I have a Marvell Armada 38x dev board with full bsp support(uboot, kernel patches and buildroot). I try to add it into the OpenWrt mainline. I follow the target "mvebu"(Armada 370) in OpenWrt and add some config files, Makefiles and patches in the new target folder "target/linux/armada38x". The kernel version is 3.10.39 for armada38x while OpenWrt only supports 3.10.36 for now.

target/linux/armada38x/config-3.10 (using the default kernel config file armada38x_defconfig)
target/linux/armada38x/patches-3.10 (using all the armada38x patches from Marvell)

target/linux/generic/config-3.10 (not altered, using the default one in OpenWrt)
target/linux/generic/patches-3.10 (removed since some patches confict with armada38x patches)

BTW, I use the external toolchain provided by Marvell when doing make menuconfig.

# make menuconfig (already altered Config.in to support armada38x)
# make target/linux/{clean,compile} QUILT=1 V=99

The kernel source 3.10.39 are downloaded, extracted and patched successfully. The kernel config fails. After "scripts/kconfig/conf --silentoldconfig Kconfig", it always reminds me "Restart config..." with so many kernel options marked with "(NEW)" to be determined "[Y/n/?]".

Q1: Why are there so many [new] kernel options to be configured manually? When the kernel needs to "Restart config"?

Q2: How to generate a default kernel config file like "target/linux/generic/config-3.10"? If I need to add kernel 3.4 support in OpenWrt, a "target/linux/generic/config-3.4" will be needed.

Q3: Are there any docs about adding a new target from scratch in OpenWrt besides the "add a new platform" and "add a new device" wiki in OpenWrt?

Appreciate for your help.

No one here???

Try make kernel_menuconfig. Once the menuconfig is up, you can change any settings and save to update the Config.in file (IIRC).

I think Armada 38x should be part of the mvebu target. Also, don't remove anything from generic/patches-3.10, but rebase your target specific patches on top of those.

Regarding your Q1, I believe the [NEW] are options which are neither set nor unset in generic/config-3.10 and armada38x/config-3.10? You should then add those to armada38x/config-3.10.

@snk Thanks for your info. I'm new to OpenWrt. AFAIK, armada38x use a different a ARM cpu core with mvebu(370?). So I thought "target" is for CPU type and "device" is for board type.

If I want to add a new kernel version support in OpenWrt, how should "target/linux/generic/config-xxx" be generated?

sanhust wrote:

@snk Thanks for your info. I'm new to OpenWrt. AFAIK, armada38x use a different a ARM cpu core with mvebu(370?). So I thought "target" is for CPU type and "device" is for board type.

At least in upstream linux armada38x stuff goes under mvebu. Best to keep it that way in OpenWrt as well. In general, target groups similar SoC's together, whereas device specifies the board. Additional sub-targets can be used for another layer of separation if kernel configs differ between similar SoC's.

If I want to add a new kernel version support in OpenWrt, how should "target/linux/generic/config-xxx" be generated?

IIRC generic configuration is made by hand by using another version as template and adding new options manually. Target configuration can be generated by 'make kernel_menuconfig'.

Of course, you can change kernel version, run 'make kernel_menuconfig', not change any options, and save. Then diff the new target config with the old. Most of these differences (non-target specific) should be included in the generic config.

(Last edited by snk on 21 Aug 2014, 10:14)

The discussion might have continued from here.