Skip to content

Commit a33ab3f

Browse files
committed
Merge tag 'kbuild-fixes-v6.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild fixes from Masahiro Yamada: - Fix a memory leak in modpost - Resolve build issues when cross-compiling RPM and Debian packages - Fix another regression in Kconfig - Fix incorrect MODULE_ALIAS() output in modpost * tag 'kbuild-fixes-v6.12-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: modpost: fix input MODULE_DEVICE_TABLE() built for 64-bit on 32-bit host modpost: fix acpi MODULE_DEVICE_TABLE built with mismatched endianness kconfig: show sub-menu entries even if the prompt is hidden kbuild: deb-pkg: add pkg.linux-upstream.nokerneldbg build profile kbuild: deb-pkg: add pkg.linux-upstream.nokernelheaders build profile kbuild: rpm-pkg: disable kernel-devel package when cross-compiling sumversion: Fix a memory leak in get_src_version()
2 parents b9021de + 77dc55a commit a33ab3f

File tree

7 files changed

+39
-16
lines changed

7 files changed

+39
-16
lines changed

scripts/Makefile.package

+6-1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ rpm-sources: linux.tar.gz
6262

6363
PHONY += rpm-pkg srcrpm-pkg binrpm-pkg
6464

65+
ifneq ($(CC),$(HOSTCC))
66+
rpm-no-devel = --without=devel
67+
endif
68+
6569
rpm-pkg: private build-type := a
6670
srcrpm-pkg: private build-type := s
6771
binrpm-pkg: private build-type := b
@@ -72,7 +76,8 @@ rpm-pkg srcrpm-pkg binrpm-pkg: rpmbuild/SPECS/kernel.spec
7276
--define='_topdir $(abspath rpmbuild)' \
7377
$(if $(filter a b, $(build-type)), \
7478
--target $(UTS_MACHINE)-linux --build-in-place --noprep --define='_smp_mflags %{nil}' \
75-
$$(rpm -q rpm >/dev/null 2>&1 || echo --nodeps)) \
79+
$$(rpm -q rpm >/dev/null 2>&1 || echo --nodeps) \
80+
$(rpm-no-devel)) \
7681
$(RPMOPTS))
7782

7883
# deb-pkg srcdeb-pkg bindeb-pkg

scripts/kconfig/menu.c

+12-1
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ bool menu_is_empty(struct menu *menu)
533533

534534
bool menu_is_visible(struct menu *menu)
535535
{
536+
struct menu *child;
536537
struct symbol *sym;
537538
tristate visible;
538539

@@ -551,7 +552,17 @@ bool menu_is_visible(struct menu *menu)
551552
} else
552553
visible = menu->prompt->visible.tri = expr_calc_value(menu->prompt->visible.expr);
553554

554-
return visible != no;
555+
if (visible != no)
556+
return true;
557+
558+
if (!sym || sym_get_tristate_value(menu->sym) == no)
559+
return false;
560+
561+
for (child = menu->list; child; child = child->next)
562+
if (menu_is_visible(child))
563+
return true;
564+
565+
return false;
555566
}
556567

557568
const char *menu_get_prompt(const struct menu *menu)

scripts/mod/file2alias.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -567,23 +567,23 @@ static int do_acpi_entry(const char *filename,
567567
void *symval, char *alias)
568568
{
569569
DEF_FIELD_ADDR(symval, acpi_device_id, id);
570-
DEF_FIELD_ADDR(symval, acpi_device_id, cls);
571-
DEF_FIELD_ADDR(symval, acpi_device_id, cls_msk);
570+
DEF_FIELD(symval, acpi_device_id, cls);
571+
DEF_FIELD(symval, acpi_device_id, cls_msk);
572572

573573
if (id && strlen((const char *)*id))
574574
sprintf(alias, "acpi*:%s:*", *id);
575-
else if (cls) {
575+
else {
576576
int i, byte_shift, cnt = 0;
577577
unsigned int msk;
578578

579579
sprintf(&alias[cnt], "acpi*:");
580580
cnt = 6;
581581
for (i = 1; i <= 3; i++) {
582582
byte_shift = 8 * (3-i);
583-
msk = (*cls_msk >> byte_shift) & 0xFF;
583+
msk = (cls_msk >> byte_shift) & 0xFF;
584584
if (msk)
585585
sprintf(&alias[cnt], "%02x",
586-
(*cls >> byte_shift) & 0xFF);
586+
(cls >> byte_shift) & 0xFF);
587587
else
588588
sprintf(&alias[cnt], "??");
589589
cnt += 2;
@@ -743,7 +743,7 @@ static void do_input(char *alias,
743743
for (i = min / BITS_PER_LONG; i < max / BITS_PER_LONG + 1; i++)
744744
arr[i] = TO_NATIVE(arr[i]);
745745
for (i = min; i < max; i++)
746-
if (arr[i / BITS_PER_LONG] & (1L << (i%BITS_PER_LONG)))
746+
if (arr[i / BITS_PER_LONG] & (1ULL << (i%BITS_PER_LONG)))
747747
sprintf(alias + strlen(alias), "%X,*", i);
748748
}
749749

scripts/mod/sumversion.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md)
392392
/* Calc and record src checksum. */
393393
void get_src_version(const char *modname, char sum[], unsigned sumlen)
394394
{
395-
char *buf;
395+
char *buf, *pos;
396396
struct md4_ctx md;
397397
char *fname;
398398
char filelist[PATH_MAX + 1];
@@ -401,9 +401,10 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen)
401401
snprintf(filelist, sizeof(filelist), "%s.mod", modname);
402402

403403
buf = read_text_file(filelist);
404+
pos = buf;
404405

405406
md4_init(&md);
406-
while ((fname = strsep(&buf, "\n"))) {
407+
while ((fname = strsep(&pos, "\n"))) {
407408
if (!*fname)
408409
continue;
409410
if (!(is_static_library(fname)) &&

scripts/package/builddeb

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ install_kernel_headers () {
123123
pdir=debian/$1
124124
version=${1#linux-headers-}
125125

126-
"${srctree}/scripts/package/install-extmod-build" "${pdir}/usr/src/linux-headers-${version}"
126+
CC="${DEB_HOST_GNU_TYPE}-gcc" "${srctree}/scripts/package/install-extmod-build" "${pdir}/usr/src/linux-headers-${version}"
127127

128128
mkdir -p $pdir/lib/modules/$version/
129129
ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build

scripts/package/install-extmod-build

+2-4
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,11 @@ mkdir -p "${destdir}"
4444
fi
4545
} | tar -c -f - -T - | tar -xf - -C "${destdir}"
4646

47-
# When ${CC} and ${HOSTCC} differ, we are likely cross-compiling. Rebuild host
48-
# programs using ${CC}. This assumes CC=${CROSS_COMPILE}gcc, which is usually
49-
# the case for package building. It does not cross-compile when CC=clang.
47+
# When ${CC} and ${HOSTCC} differ, rebuild host programs using ${CC}.
5048
#
5149
# This caters to host programs that participate in Kbuild. objtool and
5250
# resolve_btfids are out of scope.
53-
if [ "${CC}" != "${HOSTCC}" ] && is_enabled CONFIG_CC_CAN_LINK; then
51+
if [ "${CC}" != "${HOSTCC}" ]; then
5452
echo "Rebuilding host programs with ${CC}..."
5553

5654
cat <<-'EOF' > "${destdir}/Kbuild"

scripts/package/mkdebian

+9-1
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ fi
179179

180180
echo $debarch > debian/arch
181181

182+
host_gnu=$(dpkg-architecture -a "${debarch}" -q DEB_HOST_GNU_TYPE | sed 's/_/-/g')
183+
182184
# Generate a simple changelog template
183185
cat <<EOF > debian/changelog
184186
$sourcename ($packageversion) $distribution; urgency=low
@@ -196,7 +198,11 @@ Priority: optional
196198
Maintainer: $maintainer
197199
Rules-Requires-Root: no
198200
Build-Depends: debhelper-compat (= 12)
199-
Build-Depends-Arch: bc, bison, cpio, flex, kmod, libelf-dev:native, libssl-dev:native, rsync
201+
Build-Depends-Arch: bc, bison, cpio, flex,
202+
gcc-${host_gnu} <!pkg.${sourcename}.nokernelheaders>,
203+
kmod, libelf-dev:native,
204+
libssl-dev:native, libssl-dev <!pkg.${sourcename}.nokernelheaders>,
205+
rsync
200206
Homepage: https://www.kernel.org/
201207
202208
Package: $packagename-$version
@@ -224,6 +230,7 @@ cat <<EOF >> debian/control
224230
225231
Package: linux-headers-$version
226232
Architecture: $debarch
233+
Build-Profiles: <!pkg.${sourcename}.nokernelheaders>
227234
Description: Linux kernel headers for $version on $debarch
228235
This package provides kernel header files for $version on $debarch
229236
.
@@ -238,6 +245,7 @@ cat <<EOF >> debian/control
238245
Package: linux-image-$version-dbg
239246
Section: debug
240247
Architecture: $debarch
248+
Build-Profiles: <!pkg.${sourcename}.nokerneldbg>
241249
Description: Linux kernel debugging symbols for $version
242250
This package will come in handy if you need to debug the kernel. It provides
243251
all the necessary debug symbols for the kernel and its modules.

0 commit comments

Comments
 (0)