0

Initially, My approach was to re-compile whole kernel from scratch but all hopes went down the moment I found out that it requires large amount of disk space.

Now, I'm trying to figure out how to compile only part of it.

The file I modified is net/ipv4/tcp_ipv4.c

I then followed following steps but lost at middle,

Downloaded kernel source files to /home/linux
ran cp /boot/config-$(uname -r) .config
make oldconfig
make scripts prepare modules_prepare
apt-get install linux-headers-$(uname -r)
make -C . M=net/ipv4
make net/ipv4/tcp_ipv4.c

I don't know what to do next as the answers found on Stackoverflow are describing about building custom made modules.

An answer found on Stackoverflow (LINK) describes that it can't be done, and that it's only possible to compile whole Kernel.

"It can't be done. Just compile the whole kernel. After the first compilation, make will ensure only changed files are recompiled so future builds will be fast."

I had thought about using Google Drive as the HDD for full compile but it looks like there are lack of options doing that as-well.

My last option would be resizing the whole server.

Edit:

I entered into /net/ipv4 dir via CD and tried

make -C /lib/modules/$(uname -r)/build M=$(pwd) modules_install

and it outputs

  Building modules, stage 2.
  MODPOST 61 modules
FATAL: parse error in symbol dump file
make[1]: *** [scripts/Makefile.modpost:94: __modpost] Error 1
make: *** [Makefile:1632: modules] Error 2
make: Leaving directory '/usr/src/linux-headers-5.4.0-26-generic'

1 Answer 1

2

If you look at net/ipv4/Makefile, you’ll see that tcp_ipv4.o is part of obj-y, which means it can only be built as part of the kernel, it can’t be built as a module.

If you want your changes to be taken into account, you’ll have to rebuild the complete kernel. Since you’re short of disk space, you can build only the kernel, install that, then clean the build tree and build the modules, and install them; that will require a little less disk space.

4
  • Is it really possible to install only Kernel without modules? Would be great if you can direct me into right direction
    – sqlbie
    Jun 28, 2020 at 18:51
  • Let me try that anyway. Have to wait another day as I erased previous complication.
    – sqlbie
    Jun 28, 2020 at 18:56
  • You’ll need to install the kernel and its modules, but you can do so in two steps, and clean up in between to free up disk space. Jun 28, 2020 at 19:10
  • Thanks. I will try!
    – sqlbie
    Jun 28, 2020 at 19:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .