package/environment-setup: add better kernel handling
authorAngelo Compagnucci <angelo@amarulasolutions.com>
Mon, 9 Nov 2020 16:58:03 +0000 (17:58 +0100)
committerArnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Tue, 1 Dec 2020 20:52:46 +0000 (21:52 +0100)
Exporting ARCH and KERNELDIR makes easier to compile an external kernel
or out of tree kernel modules.

Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
Reviewed-by: Matt Weber <matthew.weber@rockwellcollins.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
package/environment-setup/environment-setup
package/environment-setup/environment-setup.mk

index 813aa01c7a063f7c0f23d863899f632f62cba7e2..e9bc36fdd0933d9d75f03b59ececc7361d5a0fa5 100644 (file)
@@ -10,6 +10,7 @@ cat <<'EOF'
 Some tips:
 * PATH now contains the SDK utilities
 * Standard autotools variables (CC, LD, CFLAGS) are exported
+* Kernel compilation variables (ARCH, CROSS_COMPILE, KERNELDIR) are exported
 * To configure do "./configure $CONFIGURE_FLAGS" or use
   the "configure" alias
 * To build CMake-based projects, use the "cmake" alias
index fb87c6f0b7545ecaeebcf002e650347ddb6c212c..fcad013f0decfcd80e2dcf960f370e0cdc14f572 100644 (file)
@@ -11,6 +11,7 @@ define HOST_ENVIRONMENT_SETUP_INSTALL_CMDS
        for var in $(TARGET_CONFIGURE_OPTS); do \
                printf "export \"$$var\"\n" >> $(ENVIRONMENT_SETUP_FILE); \
        done
+       printf "export \"ARCH=$(KERNEL_ARCH)\"\n" >> $(ENVIRONMENT_SETUP_FILE)
        printf "export \"CROSS_COMPILE=$(TARGET_CROSS)\"\n" >> $(ENVIRONMENT_SETUP_FILE)
        printf "export \"CONFIGURE_FLAGS=--target=$(GNU_TARGET_NAME) \
                --host=$(GNU_TARGET_NAME) \
@@ -31,6 +32,10 @@ define HOST_ENVIRONMENT_SETUP_INSTALL_CMDS
                $(ENVIRONMENT_SETUP_FILE)
        printf "export \"PATH=\$$SDK_PATH/bin:\$$SDK_PATH/sbin:\$$PATH\"\n" \
                >> $(ENVIRONMENT_SETUP_FILE)
+
+       $(if $(BR2_LINUX_KERNEL),\
+               printf "export \"KERNELDIR=$(LINUX_BUILDDIR)\"\n" \
+                       >> $(ENVIRONMENT_SETUP_FILE),)
 endef
 
 $(eval $(host-generic-package))