From 9957ddd7b92cf31383de4accc632ddf31951b4f6 Mon Sep 17 00:00:00 2001 From: Jay Larson Date: Fri, 24 Mar 2017 15:46:35 -0500 Subject: [PATCH] THe following changes were made: * Moved to new version scheme * Added brief * Split off linux-headers-3.16.37 and linux-firmware as separate packages --- Makefile | 53 ++++++++++++------- Makefile.linux-firmware | 17 ++++++ Makefile.linux-headers-3.16.37 | 15 ++++++ SNAP/{config-3.16.37-sr1 => config-3.16.37-3} | 2 +- SNAP/usher | 34 +++++++++++- 5 files changed, 101 insertions(+), 20 deletions(-) create mode 100644 Makefile.linux-firmware create mode 100644 Makefile.linux-headers-3.16.37 rename SNAP/{config-3.16.37-sr1 => config-3.16.37-3} (99%) diff --git a/Makefile b/Makefile index 57af80c..fd7c66e 100644 --- a/Makefile +++ b/Makefile @@ -8,26 +8,47 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -DEPENDS = mkinitramfs -ARCH = x86_64 -URL = https://www.kernel.org/ +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. -SNAPVER = sr1 +SNAPVER = 3 ARCHIVE := $(PWD)/SRC/$(shell ls SRC|egrep '(bz2|gz|tar|xz)$$'|tail -1) TYPE := $(shell file -ib $(ARCHIVE)|cut -d';' -f1|tr -d '\n') SRCDIR := $(shell tar -tf $(ARCHIVE)|head -1|sed 's/\/.*//') PATCHDIR := $(PWD)/SRC/patches -KERNVER := $(shell echo $(SRCDIR)|egrep -o '\-[0-9].*'|sed 's/^-//') -VERSION := $(SNAPVER) +export KERNVER := $(shell echo $(SRCDIR)|egrep -o '\-[0-9].*'|sed 's/^-//') +export VERSION := $(SNAPVER) -MAKE = make -MAKEINST = make install +LINUX-FIRMWARE := $(PWD)/linux-firmware +LINUX-FIRMWARE-ROOT := $(LINUX-FIRMWARE)/ROOT +LINUX-HEADERS := $(PWD)/linux-headers-$(KERNVER) +LINUX-HEADERS-ROOT := $(LINUX-HEADERS)/ROOT include /usr/share/snap/Makefile.snaplinux +$(LINUX-HEADERS-ROOT): $(LINUX-FIRMWARE-ROOT) + @install -v -d $(LINUX-HEADERS)/SNAP && \ + install -v -d $(LINUX-HEADERS-ROOT) && \ + cd $(SRCDIR) && make headers_install \ + INSTALL_HDR_PATH=$(LINUX-HEADERS-ROOT)/usr && \ + cd $(LINUX-HEADERS) && make -f \ + ../Makefile.linux-headers-$(KERNVER) && \ + mv *.snap ../ + +$(LINUX-FIRMWARE-ROOT): $(SRCDIR)/arch/x86_64/boot/bzImage + @install -v -d $(LINUX-FIRMWARE)/SNAP && \ + install -v -d $(LINUX-FIRMWARE-ROOT) && \ + cd $(SRCDIR) && make firmware_install \ + INSTALL_FW_PATH=$(LINUX-FIRMWARE-ROOT) && \ + cd $(LINUX-FIRMWARE) && make -f \ + ../Makefile.linux-firmware && mv *.snap ../ + $(SRCDIR)/Makefile: $(ARCHIVE) @if [ '$(TYPE)' == 'application/x-bzip2' ]; then \ tar -jxf $(ARCHIVE); \ @@ -50,7 +71,7 @@ $(SRCDIR)/arch/x86_64/boot/bzImage: $(SRCDIR)/Makefile @cd $(SRCDIR); \ make -$(ROOT): $(SRCDIR)/arch/x86_64/boot/bzImage +$(ROOT): $(LINUX-HEADERS-ROOT) @if [ -d $(ROOT) ]; then \ touch $(ROOT); \ else \ @@ -59,23 +80,17 @@ $(ROOT): $(SRCDIR)/arch/x86_64/boot/bzImage @cd $(SRCDIR); \ make modules_install INSTALL_MOD_PATH=$(ROOT) && \ - make headers_install INSTALL_HDR_PATH=$(ROOT)/usr && \ + 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/doc/linux && \ + install -d -m 755 $(ROOT)/usr/share/doc/linux-$(KERNVER)-$(VERSION) && \ install -m 644 .config $(ROOT)/boot/config-$(KERNVER)-$(VERSION) && \ install -m 644 System.map \ $(ROOT)/boot/System.map-$(KERNVER)-$(VERSION) && \ install -m 644 arch/x86_64/boot/bzImage \ $(ROOT)/boot/vmlinuz-$(KERNVER)-$(VERSION) && \ install -m 644 ../SNAP/usb.conf $(ROOT)/etc/modprobe.d/usb.conf && \ - cd Documentation; for thing in `find`; do \ - if [ -d $$thing ]; then \ - install -d -m 755 $(ROOT)/usr/share/doc/linux/$$thing; \ - else \ - install -m 644 $$thing $(ROOT)/usr/share/doc/linux; \ - fi; \ - done + cp -r Documentation/* $(ROOT)/usr/share/doc/linux-$(KERNVER)-$(VERSION) test: $(ROOT) @cd $(SRCDIR); \ @@ -83,6 +98,8 @@ test: $(ROOT) clean: @rm -rvf $(ROOT) \ + $(LINUX-FIRMWARE) \ + $(LINUX-HEADERS) \ $(SNAPINFO) \ $(MANIFEST) \ $(FILES) \ diff --git a/Makefile.linux-firmware b/Makefile.linux-firmware new file mode 100644 index 0000000..c1ffd5b --- /dev/null +++ b/Makefile.linux-firmware @@ -0,0 +1,17 @@ +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation here: +# (http://www.gnu.org/licenses/gpl-2.0.html) +# +# 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. + +DEPENDS = +BRIEF = Firmware for the Linux kernel +DESC = This provides the firmware necessary for some Linux kernel modules +SNAPVER = 0 +VERSION = $(KERNVER)-$(SNAPVER) + +include /usr/share/snap/Makefile.snaplinux diff --git a/Makefile.linux-headers-3.16.37 b/Makefile.linux-headers-3.16.37 new file mode 100644 index 0000000..6f73971 --- /dev/null +++ b/Makefile.linux-headers-3.16.37 @@ -0,0 +1,15 @@ +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation here: +# (http://www.gnu.org/licenses/gpl-2.0.html) +# +# 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. + +BRIEF = Header files for The Linux kernel +DESC = This provides the header files that are generally used to compile \ +kernel modules + +include /usr/share/snap/Makefile.snaplinux diff --git a/SNAP/config-3.16.37-sr1 b/SNAP/config-3.16.37-3 similarity index 99% rename from SNAP/config-3.16.37-sr1 rename to SNAP/config-3.16.37-3 index ce5aef1..241a42f 100644 --- a/SNAP/config-3.16.37-sr1 +++ b/SNAP/config-3.16.37-3 @@ -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="-sr0" +CONFIG_LOCALVERSION="-3" # 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 2a6b6d9..b74f905 100755 --- a/SNAP/usher +++ b/SNAP/usher @@ -7,7 +7,39 @@ case $1 in exit 0 ;; postinst) - mkinitramfs + KERNEL_VER=`ls -C1rt ${TARGET}/boot/vmlinuz*|sed 's/.*vmlinuz-//'` + + if [[ ${TARGET} ]]; then + echo "Running within ${TARGET} for kernel $KERNEL_VER" + + if ! mountpoint -q ${TARGET}/dev; then + mount -t devtmpfs none ${TARGET}/dev + fi + if ! mountpoint -q ${TARGET}/proc; then + mount -t proc none ${TARGET}/proc + fi + if ! mountpoint -q ${TARGET}/sys; then + mount -t sysfs none ${TARGET}/sys + fi + + chroot ${TARGET} /bin/bash -c "/sbin/mkinitramfs $KERNEL_VER" + chroot ${TARGET} /bin/bash -c \ + "/sbin/grub-mkconfig -o /boot/grub/grub.cfg" + + if mountpoint -q ${TARGET}/dev; then + umount ${TARGET}/dev + fi + if mountpoint -q ${TARGET}/proc; then + umount ${TARGET}/proc + fi + if mountpoint -q ${TARGET}/sys; then + umount ${TARGET}/sys + fi + else + echo "Running for kernel $KERNEL_VER" + mkinitramfs $KERNEL_VER + grub-mkconfig -o /boot/grub/grub.cfg + fi ;; prerm) exit 0