diff --git a/Makefile b/Makefile index db02404..7cde9e3 100644 --- a/Makefile +++ b/Makefile @@ -9,14 +9,14 @@ # GNU General Public License for more details. export SRCPKG = $(shell echo $(PWD)|sed 's/.*\///') -export DEPENDS = mkinitramfs export ARCH = x86_64 export URL = https://www.kernel.org/ BRIEF = The Linux kernel DESC = Linux is a clone of the operating system Unix, written from scratch \ by Linus Torvalds with assistance from a loosely-knit team of hackers \ across the Net. -export SNAPVER = 6 +export SNAPVER = $(shell grep '^CONFIG_LOCALVERSION=' SNAP/config| \ + sed 's/.*="\-\|"$$//g') ARCHIVE := $(PWD)/SRC/$(shell ls SRC|egrep '(bz2|gz|tar|xz)$$'|tail -1) TYPE := $(shell file -ib $(ARCHIVE)|cut -d';' -f1|tr -d '\n') @@ -24,18 +24,20 @@ SRCDIR := $(shell tar -tf $(ARCHIVE)|head -1|sed 's/\/.*//') PATCHDIR := $(PWD)/SRC/patches export KERNVER := $(shell echo $(SRCDIR)|egrep -o '\-[0-9].*'|sed 's/^-//') export VERSION := $(KERNVER)-$(SNAPVER) +export DEPENDS = mkinitramfs,linux-firmware # This overrids the package file name in Makefile.snaplinux # This is necessary due to the kernel version string being # a part of the package name -SNAP = $(PACKAGE)-$(SNAPVER).snap +PACKAGE = $(shell echo $(PWD)|sed 's/.*\///')-$(SNAPVER) +PKGFILE = $(PACKAGE).snap LINUX-DOC := $(PWD)/linux-doc-$(KERNVER) LINUX-DOC-ROOT := $(LINUX-DOC)/ROOT -LINUX-FIRMWARE := $(PWD)/linux-firmware-$(KERNVER) +LINUX-FIRMWARE := $(PWD)/linux-firmware LINUX-FIRMWARE-ROOT := $(LINUX-FIRMWARE)/ROOT -LINUX-HEADERS := $(PWD)/linux-headers-$(KERNVER) +LINUX-HEADERS := $(PWD)/linux-headers-$(KERNVER)-$(SNAPVER) LINUX-HEADERS-ROOT := $(LINUX-HEADERS)/ROOT include /usr/share/snap/Makefile.snaplinux @@ -44,21 +46,30 @@ $(LINUX-DOC-ROOT): $(LINUX-HEADERS-ROOT) @install -v -d $(LINUX-DOC)/SNAP && \ install -v -d $(LINUX-DOC-ROOT) && \ install -d -m 755 \ - $(LINUX-DOC-ROOT)/usr/share/doc/linux-$(VERSION) && \ + $(LINUX-DOC-ROOT)/usr/share/doc/linux-$(KERNVER) && \ cp -r $(SRCDIR)/Documentation/* \ - $(LINUX-DOC-ROOT)/usr/share/doc/linux-$(VERSION) && \ + $(LINUX-DOC-ROOT)/usr/share/doc/linux-$(KERNVER) && \ find $(LINUX-DOC-ROOT) -name \*.txt -o -name \*.html \ -exec gzip {} \; && \ cd $(LINUX-DOC) && make -f ../Makefile.linux-doc && mv *.snap ../ $(LINUX-HEADERS-ROOT): $(LINUX-FIRMWARE-ROOT) - @HDR=$(LINUX-HEADERS-ROOT)/usr/src/linux-headers-$(VERSION) && \ + @HEADERS=$(LINUX-HEADERS-ROOT)/usr/src/linux-headers-$(VERSION) && \ install -v -d $(LINUX-HEADERS)/SNAP && \ install -v -d $(LINUX-HEADERS-ROOT) && \ + install -v -d -m 755 $$HEADERS && \ + install -v -d -m 755 $$HEADERS/arch/x86/kernel && \ + install -v -d -m 755 $$HEADERS/arch/x86/include && \ install -v -d -m 755 $(LINUX-HEADERS-ROOT)/lib/modules/$(VERSION) && \ ln -sf /usr/src/linux-headers-$(VERSION) \ - $(LINUX-HEADERS-ROOT)/lib/modules/$(VERSION)/source && \ - cd $(SRCDIR) && make headers_install INSTALL_HDR_PATH=$$HDR && \ + $(LINUX-HEADERS-ROOT)/lib/modules/$(VERSION)/build && \ + cd $(SRCDIR) && make headers_install \ + INSTALL_HDR_PATH=$(LINUX-HEADERS-ROOT)/usr && \ + cp -vrp {include,Makefile,Module.symvers,scripts} $$HEADERS && \ + cp -vrp arch/x86/include/uapi $$HEADERS/arch/x86/include/uapi && \ + cp -vp arch/x86/Makefile $$HEADERS/arch/x86/Makefile && \ + cp -vp arch/x86/kernel/asm-offsets.s \ + $$HEADERS/arch/x86/kernel/asm-offsets.s && \ cd $(LINUX-HEADERS) && make -f ../Makefile.linux-headers && \ mv *.snap ../ @@ -102,12 +113,13 @@ $(ROOT): $(LINUX-DOC-ROOT) rm -rf $(ROOT)/lib/firmware && \ install -d -m 755 $(ROOT)/boot && \ install -d -m 755 $(ROOT)/etc/modprobe.d && \ + install -d -m 755 $(ROOT)/usr/share/linux-$(VERSION) && \ install -m 644 .config $(ROOT)/boot/config-$(VERSION) && \ install -m 644 System.map \ $(ROOT)/boot/System.map-$(VERSION) && \ install -m 644 arch/x86_64/boot/bzImage \ $(ROOT)/boot/vmlinuz-$(VERSION) && \ - install -m 644 ../SNAP/usb.conf $(ROOT)/etc/modprobe.d/usb.conf + install -m 644 ../SNAP/usb.conf $(ROOT)/usr/share/linux-$(VERSION) test: $(ROOT) @cd $(SRCDIR); \ diff --git a/Makefile.linux-doc b/Makefile.linux-doc index 9b83f62..a962844 100644 --- a/Makefile.linux-doc +++ b/Makefile.linux-doc @@ -8,8 +8,10 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. +DEPENDS = BRIEF = Documentation for The Linux kernel DESC = Detailed documentation describing the Linux kernel -SNAP = $(PACKAGE)-$(SNAPVER).snap +PACKAGE = $(shell echo $(PWD)|sed 's/.*\///') +PKGFILE = $(PACKAGE)-$(SNAPVER).snap include /usr/share/snap/Makefile.snaplinux diff --git a/Makefile.linux-firmware b/Makefile.linux-firmware index 6c6176f..e2a5f5c 100644 --- a/Makefile.linux-firmware +++ b/Makefile.linux-firmware @@ -11,7 +11,5 @@ DEPENDS = BRIEF = Firmware for the Linux kernel DESC = This provides the firmware necessary for some Linux kernel modules -VERSION = $(KERNVER)-$(SNAPVER) -SNAP = $(PACKAGE)-$(SNAPVER).snap include /usr/share/snap/Makefile.snaplinux diff --git a/Makefile.linux-headers b/Makefile.linux-headers index 40a6300..41978f3 100644 --- a/Makefile.linux-headers +++ b/Makefile.linux-headers @@ -8,9 +8,11 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. +DEPENDS = BRIEF = Header files for The Linux kernel DESC = This provides the header files that are generally used to compile \ kernel modules -SNAP = $(PACKAGE)-$(SNAPVER).snap +PACKAGE = $(shell echo $(PWD)|sed 's/.*\///') +PKGFILE = $(PACKAGE).snap include /usr/share/snap/Makefile.snaplinux diff --git a/SNAP/config b/SNAP/config index 1846385..e8e42c6 100644 --- a/SNAP/config +++ b/SNAP/config @@ -50,7 +50,7 @@ CONFIG_BUILDTIME_EXTABLE_SORT=y CONFIG_INIT_ENV_ARG_LIMIT=32 CONFIG_CROSS_COMPILE="" # CONFIG_COMPILE_TEST is not set -CONFIG_LOCALVERSION="-6" +CONFIG_LOCALVERSION="-7" # CONFIG_LOCALVERSION_AUTO is not set CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_BZIP2=y diff --git a/SNAP/usher b/SNAP/usher index a1a2eed..29a5e14 100755 --- a/SNAP/usher +++ b/SNAP/usher @@ -18,6 +18,11 @@ case $1 in mkinitramfs ${VERSION} grub-mkconfig -o /boot/grub/grub.cfg fi + + if [ ! -f ${TARGET}/etc/modprobe.d/usb.conf ]; then + cp ${TARGET}/usr/share/linux-${VERSION}/usb.conf \ + ${TARGET}/etc/modprobe.d/usb.conf + fi ;; prerm) exit 0