LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-12-2009, 03:45 PM   #1
linuxhippy
Senior Member
 
Registered: Sep 2004
Location: Philadelphia, PA
Distribution: Xubuntu, Mythbuntu, Lubuntu, Picuntu, Mint 18.1, Debian Jessie
Posts: 1,207

Rep: Reputation: 47
how do I only install a kernel without it's source directory?


I recently did a fresh install of Slackware on a 4 GB drive. Not much space was there (I didn't include KDE or the kernel source) and now I only have ~500 MB. I want to recompile the kernel on another pc so that my Slack 13 install has APM built in rather than a module. Now, I've re-done the kernel many times over the years...but I'm thinking that I'm installing too much (it wouldn't fit inside of 500 MB).

This is what I do:

On another pc with more space I download a fresh kernel and cryptographically check it. Then I untar, do make mrproper, copy an old kernel config file to /linux-2.6.xx, cd /linux-2.6.xx, make oldconfig, make menuconfig-make changes and save-and finally make bzImage && make modules. Once this is done compiling I compress the file into a single file for transporting with tar -cvvzf.

On my old pc I copy the file to /usr/src and then untar the file with tar -xvvzf. This rebuilds a huge directory called linux-2.6.xx. I cd into this directory and then do make modules_install. Then I copy 3 files over to /boot>bzimage, config and systemmap. I make needed changes to /etc/lilo.conf and then do lilo to get it to boot.

Now-is this overkill? Can I put the linux-2.6.xx source directory onto an usb drive (untarred) and do a make modules_install (the usb drive will be removed later)?
 
Old 10-12-2009, 11:16 PM   #2
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,783

Rep: Reputation: 1460Reputation: 1460Reputation: 1460Reputation: 1460Reputation: 1460Reputation: 1460Reputation: 1460Reputation: 1460Reputation: 1460Reputation: 1460
You don't need to copy the whole compiled source tree just to install the modules. You can install the modules tree to some temporary place and copy them over.

Code:
make modules_install INSTALL_MOD_PATH=/tmp/tempmodules
 
Old 10-13-2009, 09:09 AM   #3
linuxhippy
Senior Member
 
Registered: Sep 2004
Location: Philadelphia, PA
Distribution: Xubuntu, Mythbuntu, Lubuntu, Picuntu, Mint 18.1, Debian Jessie
Posts: 1,207

Original Poster
Rep: Reputation: 47
The installed modules that wind up in /lib/modules/2.6.xx don't take up much space...what I'm wondering about is the huge source directory (700+ MB) that is made during kernel building in /usr/src/linux-2.6.xx. Do I need to install that huge directory on a computer to make it boot? I've tried without that directory and cannot get the pc to boot.

There must be a way, though, since you don't have to install the kernel source on a Slackware installation to make it boot (nothing has to be in /usr/src and you don't have to install the k package). How do the Slackware gurus make the pc boot without a kernel source?

Last edited by linuxhippy; 10-13-2009 at 09:14 AM.
 
Old 10-13-2009, 09:19 AM   #4
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
The kernel source is never needed to run your system. The only time you need kernel sources is when you are compiling a kernel module.

Eric
 
Old 10-13-2009, 10:02 AM   #5
linuxhippy
Senior Member
 
Registered: Sep 2004
Location: Philadelphia, PA
Distribution: Xubuntu, Mythbuntu, Lubuntu, Picuntu, Mint 18.1, Debian Jessie
Posts: 1,207

Original Poster
Rep: Reputation: 47
That's what I figured-you only need bzImage, systemmap and the kernel modules in /lib/modules. I cannot get my pc to boot without the kernel source, though. Would you give me step by step instructions of how to compile on another pc and then move it to a smaller pc?
 
Old 10-13-2009, 10:40 AM   #6
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

Quote:
Originally Posted by linuxhippy View Post
That's what I figured-you only need bzImage, systemmap and the kernel modules in /lib/modules. I cannot get my pc to boot without the kernel source, though. Would you give me step by step instructions of how to compile on another pc and then move it to a smaller pc?
Look at 'Building a Linux Kernel from source'. Alien_Bob's wiki has it all laid out for you on how to build. Transporting kernels from a build system is done all the time.


This link and others can be found at 'Slackware-Links'. More than just SlackwareŽ links!
 
Old 10-13-2009, 04:02 PM   #7
linuxhippy
Senior Member
 
Registered: Sep 2004
Location: Philadelphia, PA
Distribution: Xubuntu, Mythbuntu, Lubuntu, Picuntu, Mint 18.1, Debian Jessie
Posts: 1,207

Original Poster
Rep: Reputation: 47
ok-something is missing in that link...that's how I have been building kernels with the source directory in /usr/src. Now if I leave the source directory on an external drive after doing make modules_install my pc won't boot. How do I get my pc to boot without /usr/src/linux-2.6.xx?
 
Old 10-13-2009, 06:22 PM   #8
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

When you build on a separate system you will need to transport your modules along with the kernel, config and map. Place your modules in the proper '/lib/modules/' directory for the new kernel. Then copy your kernel, config and map files to /boot. You will need to link your map. Then setup the /etc/lilo.conf' to reflect the new kernel. Be sure to run 'lilo' to update.

I like to set the '/usr/src/linux/Makefile'; 'EXTRAVERSION' to something unique;

Code:
excerpt from '/usr/src/linux/Makefile';
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 30
EXTRAVERSION = .5-1
NAME = Man-Eating Seals of Antiquity
That way I can transport '/lib/modules/2.6.30.5-1' with the rest.

Edit: You can look at a old thread that discusses 'Updating Multiple Boxes With A Newly Compiled Kernel' using build technique.

Last edited by onebuck; 10-13-2009 at 06:31 PM. Reason: add reference link
 
Old 10-13-2009, 09:23 PM   #9
linuxhippy
Senior Member
 
Registered: Sep 2004
Location: Philadelphia, PA
Distribution: Xubuntu, Mythbuntu, Lubuntu, Picuntu, Mint 18.1, Debian Jessie
Posts: 1,207

Original Poster
Rep: Reputation: 47
Quote:
Originally Posted by onebuck View Post
Hi,

When you build on a separate system you will need to transport your modules along with the kernel, config and map. Place your modules in the proper '/lib/modules/' directory for the new kernel. Then copy your kernel, config and map files to /boot. You will need to link your map. Then setup the /etc/lilo.conf' to reflect the new kernel. Be sure to run 'lilo' to update.

I like to set the '/usr/src/linux/Makefile'; 'EXTRAVERSION' to something unique;

Code:
excerpt from '/usr/src/linux/Makefile';
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 30
EXTRAVERSION = .5-1
NAME = Man-Eating Seals of Antiquity
That way I can transport '/lib/modules/2.6.30.5-1' with the rest.

Edit: You can look at a old thread that discusses 'Updating Multiple Boxes With A Newly Compiled Kernel' using build technique.
This is helpful...I'm thinking I may have to use an extraversion in my kernel Makefile so that /lib/modules is unique (I was renaming the installed /lib/modules/2.6.29.6 as /lib/modules/2.6.29.6-orig and then doing a make modules_install to create /lib/modules/2.6.29.6). I'm building the kernel and modules again as I type.

What I'm not sure about is where do I do make modules_install?? Do I do that on my big computer where I compiled the kernel and modules or do I do it on my smaller computer and have the kernel source directory on a flash drive?? I thought the modules were made during make modules...but it sounds like you're saying it's when the directory in /lib/modules is created during make modules_install and so I need to do make modules_install on my big computer and then copy this modules directory.

Last edited by linuxhippy; 10-13-2009 at 09:35 PM.
 
Old 10-13-2009, 11:07 PM   #10
linuxhippy
Senior Member
 
Registered: Sep 2004
Location: Philadelphia, PA
Distribution: Xubuntu, Mythbuntu, Lubuntu, Picuntu, Mint 18.1, Debian Jessie
Posts: 1,207

Original Poster
Rep: Reputation: 47
well, that didn't work. I did make modules_install on my big computer after rebuilding the kernel as 2.6.29.6-1 and then copied the directory 2.6.29.6-1 (the modules) to a flash drive and then copied them to my small computer with vmlinuz, System.map and config. These were copied to /lib/modules and /boot and then lilo.conf was updated with lilo being ran. Then I rebooted and picked Linux-apm. All looked ok (it found the kernel) and the BIOS checked out then the screen went blank. I have no idea what I did wrong. Maybe I had to do make modules_install on the small computer?
 
Old 10-14-2009, 08:21 AM   #11
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

Quote:
Originally Posted by linuxhippy View Post
This is helpful...I'm thinking I may have to use an extraversion in my kernel Makefile so that /lib/modules is unique (I was renaming the installed /lib/modules/2.6.29.6 as /lib/modules/2.6.29.6-orig and then doing a make modules_install to create /lib/modules/2.6.29.6). I'm building the kernel and modules again as I type.

What I'm not sure about is where do I do make modules_install?? Do I do that on my big computer where I compiled the kernel and modules or do I do it on my smaller computer and have the kernel source directory on a flash drive?? I thought the modules were made during make modules...but it sounds like you're saying it's when the directory in /lib/modules is created during make modules_install and so I need to do make modules_install on my big computer and then copy this modules directory.

You don't rename the modules directory. When you build the kernel and you have added the 'EXTRAVERSION=' then the 'make, make modules and make modules _install' will create the modules with the name as identified by the name that will be unique form from the identifier. You did look at the link that was provided for the build technique;

Quote:
excerpt form post #2;

You should move a copy of the generated modules for the kernel that was compiled. The make modules and make modules_install is for that kernel therefore it is dependent on these.

I use a build directory for this. This way I can create what I want and move it as a whole.

The use of a non-production box is done all the time. As long as the tree for the np box is the same for the other boxes this will not be a problem. I move these over then create a stanza in my lilo.conf to reflect the new test kernel. Then I run a test to make sure everything is working. You should now be able to dep -a for the test kernel.
Please post your procedure exact from the notes your are keeping so we can help identify the problem.

You say it doesn't work. How? Errors? Which 'config' was used for the test kernel? Which kernel?

You seem to have some confusion still. This procedure is done all the time and is not that complicated.
 
Old 10-14-2009, 09:41 AM   #12
plasmonics
Member
 
Registered: Jan 2009
Distribution: Fedora, Gentoo, LFS
Posts: 224

Rep: Reputation: 69
Another possibility is to build the kernel as a tarball using:
make targz-pkg

Then on the target machine:
1. tar zxf <my kernel>.tar.gz -C /
2. No need to run depmod. It is embedded.
3. cd /boot; rm vmlinux-<my version>
(i.e., you only need the compressed kernel)
4.mkinitrd -c -k <my version> -o /boot/initrd-<my version>
(Skip if not using initrd)
5. rm vmlinuz config System.map (i.e., delete the soft links)
6. Remake the soft links to point to the new files.
7. /sbin/lilo -v (skip if using grub)
8. reboot

Also, there is no need to set the local version string in Makefile.
In "make menuconfig" or "make xconfig", there is a placeholder to
enter a custom string in .config. Double click and type, for example,
"-custom2-smp". Drop "-smp" for a single core.
 
Old 10-14-2009, 01:23 PM   #13
linuxhippy
Senior Member
 
Registered: Sep 2004
Location: Philadelphia, PA
Distribution: Xubuntu, Mythbuntu, Lubuntu, Picuntu, Mint 18.1, Debian Jessie
Posts: 1,207

Original Poster
Rep: Reputation: 47
ok-here's what I did as of last night. I'm about to try make targz-pkg.

This is on my big AMD 64 running Fedora Core 10 x86_64 (gcc is 4.3.2-7 and Slackware 13 is 4.3.3):

Download and cryptographically check linux-2.6.29.6.tar.gz
Uncompress with tar -xvvzf linux-2.6.29.6.tar.gz
cd linux 2.6.29.6
linux32 make mrproper
cp ../config-huge-2.6.29.6 .config
nano -w Makefile
change EXTRAVERSION = .6
to EXTRAVERSION = .6-1

Configure the kernel:

linux32 make oldconfig
linux32 make menuconfig

Enter Power Management and ACPI options
Unselect ACPI Support and * APM BIOS support
Go into APM BIOS support and * Enable PM at boot time
Back 1 level and go into CPU Frequency scaling
Unselect CPU Frequency scaling
Exit and save

Build the kernel and modules:

linux32 make bzImage && linux32 make modules

Insert the modules:

linux32 make modules_install INSTALL_MOD_PATH=tempmodules

Copy the modules directory and 3 files to a flash drive:

cp -r tempmodules/lib/modules/2.6.29.6-1 /media/usb
cp arch/i386/boot/bzImage (rename to vmlinuz-2.6.29.6-1)
cp System.map (rename to System.map-2.6.29.6-1)
cp .config (rename to config-2.6.29.6-1)

Now I unmount the flash drive and put it in my smaller Slackware 13 x86 laptop:

Copy modules directory to /lib/modules
Copy vmlinuz-2.6.29.6-1, System.map-2.6.29.6-1 and config-2.6.29.6-1 to /boot
cd /boot
ln -s System.map-2.6.29.6-1 System.map

Edit lilo with pico -w /etc/lilo.conf and add this:

image=/boot/vmlinuz-2.6.29.6-1
label=linux-apm
root=/dev/hda1
read-only


Exit and save
lilo
reboot

Then in the boot screen I choose linux-apm
Another screen appears with this:

Loading linux-apm.........................................
BIOS data check successful

Then the screen goes blank.

Last edited by linuxhippy; 10-14-2009 at 01:27 PM.
 
Old 10-14-2009, 02:55 PM   #14
linuxhippy
Senior Member
 
Registered: Sep 2004
Location: Philadelphia, PA
Distribution: Xubuntu, Mythbuntu, Lubuntu, Picuntu, Mint 18.1, Debian Jessie
Posts: 1,207

Original Poster
Rep: Reputation: 47
I just realized links in /lib/modules/2.6.29.6-1 get messed up when you don't do make modules_insert on the target pc. This would probably mess up the boot process. Is there a quick way to fix these links?
 
Old 10-14-2009, 08:17 PM   #15
plasmonics
Member
 
Registered: Jan 2009
Distribution: Fedora, Gentoo, LFS
Posts: 224

Rep: Reputation: 69
There are two soft links under /lib/modules/<my version>, "build" and "source". As far I know, they are only for book keeping purposes. They are not used at run time.

The source directory is only needed if you want to build drivers, e.g., nvidia or certain wireless modules. After those modules have been built, the source can be deleted.

The entire make and cp sequence can be replaced by one command:
make targz-pkg
Then after un-tarring it on the target machine, only the symlink and lilo sequences need to be done.

When you do this process in the labourious manual way, keep in mind that /lib/modules/<my version> is not the only place that "make modules_install" installs files. Check out /lib/firmware.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
The kernel source directory i missing uffe2 Linux - Wireless Networking 2 01-20-2008 06:27 PM
Kernel Source directory? Needed to install software jd5646 Fedora 7 09-24-2006 12:20 PM
How to install/create kernel source directory in RH acrors Red Hat 4 08-10-2004 03:37 AM
where is linux source build directory/kernel source tree? webazoid Linux - Software 2 07-01-2004 08:37 PM
where is my kernel source directory? Veivann Linux - Newbie 3 02-19-2004 03:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration