Skip to contentSkip to conversation

kbuild: Add an option to skip vmlinux.bz2 in the rpm's

PATCH In review Zack Rusin 4 participants 5 messages Sep 22, 2022 – Sep 28, 2022 Kbuild

lore
Share & tools
lore

Zack Rusin

author
#0 lore raw

PATCH 1/1 kbuild: Add an option to skip vmlinux.bz2 in the rpm's

From: Zack Rusin <[email protected]>

The debug vmlinux takes up the vast majority of space in the built rpm's. While having it enabled by default is a good idea because it makes debugging easier, having an option to skip it is highly valuable for CI/CD systems where small packages are a lot easier to deal with e.g. kernel rpm built using binrpm-pkg on Fedora 36 default 5.19.8 kernel config and localmodconfig goes from 255MB to 65MB which is an almost 4x difference.

To skip adding vmlinux.bz2 to the built rpm add SKIP_RPM_VMLINUX environment variable which when set to "y", e.g. via "SKIP_RPM_VMLINUX=y make binrpm-pkg" won't include vmlinux.bz2 in the built rpm.

Cc Masahiro Yamada <[email protected]>
Cc Michal Marek <[email protected]>
Cc Nick Desaulniers <[email protected]>
---
 scripts/package/mkspec | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
scripts/package/mkspec +8 -2
index 7c477ca7dc98..5a71fc0852b0 100755
@@ -23,6 +23,12 @@ else
 	M=DEL
 fi
 
+if [ "$RPM_SKIP_VMLINUX" = y ]; then
+	D=DEL
+else
+	D=
+fi
+
 if grep -q CONFIG_DRM=y .config; then
 	PROVIDES=kernel-drm
 fi
@@ -94,8 +100,8 @@ $M	$MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install
 	$MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
 	cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE
 	cp .config %{buildroot}/boot/config-$KERNELRELEASE
-	bzip2 -9 --keep vmlinux
-	mv vmlinux.bz2 %{buildroot}/boot/vmlinux-$KERNELRELEASE.bz2
+$D	bzip2 -9 --keep vmlinux
+$D	mv vmlinux.bz2 %{buildroot}/boot/vmlinux-$KERNELRELEASE.bz2
 $S$M	rm -f %{buildroot}/lib/modules/$KERNELRELEASE/build
 $S$M	rm -f %{buildroot}/lib/modules/$KERNELRELEASE/source
 $S$M	mkdir -p %{buildroot}/usr/src/kernels/$KERNELRELEASE
Signature · 1 line
2.34.1
maintainer Tested-by on v1 1/1
#1 lore raw
Quoted 15 lines · Zack Rusin

From: Zack Rusin <[email protected]>

The debug vmlinux takes up the vast majority of space in the built rpm's. While having it enabled by default is a good idea because it makes debugging easier, having an option to skip it is highly valuable for CI/CD systems where small packages are a lot easier to deal with e.g. kernel rpm built using binrpm-pkg on Fedora 36 default 5.19.8 kernel config and localmodconfig goes from 255MB to 65MB which is an almost 4x difference.

To skip adding vmlinux.bz2 to the built rpm add SKIP_RPM_VMLINUX environment variable which when set to "y", e.g. via "SKIP_RPM_VMLINUX=y make binrpm-pkg" won't include vmlinux.bz2 in the built rpm.

Quoted 6 lines
Cc Masahiro Yamada <[email protected]>
Cc Michal Marek <[email protected]>
Cc Nick Desaulniers <[email protected]>

Yes please, this seems to slightly improve the time spent actually building and installing the package.

Quoted 36 lines
---
 scripts/package/mkspec | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
scripts/package/mkspec +8 -2
index 7c477ca7dc98..5a71fc0852b0 100755
@@ -23,6 +23,12 @@ else
 	M=DEL
 fi
 
+if [ "$RPM_SKIP_VMLINUX" = y ]; then
+	D=DEL
+else
+	D=
+fi
+
 if grep -q CONFIG_DRM=y .config; then
 	PROVIDES=kernel-drm
 fi
@@ -94,8 +100,8 @@ $M	$MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install
 	$MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
 	cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE
 	cp .config %{buildroot}/boot/config-$KERNELRELEASE
-	bzip2 -9 --keep vmlinux
-	mv vmlinux.bz2 %{buildroot}/boot/vmlinux-$KERNELRELEASE.bz2
+$D	bzip2 -9 --keep vmlinux
+$D	mv vmlinux.bz2 %{buildroot}/boot/vmlinux-$KERNELRELEASE.bz2
 $S$M	rm -f %{buildroot}/lib/modules/$KERNELRELEASE/build
 $S$M	rm -f %{buildroot}/lib/modules/$KERNELRELEASE/source
 $S$M	mkdir -p %{buildroot}/usr/src/kernels/$KERNELRELEASE
Signature · 1 line
2.34.1
#2 lore raw
In reply to Zack Rusin
Quoted 55 lines · Zack Rusin

From: Zack Rusin <[email protected]>

The debug vmlinux takes up the vast majority of space in the built rpm's. While having it enabled by default is a good idea because it makes debugging easier, having an option to skip it is highly valuable for CI/CD systems where small packages are a lot easier to deal with e.g. kernel rpm built using binrpm-pkg on Fedora 36 default 5.19.8 kernel config and localmodconfig goes from 255MB to 65MB which is an almost 4x difference.

To skip adding vmlinux.bz2 to the built rpm add SKIP_RPM_VMLINUX environment variable which when set to "y", e.g. via "SKIP_RPM_VMLINUX=y make binrpm-pkg" won't include vmlinux.bz2 in the built rpm.

Cc Masahiro Yamada <[email protected]>
Cc Michal Marek <[email protected]>
Cc Nick Desaulniers <[email protected]>
---
 scripts/package/mkspec | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
scripts/package/mkspec +8 -3
index 7c477ca7dc98..5a71fc0852b0 100755
@@ -23,6 +23,12 @@ else
        M=DEL
 fi
 
+if [ "$RPM_SKIP_VMLINUX" = y ]; then
+       D=DEL
+else
+       D=
+fi
+
 if grep -q CONFIG_DRM=y .config; then
        PROVIDES=kernel-drm
 fi
@@ -94,8 +100,8 @@ $M   $MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install
        $MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
        cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE
        cp .config %{buildroot}/boot/config-$KERNELRELEASE
-       bzip2 -9 --keep vmlinux
-       mv vmlinux.bz2 %{buildroot}/boot/vmlinux-$KERNELRELEASE.bz2
+$D     bzip2 -9 --keep vmlinux
+$D     mv vmlinux.bz2 %{buildroot}/boot/vmlinux-$KERNELRELEASE.bz2
 $S$M   rm -f %{buildroot}/lib/modules/$KERNELRELEASE/build
 $S$M   rm -f %{buildroot}/lib/modules/$KERNELRELEASE/source
 $S$M   mkdir -p %{buildroot}/usr/src/kernels/$KERNELRELEASE
--
Quoted 2 lines

2.34.1

This came from fc370ecfdb37b853bd8e2118c7ad9f99fa9ac5cd I do not know how useful or annoying it is.
Presumably, it was a cheesy work, and rather annoying than useful.

In debian (scripts/package/mkdebian), this kind of stuff is a separate debug package, and only built when CONFIG_DEBUG_INFO=y.

Take more time in case somebody may come up with a better idea.

--
Best Regards
Masahiro Yamada

#3 lore raw
Quoted 69 lines · Masahiro Yamada

⚠ External Email

Quoted 55 lines · Zack Rusin

From: Zack Rusin <[email protected]>

The debug vmlinux takes up the vast majority of space in the built rpm's. While having it enabled by default is a good idea because it makes debugging easier, having an option to skip it is highly valuable for CI/CD systems where small packages are a lot easier to deal with e.g. kernel rpm built using binrpm-pkg on Fedora 36 default 5.19.8 kernel config and localmodconfig goes from 255MB to 65MB which is an almost 4x difference.

To skip adding vmlinux.bz2 to the built rpm add SKIP_RPM_VMLINUX environment variable which when set to "y", e.g. via "SKIP_RPM_VMLINUX=y make binrpm-pkg" won't include vmlinux.bz2 in the built rpm.

Cc Masahiro Yamada <[email protected]>
Cc Michal Marek <[email protected]>
Cc Nick Desaulniers <[email protected]>
---
 scripts/package/mkspec | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
scripts/package/mkspec +8 -3
index 7c477ca7dc98..5a71fc0852b0 100755
@@ -23,6 +23,12 @@ else
        M=DEL
 fi
 
+if [ "$RPM_SKIP_VMLINUX" = y ]; then
+       D=DEL
+else
+       D=
+fi
+
 if grep -q CONFIG_DRM=y .config; then
        PROVIDES=kernel-drm
 fi
@@ -94,8 +100,8 @@ $M   $MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install
        $MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
        cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE
        cp .config %{buildroot}/boot/config-$KERNELRELEASE
-       bzip2 -9 --keep vmlinux
-       mv vmlinux.bz2 %{buildroot}/boot/vmlinux-$KERNELRELEASE.bz2
+$D     bzip2 -9 --keep vmlinux
+$D     mv vmlinux.bz2 %{buildroot}/boot/vmlinux-$KERNELRELEASE.bz2
 $S$M   rm -f %{buildroot}/lib/modules/$KERNELRELEASE/build
 $S$M   rm -f %{buildroot}/lib/modules/$KERNELRELEASE/source
 $S$M   mkdir -p %{buildroot}/usr/src/kernels/$KERNELRELEASE
--
Quoted 2 lines

2.34.1

This came from fc370ecfdb37b853bd8e2118c7ad9f99fa9ac5cd I do not know how useful or annoying it is.
Presumably, it was a cheesy work, and rather annoying than useful.

Quoted 5 lines

In debian (scripts/package/mkdebian), this kind of stuff is a separate debug package, and only built when CONFIG_DEBUG_INFO=y.

Take more time in case somebody may come up with a better idea.

I'd be happy to rework it in whatever way would be more convenient. Because rpm builds already depend on environment vars due to RPMOPTS I thought this approach was fitting but I'm not particularly attached to it. The important thing is the the end result of not including vmlinux.bz2 in the rpm itself.

I think the other reasonable question to ask is: is anyone still using vmlinux.bz2 from rpms? Because maybe just removing that code completely is the better option here.

z

#4 lore raw
Quoted 77 lines · Zack Rusin
Quoted 69 lines · Masahiro Yamada

⚠ External Email

Quoted 55 lines · Zack Rusin

From: Zack Rusin <[email protected]>

The debug vmlinux takes up the vast majority of space in the built rpm's. While having it enabled by default is a good idea because it makes debugging easier, having an option to skip it is highly valuable for CI/CD systems where small packages are a lot easier to deal with e.g. kernel rpm built using binrpm-pkg on Fedora 36 default 5.19.8 kernel config and localmodconfig goes from 255MB to 65MB which is an almost 4x difference.

To skip adding vmlinux.bz2 to the built rpm add SKIP_RPM_VMLINUX environment variable which when set to "y", e.g. via "SKIP_RPM_VMLINUX=y make binrpm-pkg" won't include vmlinux.bz2 in the built rpm.

Cc Masahiro Yamada <[email protected]>
Cc Michal Marek <[email protected]>
Cc Nick Desaulniers <[email protected]>
---
 scripts/package/mkspec | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
scripts/package/mkspec +8 -3
index 7c477ca7dc98..5a71fc0852b0 100755
@@ -23,6 +23,12 @@ else
        M=DEL
 fi
 
+if [ "$RPM_SKIP_VMLINUX" = y ]; then
+       D=DEL
+else
+       D=
+fi
+
 if grep -q CONFIG_DRM=y .config; then
        PROVIDES=kernel-drm
 fi
@@ -94,8 +100,8 @@ $M   $MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install
        $MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
        cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE
        cp .config %{buildroot}/boot/config-$KERNELRELEASE
-       bzip2 -9 --keep vmlinux
-       mv vmlinux.bz2 %{buildroot}/boot/vmlinux-$KERNELRELEASE.bz2
+$D     bzip2 -9 --keep vmlinux
+$D     mv vmlinux.bz2 %{buildroot}/boot/vmlinux-$KERNELRELEASE.bz2
 $S$M   rm -f %{buildroot}/lib/modules/$KERNELRELEASE/build
 $S$M   rm -f %{buildroot}/lib/modules/$KERNELRELEASE/source
 $S$M   mkdir -p %{buildroot}/usr/src/kernels/$KERNELRELEASE
--
Quoted 2 lines

2.34.1

This came from fc370ecfdb37b853bd8e2118c7ad9f99fa9ac5cd I do not know how useful or annoying it is.
Presumably, it was a cheesy work, and rather annoying than useful.

Quoted 5 lines

In debian (scripts/package/mkdebian), this kind of stuff is a separate debug package, and only built when CONFIG_DEBUG_INFO=y.

Take more time in case somebody may come up with a better idea.

Quoted 8 lines

I'd be happy to rework it in whatever way would be more convenient. Because rpm builds already depend on environment vars due to RPMOPTS I thought this approach was fitting but I'm not particularly attached to it. The important thing is the the end result of not including vmlinux.bz2 in the rpm itself.

I think the other reasonable question to ask is: is anyone still using vmlinux.bz2 from rpms? Because maybe just removing that code completely is the better option here.

Yes, I like it.

Signature · 2 lines
Best Regards
Masahiro Yamada