Working with a Headless Raspberry PI 4 with an Ubuntu Server 18.04.4 LTS.. I am trying to configure the source kernel. I have installed libncurses-dev, kernel-package, qt4-dev-tools.

When I run 'make menuconfig' in the directory /linux-5.7, it shows:

  LEX     scripts/kconfig/lexer.lex.c
/bin/sh: 1: flex: not found
scripts/Makefile.host:9: recipe for target 'scripts/kconfig/lexer.lex.c' failed
make[1]: *** [scripts/kconfig/lexer.lex.c] Error 127
Makefile:588: recipe for target 'menuconfig' failed
make: *** [menuconfig] Error 2

Lost on what to do, everything I have read hasn't helped so far. My goal is to start programming device drivers, and to do so I need a configured and built kernel source tree on disk.


In the Ubuntu's Build Your Own Kernel guide it is stated that you have to install following programs :

sudo apt-get install libncurses-dev flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf

to be able to compile the kernel from source successfully.


flex is not installed. Install it by

sudo apt install flex

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.