aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@do-not-panic.com>2012-11-30 14:26:38 -0800
committerLuis R. Rodriguez <mcgrof@do-not-panic.com>2012-11-30 17:40:09 -0800
commite284076a6bf21f7f8c20d596097d3028e2daa785 (patch)
tree73976c0ea4d4a2efd2f9d771d084f831f40d9ed7
parent9efaa573ca7e745e81100494568ad113c6d232dc (diff)
downloadalx-e284076a6bf21f7f8c20d596097d3028e2daa785.tar.gz
alx: move Linux Makefile to target/linux/
This should make it cleaner at the top level to understand what belongs to what OS. Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
-rw-r--r--Makefile154
-rw-r--r--target/linux/.compat_copy (renamed from .compat_copy)0
-rw-r--r--target/linux/Makefile146
-rw-r--r--target/linux/port.mk27
-rwxr-xr-xtarget/linux/refresh-compat (renamed from refresh-compat)0
5 files changed, 178 insertions, 149 deletions
diff --git a/Makefile b/Makefile
index 73ba311..eb9910d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,156 +1,12 @@
-export KMODDIR?= updates
-KMODDIR_ARG:= "INSTALL_MOD_DIR=$(KMODDIR)"
-ifneq ($(origin KLIB), undefined)
-KMODPATH_ARG:= "INSTALL_MOD_PATH=$(KLIB)"
-else
-export KLIB:= /lib/modules/$(shell uname -r)
-endif
-export KLIB_BUILD ?= $(KLIB)/build
-export MAKE
-
-DESTDIR?=
-
-ifneq ($(KERNELRELEASE),)
-
--include $(COMPAT_CONFIG)
-include $(COMPAT_CONFIG_CW)
-
-NOSTDINC_FLAGS := -I$(M)/include/ \
- -include $(M)/include/linux/compat-2.6.h \
- $(CFLAGS)
-
-obj-y := compat/
-
-
-ifeq ($(BT),)
-
-
-obj-$(CONFIG_COMPAT_NETWORK_MODULES) += src/
-
-
-ifeq ($(CONFIG_STAGING_EXCLUDE_BUILD),)
-endif
-
-endif
-
-
-else
-
-export PWD := $(shell pwd)
-
-# The build will fail if there is any space in PWD.
-ifneq (,$(findstring $() ,$(PWD)))
-$(error "The path to this compat-drivers directory has spaces in it." \
- "Please put it somewhere where there is no space")
-endif
-
-export CFLAGS += \
- -DCOMPAT_BASE="\"$(shell cat $(PWD)/.compat_base)\"" \
- -DCOMPAT_BASE_TREE="\"$(shell cat $(PWD)/.compat_base_tree)\"" \
- -DCOMPAT_BASE_TREE_VERSION="\"$(shell cat $(PWD)/.compat_base_tree_version)\"" \
- -DCOMPAT_PROJECT="\"Compat-wireless\"" \
- -DCOMPAT_VERSION="\"$(shell cat $(PWD)/.compat_version)\""
-
-# These exported as they are used by the scripts
-# to check config and compat autoconf
-export COMPAT_CONFIG_CW=$(PWD)/config.mk
-export COMPAT_CONFIG=$(PWD)/.config
-export CONFIG_CHECK=$(PWD)/.config.mk_md5sum.txt
-export COMPAT_AUTOCONF=include/linux/compat_autoconf.h
-export CREL=$(shell cat $(PWD)/.compat_version)
-export CREL_PRE:=.compat_autoconf_
-export CREL_CHECK:=$(PWD)/$(CREL_PRE)$(CREL)
+include target/linux/port.mk
+#include target/freebsd/port.mk
all: help
help:
@echo Possible build options:
@echo
- @echo make linux-src - Transforms code for integration into linux-next
- @echo make linux - Builds alx for any Linux kernel 2.6.28 - 3.x
-
-$(COMPAT_CONFIG): ;
-
-# Convert unified driver code to Linux, always targeting linux-next
-linux-src:
- @cp -a src target/linux/
-
-# Uses compat-drivers to provide backport functionality
-# to support the linux-next driver down to all supported
-# compat-drivers kernels.
-linux: $(CREL_CHECK)
- @patch -p6 -d target/linux/src/ < unified-drivers/network/0001-backport-alx.patch
- $(MAKE) -C $(KLIB_BUILD) M=$(PWD) modules
- @touch $@
-
-# We use a CREL_CHECK variable which will depend on the environment used to
-# build. If the environment requirements change it forces a reconfiguration
-# check. This means we force a new reconfiguration check if a the user gets a
-# new updates of compat-drivers or when the user updates the $(COMPAT_CONFIG)
-# file.
-# XXX: add kernel target to the CREL_CHECK mix, this would ensure we also
-# reconfigure and build again fresh if we detect a new target kernel is
-# being used.
-$(CREL_CHECK):
- @# Force to regenerate compat autoconf
- +@./compat/scripts/gen-compat-config.sh > $(COMPAT_CONFIG)
- @rm -f $(CONFIG_CHECK)
- +@./scripts/check_config.sh
- @md5sum $(COMPAT_CONFIG_CW) > $(CONFIG_CHECK)
- @touch $@
-
-install: uninstall install-modules install-scripts
-
-install-modules: modules
- $(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) \
- modules_install
- @./scripts/update-initramfs
-
-install-scripts:
- @# All the scripts we can use
- @mkdir -p $(DESTDIR)/usr/lib/compat-drivers/
- @install scripts/modlib.sh $(DESTDIR)/usr/lib/compat-drivers/
- @# If on distributions like Mandriva which like to
- @# compress their modules this will find out and do
- @# it for you. Reason is some old version of modutils
- @# won't know mac80211.ko should be used instead of
- @# mac80211.ko.gz
- @./scripts/compress_modules
- @# Mandrake doesn't have a depmod.d/ conf file to prefer
- @# the updates/ dir which is what we use so we add one for it
- @# (or any other distribution that doens't have this).
- @./scripts/check_depmod
- @# Udev stuff needed for the new compat_firmware_class.
- @./compat/scripts/compat_firmware_install
- @/sbin/depmod -a
- @echo
- @echo Now run:
- @echo
- @echo sudo make unload to unload all: ethernet modules
- @echo
- @echo Run sudo modprobe 'driver-name' to load your desired driver.
- @echo If unsure reboot.
- @echo
-
-uninstall:
- @# New location, matches upstream
- @rm -rf $(KLIB)/$(KMODDIR)/compat/
- @rm -rf $(KLIB)/$(KMODDIR)/drivers/net/ethernet/atheros/alx/alx.ko*
- @# Lets only remove the stuff we are sure we are providing
- @# on the misc directory.
- @/sbin/depmod -a
- @echo
-
-clean:
- $(MAKE) -C $(KLIB_BUILD) M=$(PWD) clean
- @rm -f $(CREL_PRE)*
- @rm -rf target/linux/src/
-unload:
- @./scripts/unload.sh
-
-.PHONY: all clean install uninstall unload modules Makefile linux linux-src
-
-endif
+ @make -s linux-help
+ @#make -s freebsd-help
-clean-files += Module.symvers Module.markers modules modules.order
-clean-files += $(CREL_CHECK) $(CONFIG_CHECK) $(COMPAT_CONFIG)
+.PHONY: help
diff --git a/.compat_copy b/target/linux/.compat_copy
index c3b124d..c3b124d 100644
--- a/.compat_copy
+++ b/target/linux/.compat_copy
diff --git a/target/linux/Makefile b/target/linux/Makefile
new file mode 100644
index 0000000..6e03330
--- /dev/null
+++ b/target/linux/Makefile
@@ -0,0 +1,146 @@
+export KMODDIR?= updates
+KMODDIR_ARG:= "INSTALL_MOD_DIR=$(KMODDIR)"
+ifneq ($(origin KLIB), undefined)
+KMODPATH_ARG:= "INSTALL_MOD_PATH=$(KLIB)"
+else
+export KLIB:= /lib/modules/$(shell uname -r)
+endif
+export KLIB_BUILD ?= $(KLIB)/build
+export MAKE
+
+DESTDIR?=
+
+ifneq ($(KERNELRELEASE),)
+
+-include $(COMPAT_CONFIG)
+include $(COMPAT_CONFIG_CW)
+
+NOSTDINC_FLAGS := -I$(M)/include/ \
+ -include $(M)/include/linux/compat-2.6.h \
+ $(CFLAGS)
+
+obj-y := compat/
+
+
+ifeq ($(BT),)
+
+
+obj-$(CONFIG_COMPAT_NETWORK_MODULES) += src/
+
+
+ifeq ($(CONFIG_STAGING_EXCLUDE_BUILD),)
+endif
+
+endif
+
+
+else
+
+export PWD := $(shell pwd)
+
+# The build will fail if there is any space in PWD.
+ifneq (,$(findstring $() ,$(PWD)))
+$(error "The path to this compat-drivers directory has spaces in it." \
+ "Please put it somewhere where there is no space")
+endif
+
+export CFLAGS += \
+ -DCOMPAT_BASE="\"$(shell cat $(PWD)/.compat_base)\"" \
+ -DCOMPAT_BASE_TREE="\"$(shell cat $(PWD)/.compat_base_tree)\"" \
+ -DCOMPAT_BASE_TREE_VERSION="\"$(shell cat $(PWD)/.compat_base_tree_version)\"" \
+ -DCOMPAT_PROJECT="\"Compat-wireless\"" \
+ -DCOMPAT_VERSION="\"$(shell cat $(PWD)/.compat_version)\""
+
+# These exported as they are used by the scripts
+# to check config and compat autoconf
+export COMPAT_CONFIG_CW=$(PWD)/config.mk
+export COMPAT_CONFIG=$(PWD)/.config
+export CONFIG_CHECK=$(PWD)/.config.mk_md5sum.txt
+export COMPAT_AUTOCONF=include/linux/compat_autoconf.h
+export CREL=$(shell cat $(PWD)/.compat_version)
+export CREL_PRE:=.compat_autoconf_
+export CREL_CHECK:=$(PWD)/$(CREL_PRE)$(CREL)
+
+all: linux
+
+$(COMPAT_CONFIG): ;
+
+# Uses compat-drivers to provide backport functionality
+# to support the linux-next driver down to all supported
+# compat-drivers kernels.
+linux: $(CREL_CHECK)
+ @-patch -N -p6 -d src/ < patches/unified-drivers/network/0001-backport-alx.patch
+ $(MAKE) -C $(KLIB_BUILD) M=$(PWD) modules
+ @touch $@
+
+# We use a CREL_CHECK variable which will depend on the environment used to
+# build. If the environment requirements change it forces a reconfiguration
+# check. This means we force a new reconfiguration check if a the user gets a
+# new updates of compat-drivers or when the user updates the $(COMPAT_CONFIG)
+# file.
+# XXX: add kernel target to the CREL_CHECK mix, this would ensure we also
+# reconfigure and build again fresh if we detect a new target kernel is
+# being used.
+$(CREL_CHECK):
+ @# Force to regenerate compat autoconf
+ +@./compat/scripts/gen-compat-config.sh > $(COMPAT_CONFIG)
+ @rm -f $(CONFIG_CHECK)
+ +@./scripts/check_config.sh
+ @md5sum $(COMPAT_CONFIG_CW) > $(CONFIG_CHECK)
+ @touch $@
+
+install: uninstall install-modules install-scripts
+
+install-modules: modules
+ $(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) \
+ modules_install
+ @./scripts/update-initramfs
+
+install-scripts:
+ @# All the scripts we can use
+ @mkdir -p $(DESTDIR)/usr/lib/compat-drivers/
+ @install scripts/modlib.sh $(DESTDIR)/usr/lib/compat-drivers/
+ @# If on distributions like Mandriva which like to
+ @# compress their modules this will find out and do
+ @# it for you. Reason is some old version of modutils
+ @# won't know mac80211.ko should be used instead of
+ @# mac80211.ko.gz
+ @./scripts/compress_modules
+ @# Mandrake doesn't have a depmod.d/ conf file to prefer
+ @# the updates/ dir which is what we use so we add one for it
+ @# (or any other distribution that doens't have this).
+ @./scripts/check_depmod
+ @# Udev stuff needed for the new compat_firmware_class.
+ @./compat/scripts/compat_firmware_install
+ @/sbin/depmod -a
+ @echo
+ @echo Now run:
+ @echo
+ @echo sudo make unload to unload all: ethernet modules
+ @echo
+ @echo Run sudo modprobe 'driver-name' to load your desired driver.
+ @echo If unsure reboot.
+ @echo
+
+uninstall:
+ @# New location, matches upstream
+ @rm -rf $(KLIB)/$(KMODDIR)/compat/
+ @rm -rf $(KLIB)/$(KMODDIR)/drivers/net/ethernet/atheros/alx/alx.ko*
+ @# Lets only remove the stuff we are sure we are providing
+ @# on the misc directory.
+ @/sbin/depmod -a
+ @echo
+
+clean:
+ $(MAKE) -C $(KLIB_BUILD) M=$(PWD) clean
+ @rm -f $(CREL_PRE)*
+ @rm -rf target/linux/src/
+unload:
+ @./scripts/unload.sh
+
+.PHONY: all clean install uninstall unload modules Makefile linux linux-src
+
+endif
+
+clean-files += Module.symvers Module.markers modules modules.order
+clean-files += $(CREL_CHECK) $(CONFIG_CHECK) $(COMPAT_CONFIG)
diff --git a/target/linux/port.mk b/target/linux/port.mk
new file mode 100644
index 0000000..b083cb8
--- /dev/null
+++ b/target/linux/port.mk
@@ -0,0 +1,27 @@
+TARGET_LINUX=target/linux/
+
+all: help
+
+linux-help:
+ @echo " make linux-src - Transforms code for integration into linux-next"
+ @echo " make linux - Builds alx for any Linux kernel 2.6.28 - 3.x"
+ @echo " make linux-install - Install linux target"
+
+# Convert unified driver code to Linux, always targeting linux-next
+linux-src:
+ @cp -a src $(TARGET_LINUX)
+
+# Uses compat-drivers to provide backport functionality
+# to support the linux-next driver down to all supported
+# compat-drivers kernels.
+linux:
+ $(TARGET_LINUX)/refresh-compat
+ make -C $(TARGET_LINUX)
+
+install-linux:
+ $(MAKE) -C $(TARGET_LINUX) install-modules
+
+uninstall-linux:
+ $(MAKE) -C $(TARGET_LINUX) uninstall
+
+.PHONY: linux-help linux-src linux install-linux uninstall-linux
diff --git a/refresh-compat b/target/linux/refresh-compat
index 53963df..53963df 100755
--- a/refresh-compat
+++ b/target/linux/refresh-compat