From 2de20ac6fae1083b29567c92140ab984abdfa5c4 Mon Sep 17 00:00:00 2001 From: Jay Larson Date: Mon, 22 May 2017 09:33:23 -0500 Subject: [PATCH] The following changes were made: * removed mounting tmp filesystems from user (now done by snap) * split off separate doc package * Added package name override to prevent duplicated version string in name * removed version string from file name (Makefile.linux-headers) --- Makefile | 45 +++++++++++++------ Makefile.linux-doc | 15 +++++++ Makefile.linux-firmware | 2 +- ...-headers-3.16.37 => Makefile.linux-headers | 1 + SNAP/{config-3.16.37-3 => config} | 0 SNAP/usher | 34 +++----------- 6 files changed, 54 insertions(+), 43 deletions(-) create mode 100644 Makefile.linux-doc rename Makefile.linux-headers-3.16.37 => Makefile.linux-headers (96%) rename SNAP/{config-3.16.37-3 => config} (100%) diff --git a/Makefile b/Makefile index fd7c66e..ead4caf 100644 --- a/Makefile +++ b/Makefile @@ -16,36 +16,55 @@ 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 = 3 +export SNAPVER = 4 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 export KERNVER := $(shell echo $(SRCDIR)|egrep -o '\-[0-9].*'|sed 's/^-//') -export VERSION := $(SNAPVER) +export VERSION := $(KERNVER)-$(SNAPVER) -LINUX-FIRMWARE := $(PWD)/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 + +LINUX-DOC := $(PWD)/linux-doc-$(KERNVER) +LINUX-DOC-ROOT := $(LINUX-DOC)/ROOT +LINUX-FIRMWARE := $(PWD)/linux-firmware-$(KERNVER) 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-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) && \ + cp -r $(SRCDIR)/Documentation/* \ + $(LINUX-DOC-ROOT)/usr/share/doc/linux-$(VERSION) && \ + 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) @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) && \ + ../Makefile.linux-headers && \ mv *.snap ../ $(LINUX-FIRMWARE-ROOT): $(SRCDIR)/arch/x86_64/boot/bzImage @install -v -d $(LINUX-FIRMWARE)/SNAP && \ - install -v -d $(LINUX-FIRMWARE-ROOT) && \ + install -v -d $(LINUX-FIRMWARE-ROOT)/lib/firmware && \ cd $(SRCDIR) && make firmware_install \ - INSTALL_FW_PATH=$(LINUX-FIRMWARE-ROOT) && \ + INSTALL_FW_PATH=$(LINUX-FIRMWARE-ROOT)/lib/firmware && \ cd $(LINUX-FIRMWARE) && make -f \ ../Makefile.linux-firmware && mv *.snap ../ @@ -67,11 +86,11 @@ $(SRCDIR)/Makefile: $(ARCHIVE) $(SRCDIR)/arch/x86_64/boot/bzImage: $(SRCDIR)/Makefile @cd $(SRCDIR); \ make mrproper - @cp SNAP/config-$(KERNVER)-$(VERSION) $(SRCDIR)/.config + @cp SNAP/config $(SRCDIR)/.config @cd $(SRCDIR); \ make -$(ROOT): $(LINUX-HEADERS-ROOT) +$(ROOT): $(LINUX-DOC-ROOT) @if [ -d $(ROOT) ]; then \ touch $(ROOT); \ else \ @@ -83,14 +102,12 @@ $(ROOT): $(LINUX-HEADERS-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/doc/linux-$(KERNVER)-$(VERSION) && \ - install -m 644 .config $(ROOT)/boot/config-$(KERNVER)-$(VERSION) && \ + install -m 644 .config $(ROOT)/boot/config-$(VERSION) && \ install -m 644 System.map \ - $(ROOT)/boot/System.map-$(KERNVER)-$(VERSION) && \ + $(ROOT)/boot/System.map-$(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 && \ - cp -r Documentation/* $(ROOT)/usr/share/doc/linux-$(KERNVER)-$(VERSION) + $(ROOT)/boot/vmlinuz-$(VERSION) && \ + install -m 644 ../SNAP/usb.conf $(ROOT)/etc/modprobe.d/usb.conf test: $(ROOT) @cd $(SRCDIR); \ diff --git a/Makefile.linux-doc b/Makefile.linux-doc new file mode 100644 index 0000000..9b83f62 --- /dev/null +++ b/Makefile.linux-doc @@ -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 = Documentation for The Linux kernel +DESC = Detailed documentation describing the Linux kernel +SNAP = $(PACKAGE)-$(SNAPVER).snap + +include /usr/share/snap/Makefile.snaplinux diff --git a/Makefile.linux-firmware b/Makefile.linux-firmware index c1ffd5b..6c6176f 100644 --- a/Makefile.linux-firmware +++ b/Makefile.linux-firmware @@ -11,7 +11,7 @@ DEPENDS = BRIEF = Firmware for the Linux kernel DESC = This provides the firmware necessary for some Linux kernel modules -SNAPVER = 0 VERSION = $(KERNVER)-$(SNAPVER) +SNAP = $(PACKAGE)-$(SNAPVER).snap include /usr/share/snap/Makefile.snaplinux diff --git a/Makefile.linux-headers-3.16.37 b/Makefile.linux-headers similarity index 96% rename from Makefile.linux-headers-3.16.37 rename to Makefile.linux-headers index 6f73971..40a6300 100644 --- a/Makefile.linux-headers-3.16.37 +++ b/Makefile.linux-headers @@ -11,5 +11,6 @@ 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 include /usr/share/snap/Makefile.snaplinux diff --git a/SNAP/config-3.16.37-3 b/SNAP/config similarity index 100% rename from SNAP/config-3.16.37-3 rename to SNAP/config diff --git a/SNAP/usher b/SNAP/usher index b74f905..a1a2eed 100755 --- a/SNAP/usher +++ b/SNAP/usher @@ -7,37 +7,15 @@ case $1 in exit 0 ;; postinst) - KERNEL_VER=`ls -C1rt ${TARGET}/boot/vmlinuz*|sed 's/.*vmlinuz-//'` - if [[ ${TARGET} ]]; then - echo "Running within ${TARGET} for kernel $KERNEL_VER" + echo "Running within ${TARGET} for kernel ${VERSION}" - 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 + chroot ${TARGET} mkinitramfs ${VERSION} + chroot ${TARGET} grub-mkconfig -o /boot/grub/grub.cfg else - echo "Running for kernel $KERNEL_VER" - mkinitramfs $KERNEL_VER + echo "Running for kernel ${VERSION}" + + mkinitramfs ${VERSION} grub-mkconfig -o /boot/grub/grub.cfg fi ;;