WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Linux Kernel Headers  (Read 16232 times)

Offline A Guy

  • Newbie
  • *
  • Posts: 25
Linux Kernel Headers
« on: July 16, 2019, 04: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

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: Linux Kernel Headers
« Reply #1 on: July 16, 2019, 08: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, 05:22:29 PM by Jason W »

Offline A Guy

  • Newbie
  • *
  • Posts: 25
Re: Linux Kernel Headers
« Reply #2 on: July 17, 2019, 08: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

  • Newbie
  • *
  • Posts: 25
Re: Linux Kernel Headers
« Reply #3 on: July 17, 2019, 01:57:34 PM »
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

  • Newbie
  • *
  • Posts: 25
Re: Linux Kernel Headers
« Reply #4 on: July 31, 2019, 04: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

  • Newbie
  • *
  • Posts: 25
Re: Linux Kernel Headers
« Reply #5 on: July 31, 2019, 04: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

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: Linux Kernel Headers
« Reply #6 on: July 31, 2019, 05: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

  • Newbie
  • *
  • Posts: 25
Re: Linux Kernel Headers
« Reply #7 on: August 01, 2019, 09: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

Offline A Guy

  • Newbie
  • *
  • Posts: 25
Re: Linux Kernel Headers
« Reply #8 on: September 20, 2019, 09:46:56 AM »
I wanted to add, I was running through kernel re-compile and it seemed that after copying the configuration file you had onto .config, the
Code: [Select]
make oldconfig command seemed to be pulling the .config from another location and over writing it. A diff between the original config file you have and the .config shows that they are pretty different after the build, which shouldn't happen.

I believe the make oldconfig step should be removed , from the procedure.

You see it in many descriptions on how to build a kernel, but then I have also seen it not used.

=== One more thing... linux-4.8.17-patched.tar.txz
What are the patches ? Do you have a patch script?

Tony
Tony M.
Embedded Software and BIOS Engineer

Offline Jason W

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
Re: Linux Kernel Headers
« Reply #9 on: September 20, 2019, 06:28:15 PM »
Ok, I will look into the make oldconfig thing.


Below is the directory for that kernel and it's patches.  I simply use the linux-4.8.17-patched.tar.xz along with the dCore specific config file.