aboutsummaryrefslogtreecommitdiffstats
path: root/include/kernel-defaults.mk
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2016-02-01 01:06:56 +0000
committerFlorian Fainelli <florian@openwrt.org>2016-02-01 01:06:56 +0000
commitd9fab8760714b364c286bc37fc0de1d4006b29ff (patch)
treee03d8831882ea3c5eee5fd3b8917ad575a7a6de6 /include/kernel-defaults.mk
parent312367665ad4e280df36c5f47b114ed680abc3eb (diff)
downloadupstream-d9fab8760714b364c286bc37fc0de1d4006b29ff.tar.gz
upstream-d9fab8760714b364c286bc37fc0de1d4006b29ff.tar.bz2
upstream-d9fab8760714b364c286bc37fc0de1d4006b29ff.zip
kernel: set root on NFS when enabled
Replace the configured root device with a NFS root device and automatic IP configuration for booting over NFS. Signed-off-by: Florian Fainelli <florian@openwrt.org> SVN-Revision: 48591
Diffstat (limited to 'include/kernel-defaults.mk')
-rw-r--r--include/kernel-defaults.mk13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk
index ae02556058..7c99182a46 100644
--- a/include/kernel-defaults.mk
+++ b/include/kernel-defaults.mk
@@ -104,6 +104,18 @@ define Kernel/SetNoInitramfs
echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config.set
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
+ endef
+else
+ define Kernel/SetNfsCmdline
+ endef
+endif
+
define Kernel/Configure/Default
$(LINUX_CONF_CMD) > $(LINUX_DIR)/.config.target
# copy CONFIG_KERNEL_* settings over to .config.target
@@ -114,6 +126,7 @@ define Kernel/Configure/Default
$(SCRIPT_DIR)/metadata.pl kconfig $(TMP_DIR)/.packageinfo $(TOPDIR)/.config $(KERNEL_PATCHVER) > $(LINUX_DIR)/.config.override
$(SCRIPT_DIR)/kconfig.pl 'm+' '+' $(LINUX_DIR)/.config.target /dev/null $(LINUX_DIR)/.config.override > $(LINUX_DIR)/.config.set
$(call Kernel/SetNoInitramfs)
+ $(call Kernel/SetNfsCmdline)
rm -rf $(KERNEL_BUILD_DIR)/modules
cmp -s $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config.prev || { \
cp $(LINUX_DIR)/.config.set $(LINUX_DIR)/.config; \