Modify

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#167 closed defect (fixed)

Edit openwrt/openwrt-deliver.mk to handle kernel version 3.0

Reported by: shinton@… Owned by: amain
Priority: blocker Milestone: milestone:
Component: buildsystem Version: 2.0
Severity: severity 4 Keywords: 3.0 kernel linux blocker cannot stat 3.0.0
Cc:

Description

When selecting linux kernel 3.0 the following build error is produced:

cp: cannot stat `/home/stephen/debwrt/build/openwrt-brcm4716-None-trunk-default/tmp/modules/lib/modules/3.0': No such file or directory

This is because linux kernel 3.0 refers to itself as 3.0.0 or at least as far as insmod is concerned. The targets

"openwrt/deliver/kernel-modules: openwrt/deliver/prepare"

and
"openwrt/deliver/kernel-headers: openwrt/deliver/prepare"

in openwrt/openwrt-deliver.mk will need to be modified so that ${OPENWRT_LINUX_VERSION} is replaced with 3.0.0 if ${OPENWRT_LINUX_VERSION}=3.0.

*Please note that ${OPENWRT_LINUX_VERSION} cannot be changed to 3.0.0 globally as other elements of openwrt use this and require it to read 3.0.

Changeset 27761 in openwrt here: https://dev.openwrt.org/changeset/27761/trunk/include/kernel.mk details how they resolved the problem for their kernel.mk file. A similar approach could probably be used here.

Attachments (0)

Change History (16)

comment:1 Changed 8 years ago by shinton@…

Any update? Should I just modify the plugin to hardcode these values to 3.0.0?

comment:2 Changed 8 years ago by amain

  • Status changed from new to accepted

comment:3 Changed 8 years ago by shinton@…

Ive created a set of patches to fix this problem:

openwrt-deliver:

--- brcm4716/openwrt/openwrt-deliver.mk 2011-11-06 19:37:23.301073551 -0700
+++ brcm4716.new/openwrt/openwrt-deliver.mk 2011-11-06 03:10:13.202284254 -0700
@@ -18,11 +18,12 @@

# The following function imports some environment variables
# save in a special config file during OpenWrt's build process
#

-# OPENWRT_BIN_DIR - directory where OpenWrt firmware is stored
-# OPENWRT_PACKAGE_DIR - directory where OpenWrt packages are stored
-# OPENWRT_TMP_DIR - directory where OpenWrt stored all kernel modules
-# OPENWRT_LINUX_VERSION - kernel version of the kernel build by OpenWrt
-# OPENWRT_LINUX_DIR - OpenWrt's kernel build directory
+# OPENWRT_BIN_DIR - directory where OpenWrt firmware is stored
+# OPENWRT_PACKAGE_DIR - directory where OpenWrt packages are stored
+# OPENWRT_TMP_DIR - directory where OpenWrt stored all kernel modules
+# OPENWRT_LINUX_VERSION - kernel version of the kernel build by OpenWrt
+# OPENWRT_KERNEL_VERSION - kernel version as insmod sees it (will be different that OPENWRT_LINUX_VERSION if using kernel 3.0, otherwise same)
+# OPENWRT_LINUX_DIR - OpenWrt's kernel build directory

#
-include $(OPENWRT_SAVE_CONFIG_FILE)


@@ -45,6 +46,7 @@

@echo OPENWRT_PACKAGE_DIR=$(OPENWRT_PACKAGE_DIR)
@echo OPENWRT_TMP_DIR=$(OPENWRT_TMP_DIR)
@echo OPENWRT_LINUX_VERSION=$(OPENWRT_LINUX_VERSION)

+ @echo OPENWRT_KERNEL_VERSION=$(OPENWRT_KERNEL_VERSION)

@echo OPENWRT_LINUX_DIR=$(OPENWRT_LINUX_DIR)


openwrt/deliver/check: ${OPENWRT_BIN_DIR} openwrt/deliver/import-config

@@ -57,6 +59,9 @@

ifndef OPENWRT_LINUX_VERSION

@echo OPENWRT_LINUX_VERSION$(ERROR_MSG_NOCONF) && false

endif

+ ifndef OPENWRT_KERNEL_VERSION
+ @echo OPENWRT_KERNEL_VERSION$(ERROR_MSG_NOCONF) && false
+ endif

ifndef OPENWRT_LINUX_DIR

@echo OPENWRT_LINUX_DIR$(ERROR_MSG_NOCONF) && false

endif

@@ -75,23 +80,23 @@

openwrt/deliver/kernel-modules: openwrt/deliver/prepare

mkdir -p $(INSTALL_DIR) $(INSTALL_DIR_OPENWRT) $(INSTALL_DIR_OPENWRT_MODULES)
mkdir -p $(INSTALL_DIR_OPENWRT_MODULES)/lib/modules

  • cp -r ${OPENWRT_TMP_DIR}/modules/lib/modules/${OPENWRT_LINUX_VERSION} $(INSTALL_DIR_OPENWRT_MODULES)/lib/modules
  • rm -f $(INSTALL_DIR_OPENWRT_MODULES)/lib/modules/${OPENWRT_LINUX_VERSION}/build
  • rm -f $(INSTALL_DIR_OPENWRT_MODULES)/lib/modules/${OPENWRT_LINUX_VERSION}/source

+ cp -r ${OPENWRT_TMP_DIR}/modules/lib/modules/${OPENWRT_KERNEL_VERSION} $(INSTALL_DIR_OPENWRT_MODULES)/lib/modules
+ rm -f $(INSTALL_DIR_OPENWRT_MODULES)/lib/modules/${OPENWRT_KERNEL_VERSION}/build
+ rm -f $(INSTALL_DIR_OPENWRT_MODULES)/lib/modules/${OPENWRT_KERNEL_VERSION}/source

find $(OPENWRT_PACKAGE_DIR) -name "kmod-*" | while read fkmod; do \

$(SCRIPT_EXTRACT_KMODPKG) $$fkmod $(INSTALL_DIR_OPENWRT_MODULES) $(TMP_DIR)
true; \

done

  • PATH="/sbin:/bin:/usr/sbin:/usr/bin" depmod -a -b $(INSTALL_DIR_OPENWRT_MODULES) ${OPENWRT_LINUX_VERSION}

+ PATH="/sbin:/bin:/usr/sbin:/usr/bin" depmod -a -b $(INSTALL_DIR_OPENWRT_MODULES) ${OPENWRT_KERNEL_VERSION}

tar czf $(INSTALL_DIR)/$(MODULES_TAR_GZ) -C $(INSTALL_DIR_OPENWRT_MODULES) .


openwrt/deliver/kernel-headers: openwrt/deliver/prepare

rm -rf $(INSTALL_DIR_OPENWRT_HEADERS)
mkdir -p $(INSTALL_DIR_OPENWRT_HEADERS)

  • mkdir -p $(INSTALL_DIR_OPENWRT_HEADERS)/usr/src/linux-headers-${OPENWRT_LINUX_VERSION}
  • cd $(OPENWRT_LINUX_DIR) && make headers_install ARCH=$(patsubst %el,%,$(TARGET_ARCH)) INSTALL_HDR_PATH=$(INSTALL_DIR_OPENWRT_HEADERS)/usr/src/linux-headers-${OPENWRT_LINUX_VERSION}

+ mkdir -p $(INSTALL_DIR_OPENWRT_HEADERS)/usr/src/linux-headers-${OPENWRT_KERNEL_VERSION}
+ cd $(OPENWRT_LINUX_DIR) && make headers_install ARCH=$(patsubst %el,%,$(TARGET_ARCH)) INSTALL_HDR_PATH=$(INSTALL_DIR_OPENWRT_HEADERS)/usr/src/linux-headers-${OPENWRT_KERNEL_VERSION}

# some overrides which are not cleanly installed by make headers_install

  • cp $(OPENWRT_LINUX_DIR)/include/linux/switch.h $(INSTALL_DIR_OPENWRT_HEADERS)/usr/src/linux-headers-${OPENWRT_LINUX_VERSION}/include/linux/switch.h
  • cp ${OPENWRT_LINUX_DIR}/.config $(INSTALL_DIR_OPENWRT_HEADERS)/usr/src/linux-headers-${OPENWRT_LINUX_VERSION}

+ cp $(OPENWRT_LINUX_DIR)/include/linux/switch.h $(INSTALL_DIR_OPENWRT_HEADERS)/usr/src/linux-headers-${OPENWRT_KERNEL_VERSION}/include/linux/switch.h
+ cp ${OPENWRT_LINUX_DIR}/.config $(INSTALL_DIR_OPENWRT_HEADERS)/usr/src/linux-headers-${OPENWRT_KERNEL_VERSION}

tar czf $(INSTALL_DIR)/$(HEADERS_TAR_GZ) -C $(INSTALL_DIR_OPENWRT_HEADERS) .


openwrt/deliver/packages: openwrt/deliver/prepare

comment:4 Changed 8 years ago by shinton@…

trunk:

--- brcm4716/openwrt/patches/trunk/002_install_kernel_modules_and_merge_debwrt_config 2011-11-06 19:37:23.261074837 -0700
+++ brcm4716.new/openwrt/patches/trunk/002_install_kernel_modules_and_merge_debwrt_config 2011-11-06 19:27:49.883649941 -0700
@@ -16,7 +16,7 @@

echo "# CONFIG_KALLSYMS_EXTRA_PASS is not set" >> $(LINUX_DIR)/.config.target
echo "# CONFIG_KALLSYMS_ALL is not set" >> $(LINUX_DIR)/.config.target
echo "# CONFIG_KPROBES is not set" >> $(LINUX_DIR)/.config.target

-@@ -91,7 +93,11 @@
+@@ -91,7 +93,18 @@

define Kernel/CompileModules/Default?

rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map

@@ -25,6 +25,13 @@

+ -mkdir -p $(TMP_DIR)/modules
+ +$(MAKE) $(KERNEL_MAKEOPTS) modules modules_install INSTALL_MOD_PATH=$(TMP_DIR)/modules
+ echo "OPENWRT_LINUX_VERSION=$(LINUX_VERSION)" >> $(TOPDIR)/.openwrt_env

++
++ifeq ($(LINUX_VERSION),3.0)
++ echo "OPENWRT_KERNEL_VERSION=3.0.0" >> $(TOPDIR)/.openwrt_env
++else
++ echo "OPENWRT_KERNEL_VERSION=$(LINUX_VERSION)" >> $(TOPDIR)/.openwrt_env
++endif
++

+ echo "OPENWRT_LINUX_DIR=$(LINUX_DIR)" >> $(TOPDIR)/.openwrt_env

endef


comment:5 Changed 8 years ago by shinton@…

backfire:

--- brcm4716/openwrt/patches/backfire/002_install_kernel_modules_and_merge_debwrt_config 2011-11-06 19:37:23.277074322 -0700
+++ brcm4716.new/openwrt/patches/backfire/002_install_kernel_modules_and_merge_debwrt_config 2011-11-06 19:42:02.012061573 -0700
@@ -11,7 +11,7 @@

# copy CONFIG_KERNEL_* settings over to .config.target

awk '/(#:space:?+)?CONFIG_KERNEL/{sub("CONFIG_KERNEL_","CONFIG_");print}' $(TOPDIR)/.config >> $(LINUX_DIR)/.config.target
echo "# CONFIG_KALLSYMS_EXTRA_PASS is not set" >> $(LINUX_DIR)/.config.target

-@@ -113,7 +115,11 @@
+@@ -113,7 +115,18 @@

define Kernel/CompileModules/Default?

rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map

@@ -20,6 +20,13 @@

+ -mkdir -p $(TMP_DIR)/modules
+ +$(MAKE) $(KERNEL_MAKEOPTS) modules modules_install INSTALL_MOD_PATH=$(TMP_DIR)/modules
+ echo "OPENWRT_LINUX_VERSION=$(LINUX_VERSION)" >> $(TOPDIR)/.openwrt_env

++
++ifeq ($(LINUX_VERSION),3.0)
++ echo "OPENWRT_KERNEL_VERSION=3.0.0" >> $(TOPDIR)/.openwrt_env
++else
++ echo "OPENWRT_KERNEL_VERSION=$(LINUX_VERSION)" >> $(TOPDIR)/.openwrt_env
++endif
++

+ echo "OPENWRT_LINUX_DIR=$(LINUX_DIR)" >> $(TOPDIR)/.openwrt_env

endef


comment:6 Changed 8 years ago by shinton@…

comment:7 Changed 8 years ago by amain

Great! Will have a look into these and apply them to DebWrt SVN.

comment:8 Changed 8 years ago by shinton@…

@Amain could we get these patches or at least something similar in the Svn? The plugin is starting to get messy :)

comment:9 Changed 8 years ago by Shinton@…

Also the patches could be cleaned up, errored on the side of caution and probable modified more than was needed.

comment:10 Changed 8 years ago by anonymous

Just compiled via svn and noticed that modules did not copy over to the rootfs, im thinking these patches might break that function...

comment:11 Changed 8 years ago by shinton@…

Here is my latest patch, fixes the original problem. I believe that the modules not copying over is unrelated. When I do make V=99 they do not copy but if I delete the touch file and run make debian/rootfs/modules-install they do copy.

For my new patch I used the variable created by openwrt to correct this problem so it should be more than safe for the svn. It can be downloaded here: http://dl.dropbox.com/u/29682150/003-fix-ticket-167.patch

comment:12 Changed 8 years ago by shinton@…

The above patch also works for kernel version 3.2 as insmod sees it as 3.2.0.

comment:13 Changed 8 years ago by amain

Fixed in r332. Thank you for the patch! It applied without problem and covered all the required items.

comment:14 Changed 8 years ago by amain

  • Resolution set to fixed
  • Status changed from accepted to closed

comment:15 Changed 7 years ago by canon фотоаппараты

Many thanks for developing the effort to discuss this, I feel strongly about this and like studying a great deal more on this subject. If feasible, as you gain expertise, would you mind updating dev.debwrt.net having a great deal much more info? It is very beneficial for me.

comment:16 Changed 7 years ago by Dorogie devushki Moskva

Informative and precise… Its difficult to find informative and precise information but here I found…

Add Comment

Modify Ticket

Action
as closed The owner will remain amain.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.