mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
linux: Tidy up the messy KVER variable
This variable never actually held the kernel version. There were always suffixes appended and other things changed about it. This makes it a lot simpler as this variable now holds the actual kernel version. Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,2 +1,2 @@
|
||||
boot/uInit-KVER-ipfire
|
||||
boot/initramfs-KVER-ipfire.img
|
||||
boot/uInit-KVER
|
||||
boot/initramfs-KVER.img
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1 +1 @@
|
||||
boot/initramfs-KVER-ipfire.img
|
||||
boot/initramfs-KVER.img
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1 +1 @@
|
||||
boot/initramfs-KVER-ipfire.img
|
||||
boot/initramfs-KVER.img
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
# Cleanup environment from any variables
|
||||
unexport BUILD_ARCH BUILD_PLATFORM BUILDTARGET CROSSTARGET TOOLCHAIN
|
||||
unexport NAME SNAME VERSION CORE SLOGAN SYSTEM_RELEASE PAKFIRE_TREE CONFIG_ROOT
|
||||
unexport KVER
|
||||
unexport KVER KVER_SUFFIX
|
||||
unexport SYSTEM_PROCESSOR SYSTEM_MEMORY
|
||||
unexport DEFAULT_PARALLELISM
|
||||
unexport LFS_BASEDIR
|
||||
@@ -254,12 +254,6 @@ define PREBUILD
|
||||
echo "====================================== Installing $(THISAPP) ..."
|
||||
@echo "Install started; saving file list to $(DIR_SRC)/lsalr ..."
|
||||
@if [ ! -f $(DIR_SRC)/lsalr ]; then $(FIND_FILES) > $(DIR_SRC)/lsalr; fi
|
||||
# Fix installation on partial rebuild, so modules install where they should
|
||||
# and not everytime on the last compiled kernel
|
||||
if [ -f $(DIR_SRC)/linux-$(KVER) ]; then \
|
||||
cd $(DIR_SRC)/linux-$(KVER) && \
|
||||
sed -i -e 's+^EXTRAVERSION.*$$+EXTRAVERSION\ =\ $(word 4,$(subst ., .,$(KVER)))-ipfire$(KCFG)+' Makefile; \
|
||||
fi
|
||||
endef
|
||||
else
|
||||
define PREBUILD
|
||||
|
||||
@@ -166,8 +166,8 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
|
||||
|
||||
mkdir -p $(DIR_TMP)/cdrom/boot/isolinux
|
||||
|
||||
cp /boot/vmlinuz-$(KVER)-ipfire $(DIR_TMP)/cdrom/boot/isolinux/vmlinuz
|
||||
dracut --force -a "installer" --strip $(DIR_TMP)/cdrom/boot/isolinux/instroot $(KVER)-ipfire
|
||||
cp /boot/vmlinuz-$(KVER) $(DIR_TMP)/cdrom/boot/isolinux/vmlinuz
|
||||
dracut --force -a "installer" --strip $(DIR_TMP)/cdrom/boot/isolinux/instroot $(KVER)
|
||||
|
||||
ifeq "$(HAS_ISOLINUX)" "1"
|
||||
dd if=/dev/zero bs=1k count=2 > $(DIR_TMP)/cdrom/boot/isolinux/boot.catalog
|
||||
|
||||
@@ -175,7 +175,7 @@ ifeq "$(BOOTLOADER)" "grub"
|
||||
|
||||
# Create configuration
|
||||
mkdir -pv $(MNThdd)/boot/grub
|
||||
GRUB_FIRST_BOOT=true KERNEL_RELEASE="$(KVER)-ipfire" chroot $(MNThdd) \
|
||||
GRUB_FIRST_BOOT=true KERNEL_RELEASE="$(KVER)" chroot $(MNThdd) \
|
||||
grub-mkconfig -o /boot/grub/grub.cfg
|
||||
|
||||
# Boot the first kernel by default
|
||||
|
||||
96
lfs/linux
96
lfs/linux
@@ -48,19 +48,17 @@ ifeq "$(BUILD_ARCH)" "riscv64"
|
||||
KERNEL_TARGET = Image.gz
|
||||
endif
|
||||
|
||||
VERSUFIX=ipfire$(KCFG)
|
||||
|
||||
ifeq "$(TOOLCHAIN)" "1"
|
||||
TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)-tools
|
||||
TARGET = $(DIR_INFO)/$(THISAPP)-tools
|
||||
HEADERS_PREFIX = $(TOOLS_DIR)
|
||||
EXTRAMAKE = CROSS_COMPILE=$(CROSSTARGET)-
|
||||
else
|
||||
TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)
|
||||
HEADERS_PREFIX = /usr
|
||||
ifeq "$(HEADERS)" "1"
|
||||
TARGET = $(DIR_INFO)/$(THISAPP)-headers
|
||||
else
|
||||
TARGET = $(DIR_INFO)/$(THISAPP)
|
||||
endif
|
||||
|
||||
ifeq "$(KCFG)" ""
|
||||
LASTKERNEL=1
|
||||
endif
|
||||
|
||||
###############################################################################
|
||||
@@ -104,9 +102,7 @@ $(subst %,%_BLAKE2,$(objects)) :
|
||||
|
||||
$(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
|
||||
@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
|
||||
|
||||
# Layer7-patch
|
||||
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-6.6.26-layer7.patch
|
||||
@@ -142,7 +138,10 @@ ifeq "$(BUILD_ARCH)" "aarch64"
|
||||
endif
|
||||
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-3.14.79-amba-fix.patch
|
||||
|
||||
ifeq "$(KCFG)" "-headers"
|
||||
# Customise the release
|
||||
cd $(DIR_APP) && echo "$(KVER_SUFFIX)" > localversion.10-$(SNAME)
|
||||
|
||||
ifeq "$(HEADERS)" "1"
|
||||
# Install the header files
|
||||
cd $(DIR_APP) && make ARCH=$(HEADERS_ARCH) $(EXTRAMAKE) headers
|
||||
-mkdir -pv $(BUILDROOT)/$(HEADERS_PREFIX)/include
|
||||
@@ -156,79 +155,77 @@ else
|
||||
drivers/video/logo/logo_linux_clut224.ppm
|
||||
|
||||
# Cleanup kernel source
|
||||
cp $(DIR_SRC)/config/kernel/kernel.config.$(BUILD_ARCH)-$(VERSUFIX) $(DIR_APP)/.config
|
||||
cp $(DIR_SRC)/config/kernel/kernel.config.$(BUILD_ARCH)$(KVER_SUFFIX) $(DIR_APP)/.config
|
||||
cd $(DIR_APP) && make oldconfig
|
||||
cd $(DIR_APP) && make clean
|
||||
cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ -$(VERSUFIX)/' Makefile
|
||||
|
||||
# Copy Module signing key configuration
|
||||
cp -f $(DIR_SRC)/config/kernel/x509.genkey $(DIR_APP)/certs/x509.genkey
|
||||
|
||||
# Remove modules folder if exists
|
||||
rm -rf /lib/modules/$(VER)-$(VERSUFIX)
|
||||
rm -rf /lib/modules/$(KVER)
|
||||
|
||||
# Build the kernel
|
||||
cd $(DIR_APP) && make $(MAKETUNING) $(KERNEL_TARGET) modules
|
||||
|
||||
# Install the kernel
|
||||
cd $(DIR_APP) && cp -v arch/$(KERNEL_ARCH)/boot/$(KERNEL_TARGET) /boot/vmlinuz-$(VER)-$(VERSUFIX)
|
||||
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) && cp -v arch/$(KERNEL_ARCH)/boot/$(KERNEL_TARGET) /boot/vmlinuz-$(KVER)
|
||||
cd $(DIR_APP) && cp -v System.map /boot/System.map-$(KVER)
|
||||
cd $(DIR_APP) && cp -v .config /boot/config-$(KVER)
|
||||
cd $(DIR_APP) && make $(MAKETUNING) modules_install
|
||||
|
||||
ifneq "$(BUILD_PLATFORM)" "x86"
|
||||
cd $(DIR_APP) && make $(MAKETUNING) dtbs
|
||||
mkdir -p /boot/dtb-$(VER)-$(VERSUFIX)
|
||||
mkdir -p /boot/dtb-$(KVER)
|
||||
cd $(DIR_APP)/arch/$(KERNEL_ARCH)/boot/dts && for f in $$(find -name "*.dtb"); do \
|
||||
cp -v --parents $$f /boot/dtb-$(VER)-$(VERSUFIX)/ ; \
|
||||
chmod 644 /boot/dtb-$(VER)-$(VERSUFIX)/$$f ; \
|
||||
cp -v --parents $$f /boot/dtb-$(KVER)/ ; \
|
||||
chmod 644 /boot/dtb-$(KVER)/$$f ; \
|
||||
done
|
||||
endif
|
||||
|
||||
# Recreate source and build links
|
||||
rm -rf /lib/modules/$(VER)-$(VERSUFIX)/{build,source}
|
||||
mkdir -p /lib/modules/$(VER)-$(VERSUFIX)/build
|
||||
ln -sf build /lib/modules/$(VER)-$(VERSUFIX)/source
|
||||
rm -rf /lib/modules/$(KVER)/{build,source}
|
||||
mkdir -p /lib/modules/$(KVER)/build
|
||||
ln -sf build /lib/modules/$(KVER)/source
|
||||
|
||||
# Create dirs for extra modules
|
||||
mkdir -p /lib/modules/$(VER)-$(VERSUFIX)/extra
|
||||
mkdir -p /lib/modules/$(KVER)/extra
|
||||
|
||||
cd $(DIR_APP) && cp --parents $$(find -type f -name "Makefile*" -o -name "Kconfig*") \
|
||||
/lib/modules/$(VER)-$(VERSUFIX)/build
|
||||
cd $(DIR_APP) && cp Module.symvers System.map /lib/modules/$(VER)-$(VERSUFIX)/build
|
||||
rm -rf /lib/modules/$(VER)-$(VERSUFIX)/build/{Documentation,scripts,include}
|
||||
/lib/modules/$(KVER)/build
|
||||
cd $(DIR_APP) && cp Module.symvers System.map /lib/modules/$(KVER)/build
|
||||
rm -rf /lib/modules/$(KVER)/build/{Documentation,scripts,include}
|
||||
|
||||
cd $(DIR_APP) && cp .config /lib/modules/$(VER)-$(VERSUFIX)/build
|
||||
cd $(DIR_APP) && cp -a scripts /lib/modules/$(VER)-$(VERSUFIX)/build
|
||||
find /lib/modules/$(VER)-$(VERSUFIX)/build/scripts -name "*.o" -exec rm -vf {} \;
|
||||
cd $(DIR_APP) && cp .config /lib/modules/$(KVER)/build
|
||||
cd $(DIR_APP) && cp -a scripts /lib/modules/$(KVER)/build
|
||||
find /lib/modules/$(KVER)/build/scripts -name "*.o" -exec rm -vf {} \;
|
||||
|
||||
cd $(DIR_APP) && cp -a --parents arch/$(HEADERS_ARCH)/include /lib/modules/$(VER)-$(VERSUFIX)/build
|
||||
cd $(DIR_APP) && cp -a include /lib/modules/$(VER)-$(VERSUFIX)/build/include
|
||||
cd $(DIR_APP) && cp -a --parents arch/$(HEADERS_ARCH)/include /lib/modules/$(KVER)/build
|
||||
cd $(DIR_APP) && cp -a include /lib/modules/$(KVER)/build/include
|
||||
|
||||
# Copy module signing key for off tree modules
|
||||
cd $(DIR_APP) && cp -f certs/signing_key.* /lib/modules/$(VER)-$(VERSUFIX)/build/certs/
|
||||
cd $(DIR_APP) && cp -f certs/signing_key.* /lib/modules/$(KVER)/build/certs/
|
||||
|
||||
# Install objtool
|
||||
cd $(DIR_APP) && cp -a tools/objtool/objtool \
|
||||
/lib/modules/$(VER)-$(VERSUFIX)/build/tools/objtool/ || :
|
||||
/lib/modules/$(KVER)/build/tools/objtool/ || :
|
||||
cd $(DIR_APP) && cp -a --parents tools/build/{Build,Build.include,fixdep.c} \
|
||||
tools/scripts/utilities.mak /lib/modules/$(VER)-$(VERSUFIX)/build
|
||||
tools/scripts/utilities.mak /lib/modules/$(KVER)/build
|
||||
|
||||
# Make sure we can build external modules
|
||||
touch -r /lib/modules/$(VER)-$(VERSUFIX)/build/Makefile \
|
||||
/lib/modules/$(VER)-$(VERSUFIX)/build/include/generated/uapi/linux/version.h
|
||||
touch -r /lib/modules/$(VER)-$(VERSUFIX)/build/.config \
|
||||
/lib/modules/$(VER)-$(VERSUFIX)/build/autoconf.h
|
||||
cp /lib/modules/$(VER)-$(VERSUFIX)/build/.config \
|
||||
/lib/modules/$(VER)-$(VERSUFIX)/build/include/config/auto.conf
|
||||
touch -r /lib/modules/$(KVER)/build/Makefile \
|
||||
/lib/modules/$(KVER)/build/include/generated/uapi/linux/version.h
|
||||
touch -r /lib/modules/$(KVER)/build/.config \
|
||||
/lib/modules/$(KVER)/build/autoconf.h
|
||||
cp /lib/modules/$(KVER)/build/.config \
|
||||
/lib/modules/$(KVER)/build/include/config/auto.conf
|
||||
|
||||
# Fix permissions
|
||||
find /lib/modules/$(VER)-$(VERSUFIX) -name "modules.order" \
|
||||
find /lib/modules/$(KVER) -name "modules.order" \
|
||||
-exec chmod 644 {} \;
|
||||
|
||||
find /lib/modules/$(VER)-$(VERSUFIX) -name ".*.cmd" -exec rm -f {} \;
|
||||
find /lib/modules/$(KVER) -name ".*.cmd" -exec rm -f {} \;
|
||||
|
||||
ifeq "$(LASTKERNEL)" "1"
|
||||
# Only do this once
|
||||
cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
|
||||
|
||||
@@ -236,11 +233,11 @@ ifeq "$(LASTKERNEL)" "1"
|
||||
echo install drm /bin/false > /etc/modprobe.d/framebuffer.conf
|
||||
|
||||
# Blacklist old framebuffer modules
|
||||
for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/video/fbdev/ -name *.ko.xz); do \
|
||||
for f in $$(find /lib/modules/$(KVER)/kernel/drivers/video/fbdev/ -name *.ko.xz); do \
|
||||
echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
|
||||
done
|
||||
# Blacklist new drm framebuffer modules
|
||||
for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/gpu/drm -name *.ko.xz); do \
|
||||
for f in $$(find /lib/modules/$(KVER)/kernel/drivers/gpu/drm -name *.ko.xz); do \
|
||||
echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
|
||||
done
|
||||
sed -i -e "s|.ko.xz||g" /etc/modprobe.d/framebuffer.conf
|
||||
@@ -252,12 +249,7 @@ ifeq "$(LASTKERNEL)" "1"
|
||||
cd $(DIR_APP)/tools/power/cpupower && make $(MAKETUNING)
|
||||
cd $(DIR_APP)/tools/power/cpupower && make install
|
||||
|
||||
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_APP) $(DIR_SRC)/linux
|
||||
@rm -rf $(DIR_APP)
|
||||
@$(POSTBUILD)
|
||||
|
||||
@@ -55,13 +55,13 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
|
||||
@$(PREBUILD)
|
||||
|
||||
# rebuild module deps
|
||||
depmod -a $(KVER)-$(VERSUFIX)
|
||||
depmod -a $(KVER)
|
||||
|
||||
# Create initramfs images
|
||||
dracut --force --verbose --strip /boot/initramfs-$(KVER)-$(VERSUFIX).img $(KVER)-$(VERSUFIX)
|
||||
dracut --force --verbose --strip /boot/initramfs-$(KVER).img $(KVER)
|
||||
|
||||
ifeq "$(BUILD_ARCH)" "aarch64"
|
||||
cd /boot && mkimage -A arm64 -T ramdisk -C lzma -d initramfs-$(KVER)-$(VERSUFIX).img uInit-$(KVER)-$(VERSUFIX)
|
||||
cd /boot && mkimage -A arm64 -T ramdisk -C lzma -d initramfs-$(KVER).img uInit-$(KVER)
|
||||
# dont remove initramfs because grub need this to boot.
|
||||
endif
|
||||
|
||||
|
||||
14
make.sh
14
make.sh
@@ -26,7 +26,6 @@ VERSION="2.29" # Version number
|
||||
CORE="188" # Core Level (Filename)
|
||||
SLOGAN="www.ipfire.org" # Software slogan
|
||||
CONFIG_ROOT=/var/ipfire # Configuration rootdir
|
||||
KVER=`grep --max-count=1 VER lfs/linux | awk '{ print $3 }'`
|
||||
|
||||
# Information from Git
|
||||
GIT_BRANCH="$(git rev-parse --abbrev-ref HEAD)" # Git Branch
|
||||
@@ -35,6 +34,12 @@ GIT_LASTCOMMIT="$(git rev-parse --verify HEAD)" # Last commit
|
||||
|
||||
TOOLCHAINVER=20240521
|
||||
|
||||
KVER_SUFFIX="-${SNAME}"
|
||||
|
||||
# Kernel Version
|
||||
KVER="$(grep --max-count=1 VER lfs/linux | awk '{ print $3 }')"
|
||||
KVER="${KVER/-rc/.0-rc}${KVER_SUFFIX}"
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Beautifying variables & presentation & input output interface
|
||||
@@ -672,6 +677,7 @@ execute() {
|
||||
|
||||
# Kernel Version
|
||||
[KVER]="${KVER}"
|
||||
[KVER_SUFFIX]="${KVER_SUFFIX}"
|
||||
|
||||
# Compiler flags
|
||||
[CFLAGS]="${CFLAGS[@]}"
|
||||
@@ -779,7 +785,7 @@ execute() {
|
||||
|
||||
# Fake kernel version, because some of the packages do not
|
||||
# compile with kernel 3.0 and later
|
||||
[UTS_RELEASE]="${KVER}-${SNAME}"
|
||||
[UTS_RELEASE]="${KVER}"
|
||||
|
||||
# Fake machine
|
||||
[UTS_MACHINE]="${BUILD_ARCH}"
|
||||
@@ -1432,7 +1438,7 @@ build_toolchain() {
|
||||
lfsmake1 stage1
|
||||
lfsmake1 binutils PASS=1
|
||||
lfsmake1 gcc PASS=1
|
||||
lfsmake1 linux KCFG="-headers"
|
||||
lfsmake1 linux HEADERS=1
|
||||
lfsmake1 glibc
|
||||
lfsmake1 libxcrypt
|
||||
lfsmake1 gcc PASS=L
|
||||
@@ -1476,7 +1482,7 @@ build_system() {
|
||||
local LOGFILE="${LOG_DIR}/_build.${SNAME}.log"
|
||||
|
||||
lfsmake2 stage2
|
||||
lfsmake2 linux KCFG="-headers"
|
||||
lfsmake2 linux HEADERS=1
|
||||
lfsmake2 man-pages
|
||||
lfsmake2 glibc
|
||||
lfsmake2 tzdata
|
||||
|
||||
Reference in New Issue
Block a user