revert source removal branches and fix source dir

This commit is contained in:
Adrian Vladu 2023-12-17 20:12:38 +00:00
parent c65866770e
commit 44e26d47be
6 changed files with 10 additions and 188 deletions

View File

@ -14,7 +14,8 @@ case "${NUM_JOBS}" in
*[!0-9]*) NUM_JOBS='' ;;
esac
if [[ -z ${NUM_JOBS} ]] || [[ ${NUM_JOBS} -eq 0 ]]; then
NUM_JOBS=$(grep -c "^processor" /proc/cpuinfo)
NUM_JOBS=40
#$(grep -c "^processor" /proc/cpuinfo)
fi
# Ensure that any sub scripts we invoke get the max proc count.
export NUM_JOBS

View File

@ -195,7 +195,7 @@ install_build_source() {
| grep -v dt-bindings ))
# remove the broken symlinks referencing $ROOT
rm "${D}/usr/lib/modules/${KV_FULL}"/{source,build} || die
rm "${D}/usr/lib/modules/${KV_FULL}/build" || die
# Compose list of architectures to be excluded from the kernel modules
# tree in the final image. It is an array to be used as a pattern for
@ -230,6 +230,11 @@ install_build_source() {
# /usr/lib/modules/${KV_FULL}/source/scripts/dtc/include-prefixes.
# The grep must run with "-w" to exclude exact patterns like either arm
# or arm64.
ls -liath .
echo "<<<<"
ls -liath source
echo "<<<<"
ls -liath build
{
echo source/Makefile
find source/arch/${kernel_arch} -follow -maxdepth 1 -name 'Makefile*' -print

View File

@ -49,7 +49,7 @@ src_install() {
INSTALL_FW_PATH="${T}/fw" \
modules_install
rm "${D}/usr/lib/debug/usr/lib/modules/${KV_FULL}/"modules.* || die
rm "${D}/usr/lib/debug/usr/lib/modules/${KV_FULL}"/{build,source} || die
rm "${D}/usr/lib/debug/usr/lib/modules/${KV_FULL}/build" || die
# Clean up the build tree
shred_keys

View File

@ -37,5 +37,4 @@ IUSE=""
UNIPATCH_LIST="
${PATCH_DIR}/z0001-kbuild-derive-relative-path-for-srctree-from-CURDIR.patch \
${PATCH_DIR}/z0002-revert-pahole-flags.patch \
${PATCH_DIR}/z0003-revert-source-removal.patch \
"

View File

@ -1,183 +0,0 @@
diff --git a/Makefile b/Makefile
index 5c418efbe89b..03ca30e2bf9c 100644
--- a/Makefile
+++ b/Makefile
@@ -1462,8 +1462,44 @@ modules: modules_prepare
modules_prepare: prepare
$(Q)$(MAKE) $(build)=scripts scripts/module.lds
+export modules_sign_only :=
+
+ifeq ($(CONFIG_MODULE_SIG),y)
+PHONY += modules_sign
+modules_sign: modules_install
+ @:
+
+# modules_sign is a subset of modules_install.
+# 'make modules_install modules_sign' is equivalent to 'make modules_install'.
+ifeq ($(filter modules_install,$(MAKECMDGOALS)),)
+modules_sign_only := y
+endif
+endif
+
endif # CONFIG_MODULES
+modinst_pre :=
+ifneq ($(filter modules_install,$(MAKECMDGOALS)),)
+modinst_pre := __modinst_pre
+endif
+
+modules_install: $(modinst_pre)
+PHONY += __modinst_pre
+__modinst_pre:
+ @rm -rf $(MODLIB)/kernel
+ @rm -f $(MODLIB)/source
+ @mkdir -p $(MODLIB)
+ifdef CONFIG_MODULES
+ @ln -s $(abspath $(srctree)) $(MODLIB)/source
+ @if [ ! $(objtree) -ef $(MODLIB)/build ]; then \
+ rm -f $(MODLIB)/build ; \
+ ln -s $(CURDIR) $(MODLIB)/build ; \
+ fi
+ @sed 's:^\(.*\)\.o$$:kernel/\1.ko:' modules.order > $(MODLIB)/modules.order
+endif
+ @cp -f modules.builtin $(MODLIB)/
+ @cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/
+
###
# Cleaning is done on three levels.
# make clean Delete most generated files
@@ -1800,39 +1836,19 @@ help:
@echo ' rust-analyzer - generate rust-project.json rust-analyzer support file'
@echo ''
-ifndef CONFIG_MODULES
-modules modules_install: __external_modules_error
__external_modules_error:
@echo >&2 '***'
@echo >&2 '*** The present kernel disabled CONFIG_MODULES.'
@echo >&2 '*** You cannot build or install external modules.'
@echo >&2 '***'
@false
-endif
endif # KBUILD_EXTMOD
# ---------------------------------------------------------------------------
# Modules
-PHONY += modules modules_install modules_sign modules_prepare
-
-modules_install:
- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst \
- sign-only=$(if $(filter modules_install,$(MAKECMDGOALS)),,y)
-
-ifeq ($(CONFIG_MODULE_SIG),y)
-# modules_sign is a subset of modules_install.
-# 'make modules_install modules_sign' is equivalent to 'make modules_install'.
-modules_sign: modules_install
- @:
-else
-modules_sign:
- @echo >&2 '***'
- @echo >&2 '*** CONFIG_MODULE_SIG is disabled. You cannot sign modules.'
- @echo >&2 '***'
- @false
-endif
+PHONY += modules modules_install modules_prepare
ifdef CONFIG_MODULES
@@ -1850,9 +1866,17 @@ PHONY += modules_check
modules_check: $(MODORDER)
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<
+modules_install:
+ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
+
else # CONFIG_MODULES
-modules:
+# Modules not configured
+# ---------------------------------------------------------------------------
+
+PHONY += __external_modules_error
+
+modules modules_install: __external_modules_error
@:
KBUILD_MODULES :=
diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
index 0afd75472679..680c458b76c9 100644
--- a/scripts/Makefile.modinst
+++ b/scripts/Makefile.modinst
@@ -11,33 +11,6 @@ include $(srctree)/scripts/Kbuild.include
install-y :=
-ifeq ($(KBUILD_EXTMOD)$(sign-only),)
-
-# remove the old directory and symlink
-$(shell rm -fr $(MODLIB)/kernel $(MODLIB)/build)
-
-install-$(CONFIG_MODULES) += $(addprefix $(MODLIB)/, build modules.order)
-
-$(MODLIB)/build: FORCE
- $(call cmd,symlink)
-
-quiet_cmd_symlink = SYMLINK $@
- cmd_symlink = ln -s $(CURDIR) $@
-
-$(MODLIB)/modules.order: modules.order FORCE
- $(call cmd,install_modorder)
-
-quiet_cmd_install_modorder = INSTALL $@
- cmd_install_modorder = sed 's:^\(.*\)\.o$$:kernel/\1.ko:' $< > $@
-
-# Install modules.builtin(.modinfo) even when CONFIG_MODULES is disabled.
-install-y += $(addprefix $(MODLIB)/, modules.builtin modules.builtin.modinfo)
-
-$(addprefix $(MODLIB)/, modules.builtin modules.builtin.modinfo): $(MODLIB)/%: % FORCE
- $(call cmd,install)
-
-endif
-
modules := $(call read-file, $(MODORDER))
ifeq ($(KBUILD_EXTMOD),)
@@ -58,7 +31,7 @@ suffix-$(CONFIG_MODULE_COMPRESS_ZSTD) := .zst
modules := $(patsubst $(extmod_prefix)%.o, $(dst)/%.ko$(suffix-y), $(modules))
install-$(CONFIG_MODULES) += $(modules)
-__modinst: $(install-y)
+__modinst: $(modules)
@:
#
@@ -104,7 +77,7 @@ quiet_cmd_sign = SIGN $@
cmd_sign = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) "$(sig-key)" certs/signing_key.x509 $@ \
$(if $(KBUILD_EXTMOD),|| true)
-ifeq ($(sign-only),)
+ifeq ($(modules_sign_only),)
# During modules_install, modules are signed only when CONFIG_MODULE_SIG_ALL=y.
ifndef CONFIG_MODULE_SIG_ALL
@@ -120,16 +93,14 @@ $(dst)/%.ko: $(extmod_prefix)%.ko FORCE
$(call cmd,strip)
$(call cmd,sign)
-ifdef CONFIG_MODULES
__modinst: depmod
PHONY += depmod
-depmod: $(install-y)
+depmod: $(modules)
$(call cmd,depmod)
quiet_cmd_depmod = DEPMOD $(MODLIB)
cmd_depmod = $(srctree)/scripts/depmod.sh $(KERNELRELEASE)
-endif
else

View File

@ -17,7 +17,7 @@ SRC_URI="
"
S="${WORKDIR}/linux-${PV}"
KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux"
BDEPEND="
app-arch/xz-utils