[OpenWrt-Devel] [PATCH] kernel/build: Fix SetNfsCmdline to work with new .config.set

Petr Štetiar ynezz at true.cz
Tue Feb 9 15:04:14 EST 2016


Hi,

I'll remove this patch from patchwork as I've just realized, that it needs more work. See bellow.

> This patch fixes SetNfsCmdline macro which is currently relying on old
> kernel .config file, which has been replaced with intermediate
> .config.set file. It was leading to the following kernel build error:
> 
>   rm -f linux-4.4/.config.prev
>   mv linux-4.4/.config linux-4.4/.config.old
>   mv: cannot stat 'linux-4.4/.config': No such file or directory
> 
> Signed-off-by: Petr Štetiar <ynezz at true.cz>
> ---
>  include/kernel-defaults.mk | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
> index 4b5de5b..44e3c27 100644
> --- a/include/kernel-defaults.mk
> +++ b/include/kernel-defaults.mk
> @@ -107,9 +107,9 @@ endef
>  ifeq ($(CONFIG_KERNEL_ROOT_NFS),y)
>    define Kernel/SetNfsCmdline
>  	rm -f $(LINUX_DIR)/.config.prev
> -	mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
> -	grep -v "CONFIG_CMDLINE=" $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
> -	grep "CONFIG_CMDLINE=" $(LINUX_DIR)/.config.old | cut -d\" -f2 | sed 's/root=\/dev\/\([a-z0-9]*\)\(.*\)/CONFIG_CMDLINE=\"root=\/dev\/nfs ip=dhcp\2\"/' >> $(LINUX_DIR)/.config
> +	mv $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.old
> +	grep -v "CONFIG_CMDLINE=" $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config.set
> +	grep "CONFIG_CMDLINE=" $(LINUX_DIR)/.config.old | cut -d\" -f2 | sed 's/root=\/dev\/\([a-z0-9]*\)\(.*\)/CONFIG_CMDLINE=\"root=\/dev\/nfs ip=dhcp\2\"/' >> $(LINUX_DIR)/.config.set
>    endef

This cut/sed kung-fu needs some improvements:

 * it doesn't work correctly in case of empty cmdline, CONFIG_CMDLINE=""
 * how to handle custom cmdline options? For example I don't want to use this
   hardcoded cmdline options, but use instead options provided by the bootloader

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