############################################################################### # # # IPFire.org - A linux based firewall # # Copyright (C) 2007-2014 IPFire Team # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program. If not, see . # # # ############################################################################### ############################################################################### # Definitions ############################################################################### include Config VER = 3.14.22 RPI_PATCHES = 3.14.22-grsec-ipfire1 A7M_PATCHES = 3.14.22-grsec-ipfire1 GRS_PATCHES = grsecurity-3.0-3.14.22-201410192047.patch.xz THISAPP = linux-$(VER) DL_FILE = linux-$(VER).tar.xz DL_FROM = $(URL_IPFIRE) DIR_APP = $(DIR_SRC)/$(THISAPP) CFLAGS = CXXFLAGS = PAK_VER = 52 DEPS = "" VERSUFIX=ipfire$(KCFG) ifeq "$(TOOLS)" "1" TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)-tools HEADERS_PREFIX = /tools else TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX) HEADERS_PREFIX = /usr endif ifeq "$(MACHINE_TYPE)" "arm" HEADERS_ARCH=arm else HEADERS_ARCH=x86 endif ifeq "$(KCFG)" "" LASTKERNEL=1 endif ifeq "$(KCFG)" "-kirkwood" LASTKERNEL=1 endif ############################################################################### # Top-level Rules ############################################################################### objects =$(DL_FILE) \ rpi-patches-$(RPI_PATCHES).patch.xz \ arm7-multi-patches-$(A7M_PATCHES).patch.xz \ $(GRS_PATCHES) $(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE) rpi-patches-$(RPI_PATCHES).patch.xz = $(URL_IPFIRE)/rpi-patches-$(RPI_PATCHES).patch.xz arm7-multi-patches-$(A7M_PATCHES).patch.xz = $(URL_IPFIRE)/arm7-multi-patches-$(A7M_PATCHES).patch.xz $(GRS_PATCHES) = $(URL_IPFIRE)/$(GRS_PATCHES) $(DL_FILE)_MD5 = cb00fadd0a720cc2d1690792e72e0134 rpi-patches-$(RPI_PATCHES).patch.xz_MD5 = 75adff006d9dbc9be76e6c44eb80698f arm7-multi-patches-$(A7M_PATCHES).patch.xz_MD5 = 06cdc33ba0c28b4b5ec876d8f8297b82 $(GRS_PATCHES)_MD5 = a63b899587068885951e762ad53f5b50 install : $(TARGET) check : $(patsubst %,$(DIR_CHK)/%,$(objects)) download :$(patsubst %,$(DIR_DL)/%,$(objects)) md5 : $(subst %,%_MD5,$(objects)) dist: @$(PAK) ############################################################################### # Downloading, checking, md5sum ############################################################################### $(patsubst %,$(DIR_CHK)/%,$(objects)) : @$(CHECK) $(patsubst %,$(DIR_DL)/%,$(objects)) : @$(LOAD) $(subst %,%_MD5,$(objects)) : @$(MD5) ############################################################################### # Installation Details ############################################################################### $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) @rm -rf $(DIR_APP) $(DIR_SRC)/linux && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE) ln -svf linux-$(VER) $(DIR_SRC)/linux # Linux Intermediate Queueing Device cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.22-imq.patch # ipp2p 0.8.2-ipfire cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10-ipp2p-0.8.2-ipfire.patch # Layer7-patch cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14-layer7-filter.patch # Grsecurity-patches ifneq "$(KCFG)" "-headers" cd $(DIR_APP) && xz -c -d $(DIR_DL)/$(GRS_PATCHES) | patch -Np1 cd $(DIR_APP) && rm localversion-grsec cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.7-disable-compat_vdso.patch endif # DVB Patches cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.22-dvbsky.patch cd $(DIR_APP) && patch -Np2 < $(DIR_SRC)/src/patches/v4l-dvb_fix_tua6034_pll.patch # Wlan Patches cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/compat-drivers-3.8.3-ath_ignore_eeprom_regdomain.patch cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.22-iwlwifi-noibss_only_on_radar_chan.patch cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.37-rt2800usb_add_dlink_dwa137_usbid.patch cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.55-rt2800usb-change_queue_warn_to_debug.patch cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.39-add_libertas_uap.patch # mISDN Patches cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/mISDN_hfc-s_add_id.patch cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/mISDN-hfcusb-reportl1down.patch # Add LED trigger cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.9-ledtrig-netdev-1.patch # cs5535audio spams syslog if no ac97 was present (geos router) cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.30_cs5535audio_fix_logspam_on_geos.patch # Add PC Engines APU led support cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10-apu_leds.patch # Fix uevent PHYSDEVDRIVER cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2.33_ipg-fix-driver-name.patch cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.27_mcs7830-fix-driver-name.patch ifeq "$(KCFG)" "-kirkwood" cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.10-mv_cesa_disable_failing_hmac_sha1.patch endif ifeq "$(KCFG)" "-multi" cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10-smsc95xx-add_mac_addr_param.patch # Apply Arm7-multiarch kernel patches. cd $(DIR_APP) && xzcat $(DIR_DL)/arm7-multi-patches-$(A7M_PATCHES).patch.xz | patch -Np1 endif ifeq "$(KCFG)" "-rpi" # Apply Raspberry Pi kernel patches. cd $(DIR_APP) && xzcat $(DIR_DL)/rpi-patches-$(RPI_PATCHES).patch.xz | patch -Np1 endif ifeq "$(KCFG)" "-headers" # Install the header files cd $(DIR_APP) && make ARCH=$(HEADERS_ARCH) INSTALL_HDR_PATH=dest headers_install -mkdir -pv $(BUILDROOT)/$(HEADERS_PREFIX)/include cd $(DIR_APP) && find dest/include \( -name .install -o -name ..install.cmd \) -delete cd $(DIR_APP) && cp -rv dest/include/* $(BUILDROOT)/$(HEADERS_PREFIX)/include else # Install ipfire logo cd $(DIR_APP) && cp -vf $(DIR_SRC)/config/kernel/ipfire_logo.ppm \ drivers/video/logo/logo_linux_clut224.ppm # Cleanup kernel source cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE)-$(VERSUFIX) $(DIR_APP)/.config cd $(DIR_APP) && make oldconfig cd $(DIR_APP) && make clean cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ -$(VERSUFIX)/' Makefile ifeq "$(KCFG)" "-kirkwood" cd $(DIR_APP) && make $(MAKETUNING) uImage modules cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/vmlinuz-$(VER)-$(VERSUFIX) cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/uImage-$(VERSUFIX) else ifeq "$(KCFG)" "-multi" cd $(DIR_APP) && make $(MAKETUNING) zImage modules cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/vmlinuz-$(VER)-$(VERSUFIX) cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/zImage-$(VERSUFIX) else ifeq "$(KCFG)" "-rpi" cd $(DIR_APP) && make $(MAKETUNING) zImage modules cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/vmlinuz-$(VER)-$(VERSUFIX) cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/kernel.img else cd $(DIR_APP) && make $(MAKETUNING) bzImage modules cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-$(VERSUFIX) endif endif endif cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX) cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX) cd $(DIR_APP) && make $(MAKETUNING) modules_install cd $(DIR_APP) && make $(MAKETUNING) firmware_install ifeq "$(MACHINE_TYPE)" "arm" cd $(DIR_APP) && make $(MAKETUNING) dtbs cd $(DIR_APP) && for f in $$(find arch/arm/boot/dts/ -name *.dtb); do \ mkdir -p /boot/dtb-$(VER)-$(VERSUFIX) ; \ install -m 644 $$f /boot/dtb-$(VER)-$(VERSUFIX)/ ; \ done endif ifeq "$(LASTKERNEL)" "1" # Only do this once cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/ # Blacklist matroxfb_base echo "blacklist matroxfb_base" >> /etc/modprobe.d/framebuffer.conf # Blacklist old framebuffer modules for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/video -name *fb.ko); do \ echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \ done # Blacklist new drm framebuffer modules for f in $$(ls -1 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/gpu/drm/*/*.ko); do \ echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \ done sed -i -e "s|.ko||g" /etc/modprobe.d/framebuffer.conf # Blacklist isdn modules for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn -name *.ko); do \ echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/isdn.conf ; \ done sed -i -e "s|.ko||g" /etc/modprobe.d/isdn.conf # Disable ipv6 at runtime echo "options ipv6 disable_ipv6=1" > /etc/modprobe.d/ipv6.conf endif endif #force new build of external modules and initrd if the kernel was rebuild -rm -f /usr/src/log/*-kmod-$(VER)-$(VERSUFIX) -rm -f /usr/src/log/linux-initrd-$(VER)-$(VERSUFIX) @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/netfilter-layer7-* @$(POSTBUILD)