WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Linux Kernel Headers  (Read 2304 times)

Offline A Guy

  • WikiUser
  • *
  • Posts: 24
Linux Kernel Headers
« on: July 16, 2019, 01:31:17 PM »
Is there a package for this?
I have dCore/x86_64/release/dCore-stretch64 packages.

I would like to compile a driver against this particular kernel version. 4.8.17.

If it isn't now, I believe the kernel headers that the kernel is drawn from should include. I assumed I could find it somewhere on the Debian downloads area, but the folders don't seem to line up one to one.
Tony M.
Embedded Software and BIOS Engineer

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9659
Re: Linux Kernel Headers
« Reply #1 on: July 16, 2019, 05:46:48 PM »
Hi A Guy.  These instructions are for anyone to compile the kernel or compatible modules for dCore-stretch64, so all steps are listed and I don't think I have documented them anywhere.  First, be on a dCore-stretch64 running session and install the build-essential package.  This contains all one needs to compile the kernel.  Then download the three files below:

http://tinycorelinux.net/dCore/x86_64/import/src/kernel-4.8.17/README
http://tinycorelinux.net/dCore/x86_64/import/src/kernel-4.8.17/linux-4.8.17-patched.tar.xz
http://tinycorelinux.net/dCore/x86_64/import/src/kernel-4.8.17/config-4.8.17-tinycore-devtmpfs64

The linux-4.8.17-patched.tar.xz is the same as in Tinycore 8.x, but the dCore config adds the devtmpfs needed.  Also, the README provides basic steps, but here is what I do to build the kernel and modules.  Below are the steps. assuming one is at a terminal prompt and I do it all as root user and those files listed above are in the current directory.  The current directory can of course be of one's choosing

Code: [Select]
bash
mkdir /tmp/linux
cd /tmp/linux
wget http://tinycorelinux.net/dCore/x86_64/import/src/kernel-4.8.17/linux-4.8.17-patched.tar.xz
wget http://tinycorelinux.net/dCore/x86_64/import/src/kernel-4.8.17/config-4.8.17-tinycore-devtmpfs64
export CFLAGS="-mtune=generic -O2 -pipe"
export CXXFLAGS="-mtune=generic -O2 -pipe"
tar xvf linux-4.8.17-patched.tar.xz
mkdir /usr/src
ln -sf /tmp/linux/linux-4.8.17 /usr/src/linux
ln -sf /usr/src/linux /lib/modules/4.8.17-tinycore64/build
ln -sf /usr/src/linux /lib/modules/4.8.17-tinycore64/source
cd linux-4.8.17
cp config-4.8.17-tinycore-devtmpfs64 .config
make oldconfig
make prepare
make modules_prepare
make bzImage
make modules
make INSTALL_MOD_PATH=/desired/install/path modules_install

This provides the environment the kernel for dCore-stretch64 was produced in.  Earlier dCore kernels were built on Tinycore, but later ones are built on dCore itself.

« Last Edit: July 31, 2019, 02:22:29 PM by Jason W »

Offline A Guy

  • WikiUser
  • *
  • Posts: 24
Re: Linux Kernel Headers
« Reply #2 on: July 17, 2019, 05:41:29 AM »
Awesome, this is exactly what i need.

I need to create a development and test environment so that I can create and deploy a testing environment using PXE.
These are devices we create so I need to compile the drivers in the same kernel context as the deployment (dCore) booting environment. So I need the kernel headers to compile the drivers.

I am having a lot of fun with dCore. Thanks for the project. I believe it will help with my environment.

Little bummed about the deployment of sshd not being fully documented, but hey, Linux is free , right?
Tony M.
Embedded Software and BIOS Engineer

Offline A Guy

  • WikiUser
  • *
  • Posts: 24
Re: Linux Kernel Headers
« Reply #3 on: July 17, 2019, 10:57:34 AM »
I understand what I have now... i didn't look well enough and went through the kernel recompile.

Realistically all i needed was the kernel headers to compile my driver.
Thanks again.
Tony M.
Embedded Software and BIOS Engineer

Offline A Guy

  • WikiUser
  • *
  • Posts: 24
Re: Linux Kernel Headers
« Reply #4 on: July 31, 2019, 01:51:27 PM »
So, I just wanted to say that your script of how to compile the kernel has some flubs
Code: (bash) [Select]
tar xvf linux-4.8.17-patched.txzshould be
Code: (bash) [Select]
tar xvf linux-4.8.17-patched.tar.txz
Code: (bash) [Select]
cp config-4.8.17-tinycore-mountdevtmpfs .configshould be
Code: (bash) [Select]
cp config-4.8.17-tinycore-devtmpfs64 .config
Tony M.
Embedded Software and BIOS Engineer

Offline A Guy

  • WikiUser
  • *
  • Posts: 24
Re: Linux Kernel Headers
« Reply #5 on: July 31, 2019, 01:56:17 PM »
I started doing a build of the dCore-stretch64 kernel and saw a warning go by (I think about Intel microcode). This got me to thinking that perhaps my build environment isn't complete.

Do you have a set of build packages you use when re-compiling the kernel?
I have :
  • build-essential
  • gcc-multilib
  • libc6-dev-i386

Perhaps not all relevant to a rebuild but I was curious what you used.
Tony M.
Embedded Software and BIOS Engineer

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9659
Re: Linux Kernel Headers
« Reply #6 on: July 31, 2019, 02:26:47 PM »
Thanks for correcting the typos, corrected now in my post.  I was going by memory of the steps. 

Are you using a 64 bit dCore to compile for 32 bit?  I only use 64 bit for 64 bit, and 32 for 32.  Thanks.


Offline A Guy

  • WikiUser
  • *
  • Posts: 24
Re: Linux Kernel Headers
« Reply #7 on: August 01, 2019, 06:21:30 AM »
Are you using a 64 bit dCore to compile for 32 bit?  I only use 64 bit for 64 bit, and 32 for 32.  Thanks.

That's a good question. The set of files I am using were for general development, so I just listed what I had .
I was just curious what your minimal set is.
Tony M.
Embedded Software and BIOS Engineer