OpenWrt Next Generation Ideas

Arınç ÜNAL arinc.unal at arinc9.com
Sat Apr 1 04:28:16 PDT 2023


On 31.03.2023 20:15, Felix Fietkau wrote:
> On 31.03.23 18:55, Arınç ÜNAL wrote:
>> On 31.03.2023 19:45, Felix Fietkau wrote:
>>> On 31.03.23 18:40, Arınç ÜNAL wrote:
>>>
>>>> I just thought of this. Why don't we just, for example, 'make
>>>> mt7621_defconfig && make mod2noconfig', then compile normally with
>>>> kernel module packages. This way, OpenWrt compiles a kernel with the
>>>> least amount of kernel modules (or rather, it compiles the kernel like
>>>> it always did), and people compiling the kernel outside of OpenWrt can
>>>> choose to remove the kernel modules they don't need.
>>>
>>> Because I believe the current OpenWrt kernel config system ist vastly 
>>> superior for keeping target kernel configs in sync while at the same 
>>> time making it easy to keep an overview of target specific overrides 
>>> as well. This is especially relevant for updating the kernel version.
>>
>> Hmm, well I'll take your word for it but feel free to explain more if
>> you'd like.
> 
> We do have a lot of config options that we set as default for all 
> targets. With our current system, we keep them in a file in
> target/linux/generic/config-<version>
> A target can override any of those with its target specific config 
> overlay. The clever bit of our kernel config system is that this overlay 
> is not handwritten. You can use make kernel_menuconfig or 
> kernel_oldconfig to make changes to it, and it will automatically filter 
> out the defaults from the generic config.
> 
> When updating to a newer kernel for the first time, you can pick any 
> target, copy the old version and run make kernel_oldconfig. Afterwards 
> you can look through the diff and move any newly added items that should 
> be generic over to the generic config template, so you won't be asked 
> about it for the next target.
> 
> The expectation is that target configs should share as many options as 
> possible, so it helps that you can simply go through the target config 
> overlays and look at each line to see if it should stay target specific 
> or if it should be moved to the generic config instead.
> 
> Also, OpenWrt commits that change settings for all targets are much 
> easier to review compared to a set of full configs, because you don't 
> have to manually verify if you properly applied them to all targets.
> 
> It would definitely be possible to build a workflow around full configs 
> as well to try to achieve something similar, but the problem that I see 
> there is that the relevant information for maintaining would not be as 
> readily available. And it would be easier for configs to accidentally 
> drift apart, causing spurious build issues when dealing with the 
> configurability of our module packages.

Thanks a lot of for explaining it. Reading this and looking around the 
kernel configs myself, I can see that OpenWrt's kernel config system is 
very necessary for the reasons of configuring the kernel for 
OpenWrt-specific reasons like booting the image, filesystem solution, 
and non-mainline drivers.

What about this:

Incorporating defconfigs with OpenWrt's kernel config system.
Treat defconfigs as the generic kernel config. Only keep (sub)target 
configs on OpenWrt. These configs would do changes specific to OpenWrt.
- Booting the image, `CONFIG_CMDLINE`, etc.
- Filesystem solution, `CONFIG_UBIFS_FS`, `CONFIG_SQUASHFS`, 
`CONFIG_JFFS2_FS`, etc.
- Non mainline drivers.

First, turn the defconfig to a full config with 'make target_defconfig', 
like the generic config is. Then, apply the target config.

This should greatly simplify the kernel configs on OpenWrt and grant 
people outside of the OpenWrt environment to compile the kernel for 
their device.

I made a defconfig for ramips/mt7621 from the .config file on the kernel 
directory after generic and target configs were applied.

We take out the OpenWrt-specific things from there, then submit it to 
mainline Linux.

This is the defconfig for ramips/mt7621. You can see how small it is 
even though it's the end result of the generic and target configs.

# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_KERNEL_XZ=y
CONFIG_SYSVIPC=y
# CONFIG_CROSS_MEMORY_ATTACH is not set
CONFIG_NO_HZ_IDLE=y
CONFIG_HIGH_RES_TIMERS=y
# CONFIG_CPU_ISOLATION is not set
CONFIG_BLK_DEV_INITRD=y
# CONFIG_RD_GZIP is not set
# CONFIG_RD_BZIP2 is not set
# CONFIG_RD_LZMA is not set
# CONFIG_RD_XZ is not set
# CONFIG_RD_LZO is not set
# CONFIG_RD_LZ4 is not set
# CONFIG_RD_ZSTD is not set
CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y
# CONFIG_SGETMASK_SYSCALL is not set
# CONFIG_SYSFS_SYSCALL is not set
# CONFIG_FHANDLE is not set
# CONFIG_IO_URING is not set
# CONFIG_KALLSYMS is not set
CONFIG_BPF_SYSCALL=y
CONFIG_BPF_UNPRIV_DEFAULT_OFF=y
# CONFIG_RSEQ is not set
CONFIG_EMBEDDED=y
# CONFIG_VM_EVENT_COUNTERS is not set
# CONFIG_SLUB_DEBUG is not set
# CONFIG_COMPAT_BRK is not set
CONFIG_RALINK=y
CONFIG_SOC_MT7621=y
CONFIG_CPU_MIPS32_R2=y
# CONFIG_MIPS_FP_SUPPORT is not set
CONFIG_SCHED_SMT=y
CONFIG_MIPS_CPS=y
CONFIG_HIGHMEM=y
CONFIG_NR_CPUS=4
CONFIG_HZ_100=y
CONFIG_MIPS_RAW_APPENDED_DTB=y
# CONFIG_SUSPEND is not set
CONFIG_CPU_IDLE=y
CONFIG_CPU_IDLE_GOV_TEO=y
# CONFIG_SECCOMP is not set
# CONFIG_STACKPROTECTOR is not set
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_STRIPPED=y
# CONFIG_BLK_DEV_BSG is not set
# CONFIG_BLK_DEBUG_FS is not set
CONFIG_PARTITION_ADVANCED=y
# CONFIG_MQ_IOSCHED_DEADLINE is not set
# CONFIG_MQ_IOSCHED_KYBER is not set
# CONFIG_COREDUMP is not set
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_IP_MULTIPLE_TABLES=y
CONFIG_IP_ROUTE_MULTIPATH=y
CONFIG_IP_ROUTE_VERBOSE=y
CONFIG_SYN_COOKIES=y
# CONFIG_INET_DIAG is not set
CONFIG_TCP_CONG_ADVANCED=y
# CONFIG_TCP_CONG_BIC is not set
# CONFIG_TCP_CONG_WESTWOOD is not set
# CONFIG_TCP_CONG_HTCP is not set
# CONFIG_IPV6 is not set
CONFIG_BRIDGE=y
CONFIG_BRIDGE_VLAN_FILTERING=y
CONFIG_NET_DSA=y
CONFIG_VLAN_8021Q=y
CONFIG_NET_SCHED=y
CONFIG_NET_SCH_FQ_CODEL=y
CONFIG_NET_SCH_DEFAULT=y
CONFIG_DEFAULT_FQ_CODEL=y
CONFIG_BPF_JIT=y
CONFIG_WIRELESS_EXT=y
CONFIG_WEXT_SPY=y
CONFIG_WEXT_PRIV=y
CONFIG_PCI=y
# CONFIG_PCIEASPM is not set
CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
CONFIG_UEVENT_HELPER=y
CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
CONFIG_FW_LOADER_USER_HELPER=y
CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
CONFIG_MTD=y
# CONFIG_MTD_SPLIT_FIRMWARE is not set
CONFIG_MTD_SPLIT_SQUASHFS_ROOT=y
CONFIG_MTD_SPLIT_SEAMA_FW=y
CONFIG_MTD_SPLIT_UIMAGE_FW=y
CONFIG_MTD_SPLIT_FIT_FW=y
CONFIG_MTD_SPLIT_TPLINK_FW=y
CONFIG_MTD_SPLIT_TRX_FW=y
CONFIG_MTD_SPLIT_MINOR_FW=y
CONFIG_MTD_CMDLINE_PARTS=y
CONFIG_MTD_ROUTERBOOT_PARTS=y
CONFIG_MTD_BLOCK=y
CONFIG_MTD_CFI=y
CONFIG_MTD_CFI_AMDSTD=y
CONFIG_MTD_COMPLEX_MAPPINGS=y
CONFIG_MTD_PHYSMAP=y
CONFIG_MTD_PHYSMAP_OF=y
CONFIG_MTD_RAW_NAND=y
CONFIG_MTD_NAND_MT7621=y
CONFIG_MTD_NAND_MTK_BMT=y
CONFIG_MTD_SPI_NOR=y
CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y
# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set
CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_BLOCK=y
CONFIG_MTD_VIRT_CONCAT=y
CONFIG_NETDEVICES=y
CONFIG_NET_DSA_MT7530=y
CONFIG_NET_VENDOR_MEDIATEK=y
CONFIG_NET_MEDIATEK_SOC=y
CONFIG_LED_TRIGGER_PHY=y
CONFIG_ICPLUS_PHY=y
CONFIG_AT803X_PHY=y
# CONFIG_WLAN_VENDOR_ADMTEK is not set
# CONFIG_WLAN_VENDOR_ATH is not set
# CONFIG_WLAN_VENDOR_ATMEL is not set
# CONFIG_WLAN_VENDOR_BROADCOM is not set
# CONFIG_WLAN_VENDOR_CISCO is not set
# CONFIG_WLAN_VENDOR_INTEL is not set
# CONFIG_WLAN_VENDOR_INTERSIL is not set
# CONFIG_WLAN_VENDOR_MARVELL is not set
# CONFIG_WLAN_VENDOR_MEDIATEK is not set
# CONFIG_WLAN_VENDOR_MICROCHIP is not set
# CONFIG_WLAN_VENDOR_RALINK is not set
# CONFIG_WLAN_VENDOR_REALTEK is not set
# CONFIG_WLAN_VENDOR_RSI is not set
# CONFIG_WLAN_VENDOR_ST is not set
# CONFIG_WLAN_VENDOR_TI is not set
# CONFIG_WLAN_VENDOR_ZYDAS is not set
# CONFIG_WLAN_VENDOR_QUANTENNA is not set
CONFIG_ISDN=y
# CONFIG_INPUT is not set
# CONFIG_SERIO is not set
# CONFIG_VT is not set
# CONFIG_LEGACY_PTYS is not set
CONFIG_SERIAL_8250=y
# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set
CONFIG_SERIAL_8250_CONSOLE=y
# CONFIG_SERIAL_8250_PCI is not set
CONFIG_SERIAL_8250_NR_UARTS=3
CONFIG_SERIAL_8250_RUNTIME_UARTS=3
CONFIG_SERIAL_OF_PLATFORM=y
# CONFIG_HW_RANDOM is not set
# CONFIG_DEVMEM is not set
# CONFIG_RANDOM_TRUST_BOOTLOADER is not set
CONFIG_I2C=y
# CONFIG_I2C_COMPAT is not set
CONFIG_I2C_CHARDEV=y
# CONFIG_I2C_HELPER_AUTO is not set
CONFIG_I2C_GPIO=y
CONFIG_I2C_MT7621=y
CONFIG_SPI=y
CONFIG_SPI_MT7621=y
CONFIG_PINCTRL=y
CONFIG_DEBUG_PINCTRL=y
CONFIG_PINCTRL_AW9523=y
CONFIG_PINCTRL_SX150X=y
CONFIG_GPIO_SYSFS=y
# CONFIG_GPIO_CDEV is not set
CONFIG_GPIO_MT7621=y
CONFIG_POWER_RESET=y
CONFIG_POWER_RESET_GPIO=y
CONFIG_POWER_SUPPLY=y
# CONFIG_HWMON is not set
CONFIG_WATCHDOG=y
CONFIG_GPIO_WATCHDOG=y
CONFIG_MT7621_WDT=y
CONFIG_MFD_SYSCON=y
CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y
# CONFIG_VGA_ARB is not set
# CONFIG_USB_PCI is not set
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
CONFIG_LEDS_CLASS_MULTICOLOR=y
CONFIG_LEDS_BRIGHTNESS_HW_CHANGED=y
CONFIG_LEDS_UBNT_LEDBAR=y
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
CONFIG_LEDS_TRIGGER_NETDEV=y
CONFIG_RTC_CLASS=y
# CONFIG_RTC_NVMEM is not set
CONFIG_RTC_DRV_PCF8563=y
CONFIG_RTC_DRV_BQ32K=y
CONFIG_RTC_DRV_CMOS=y
CONFIG_STAGING=y
CONFIG_PCI_MT7621=y
CONFIG_PCI_MT7621_PHY=y
CONFIG_PINCTRL_RT2880=y
# CONFIG_MIPS_PLATFORM_DEVICES is not set
CONFIG_MIKROTIK=y
CONFIG_MIKROTIK_RB_SYSFS=y
# CONFIG_IOMMU_SUPPORT is not set
# CONFIG_NVMEM_SYSFS is not set
# CONFIG_MANDATORY_FILE_LOCKING is not set
# CONFIG_DNOTIFY is not set
CONFIG_OVERLAY_FS=y
# CONFIG_PROC_PAGE_MONITOR is not set
CONFIG_TMPFS=y
CONFIG_TMPFS_XATTR=y
CONFIG_JFFS2_FS=y
CONFIG_JFFS2_SUMMARY=y
CONFIG_JFFS2_FS_XATTR=y
# CONFIG_JFFS2_FS_POSIX_ACL is not set
# CONFIG_JFFS2_FS_SECURITY is not set
CONFIG_JFFS2_COMPRESSION_OPTIONS=y
# CONFIG_JFFS2_ZLIB is not set
CONFIG_JFFS2_LZMA=y
CONFIG_UBIFS_FS=y
# CONFIG_UBIFS_FS_SECURITY is not set
CONFIG_SQUASHFS=y
CONFIG_SQUASHFS_FILE_DIRECT=y
CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y
# CONFIG_SQUASHFS_ZLIB is not set
CONFIG_SQUASHFS_XZ=y
CONFIG_SQUASHFS_EMBEDDED=y
CONFIG_SECURITY_DMESG_RESTRICT=y
CONFIG_HARDENED_USERCOPY=y
# CONFIG_HARDENED_USERCOPY_FALLBACK is not set
CONFIG_FORTIFY_SOURCE=y
CONFIG_LSM="lockdown,yama,loadpin,safesetid,integrity"
CONFIG_CRYPTO_PCRYPT=y
CONFIG_CRYPTO_CCM=y
CONFIG_CRYPTO_GCM=y
CONFIG_CRYPTO_BLAKE2S=y
CONFIG_CRYPTO_AES=y
# CONFIG_CRYPTO_HW is not set
CONFIG_CRYPTO_LIB_ARC4=y
CONFIG_CRC32_SARWATE=y
# CONFIG_XZ_DEC_X86 is not set
# CONFIG_XZ_DEC_POWERPC is not set
# CONFIG_XZ_DEC_IA64 is not set
# CONFIG_XZ_DEC_ARM is not set
# CONFIG_XZ_DEC_ARMTHUMB is not set
# CONFIG_XZ_DEC_SPARC is not set
CONFIG_TEXTSEARCH=y
CONFIG_DYNAMIC_DEBUG_CORE=y
# CONFIG_ENABLE_MUST_CHECK is not set
CONFIG_STRIP_ASM_SYMS=y
CONFIG_DEBUG_FS=y
# CONFIG_DEBUG_MISC is not set
CONFIG_PANIC_ON_OOPS=y
CONFIG_PANIC_TIMEOUT=1
# CONFIG_SCHED_DEBUG is not set
# CONFIG_RCU_TRACE is not set
# CONFIG_FTRACE is not set
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="rootfstype=squashfs,jffs2"

Arınç



More information about the openwrt-devel mailing list