1

I am trying to build the ubuntu 5.3.0 kernel with a custom patch. I downloaded the source and added the patch using

patch -p1 < patch_name.patch

and make a config using

make config

then I compiled it using

make -j6

This gave me the vmlinux and vmlinux.o files. I didnt know how to use them so I tried to make the kernel into a .deb file. I used

make deb-pkg

fakeroot make-kpkg -j N --initrd --append-to-version=my-very-own-kernel kernel-image kernel-headers

make bindeb-pkg

but all of these give me the same error after compiling the whole kernel.

/bin/sh: 1: lz4c: not found
arch/x86/boot/compressed/Makefile:146: recipe for target 'arch/x86/boot/compressed/vmlinux.bin.lz4' failed
make[3]: *** [arch/x86/boot/compressed/vmlinux.bin.lz4] Error 127
make[3]: *** Deleting file 'arch/x86/boot/compressed/vmlinux.bin.lz4'
make[3]: *** Waiting for unfinished jobs....
arch/x86/boot/Makefile:112: recipe for target 'arch/x86/boot/compressed/vmlinux' failed
make[2]: *** [arch/x86/boot/compressed/vmlinux] Error 2
arch/x86/Makefile:284: recipe for target 'bzImage' failed
make[1]: *** [bzImage] Error 2
make[1]: Leaving directory '/home/beebop/Downloads/linux-hwe-edge-5.3.0'
debian/ruleset/targets/common.mk:295: recipe for target 'debian/stamp/build/kernel' failed
make: *** [debian/stamp/build/kernel] Error 2

How do I compile the.deb package and if I cant is there anything to do with the vmlinux and vmlinux.o files?

  • Why have you used the "elementary" tag? – DK Bose Dec 9 '19 at 12:25
  • 3
    The error message quite clearly says that you are missing the lz4c utility. – tripleee Dec 9 '19 at 13:34
4

The change to using LZ4 compression by default in Ubuntu kernel configurations is relatively recent. Not only do some older Ubuntu versions not have LZ4 related tools installed by default, but they are actually unavailable.

Change the compression method back to gzip: Method 1:

scripts/config --disable KERNEL_LZ4
scripts/config --enable KERNEL_GZIP

Method 2: Manually make these changes to your kernel config:

Change this:

#
# General setup
#
CONFIG_INIT_ENV_ARG_LIMIT=32
# CONFIG_COMPILE_TEST is not set
# CONFIG_HEADER_TEST is not set
CONFIG_LOCALVERSION=""
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_BUILD_SALT=""
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_HAVE_KERNEL_LZ4=y
# CONFIG_KERNEL_GZIP is not set
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_XZ is not set
# CONFIG_KERNEL_LZO is not set
CONFIG_KERNEL_LZ4=y

To This:

#
# General setup
#
CONFIG_INIT_ENV_ARG_LIMIT=32
# CONFIG_COMPILE_TEST is not set
# CONFIG_HEADER_TEST is not set
CONFIG_LOCALVERSION=""
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_BUILD_SALT=""
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_HAVE_KERNEL_LZ4=y
CONFIG_KERNEL_GZIP=y
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_XZ is not set
# CONFIG_KERNEL_LZO is not set
# CONFIG_KERNEL_LZ4 is not set

Note: It takes about double the compile time to include the debug information as per the default Ubuntu kernel settings. Suggest to disable:

scripts/config --disable DEBUG_INFO

Which should do this:

doug@s15:~/temp-k-git/linux$ scripts/diffconfig .config-5.4.0-050400-lowlatency .config
 DEBUG_INFO y -> n
doug@s15:~/temp-k-git/linux$ diff .config-5.4.0-050400-lowlatency .config
10144c10144
< CONFIG_DEBUG_INFO=y
---
> # CONFIG_DEBUG_INFO is not set

Install only the resulting headers (~12 megabytes) and image (~60 megabytes) files.

|improve this answer|||||
  • It worked! Thanks. No I got 4 files the namely, linux-headers-5.3.10_5.3.10-1_amd64.deb(11MB), linux-libc-dev_5.3.10-1_amd64.deb(1.1MB), linux-image-5.3.10_5.3.10-1_amd64.deb(59.6MB) and linux-image-5.3.10-dbg_5.3.10-1_amd64.deb(841.6MB). I installed the 841.6MB kernel and headers using dpkg -i. Ran update-grub but the kernel is not installed. Its not there in /boot – Ballistic Swami Dec 9 '19 at 20:32
  • Opps, if you are using the Ubuntu kernel configuration, you also need to disable debug stuff. I'll edit my answer. Install the 59.6 MB linux-image. – Doug Smythies Dec 10 '19 at 17:14
0
/bin/sh: 1: lz4c: not found
kernel/4.14/arch/x86/boot/compressed/Makefile:141: recipe for target 'arch/x86/boot/compressed/vmlinux.bin.lz4' failed 4:14

Solution: [all i had to do is install the missing library] sudo apt-get install liblz4-tool

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.