LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 04-30-2013, 02:38 PM   #1
annim
LQ Newbie
 
Registered: Apr 2013
Posts: 1

Rep: Reputation: Disabled
Lightbulb Compilation of kernel from source code: Running into mess.


Hi

i am a student, new to linux kernel compiling, starting from scratch. I hope this is the correct place to put such kind of questions.

What i am trying to do is:
1.Compiling Linux kernel From source code.
---this in turn compiles the kernel and also the initramfs file.
2. Compile modules.
---but want to put in other drive.
3.Hence a newly installed linux OS, a new entry in boot loader.
4.All above shall be carried out in Debian based Ubuntu Distro.

Putting in a comprehensive manner:

i want to compile the kernel from its source and want to put that in other drive
and also want to put the initramfs along with the /etc/modules filees to other drive
hences forming a whole new OS standing seperated from the HOST OS.



Clarifying the above by providing an example:
--Host OS: Ubuntu
-----------------/dev/sda1
--------------------------/ (Only root and everything mounted with repstec to /)
|
|
|
|---Kernel is been compiled on this OS.
|
|
|---Now put the kernel image, initramfs, modules folder to
--------/dev/sda2
-----------------/(pre-ready root mountable)

--
Now add new entry to Booot loader for this new OS



issues:---
--How to put /etc/modules to /dev/sda2 while making modules_install
--How to install grub in /dev/sda2 , so i will be erasing /dev/sda1 althou the grub will be over /dev/sda .
--Wanted to make a Debian based system(kernel).


What i have tried-
---- Compiling linux kernel
-----------make menuconfig
-----------make(got error: out of space:How much HDDspace required? am i suppose to provide more than 10 GB?)
-----------make modules(not performed due to above error)
-----------make modules_install ( this is the point where i want to get modules to /dev/sda2)(am i correct?).
-----------(manually cp the generated kernel image to /dev/sda2
-----------(manually copying initrd files to /dev/sda2)(am i correct?).

is this correct---?
-Put kernel image file in /dev/sda2/boot/
-Put initrd file in /dev/sda2/boot/

----Lastly am i missing something..?
----Whats System.map files is and what for it is?


i hope i have presented a fair scenario of what i am trying to do !!!

Links, descriptions, books, refferences, further readings, instructions are appriciated!!!
 
Old 04-30-2013, 04:22 PM   #2
cyent
Member
 
Registered: Aug 2001
Location: ChristChurch New Zealand
Distribution: Ubuntu
Posts: 273

Rep: Reputation: 48
An easier / better way may be to use a Ubuntu Kernel source package and use that. It is essentially a scripted "build and package a kernel for distribution".
 
Old 04-30-2013, 11:37 PM   #3
smedley76
LQ Newbie
 
Registered: Oct 2012
Posts: 11

Rep: Reputation: Disabled
i am sure you will find compilng the kernel much easier by following this nifty guide

Last edited by smedley76; 04-30-2013 at 11:38 PM. Reason: type-o, mispelled kernel
 
Old 05-04-2013, 09:28 AM   #4
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,455

Rep: Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172Reputation: 1172
The word "shall" in the OP strongly implies that this is a homework assignment.

In any case, when compiling a kernel, I first of all, don't attempt to do that on any system whose kernel is designed to be maintained through the use of packages! Responsibility for maintaining the packages (source and binary) rests with the "distro" publisher, and I don't assume that the distributed source-code as installed on my system 100%-matches what the binaries (which work...!) contain.

When compiling a kernel, a hidden file called .config drives the process, and I always make multiple named backup copies of that file, placing them in a safe subdirectory within /root and write-protecting each one. I keep a distinct copy of every version that there has ever been of this file. (I also keep kernel-images and boot-loader configuration files there. All the files are not-hidden.

Finally, I keep a running log. "Captain's Log, Stardate 1234.5." What, exactly, did I do today. Why did I do it? What, exactly, messages appeared? And so on. A current copy of the log is copied into that same dated subdirectory, and write-protected along with all the other files. ("Trust the computer's RAM chips, but don't trust your memory." Especially as you get ... well, never mind!)

When compiling, I always recompile everything, every time, in a process that goes something like this:
  1. mv .config dont_lose_me
  2. make distclean
  3. mv dont_lose_me .config
  4. make ... make modules ... make (what have you)
  5. make install
  6. manually examine the "/boot" directory and boot-loader configuration files.
Steps 1-3 are the most important: after carefully saving the ".config" that would otherwise be destroyed in step 2, I cause everything to be reset to a "nothing has been compiled" state, then put the config file back. The remaining steps are then obliged to recompile every part of the system, including every module. In this way, it is very unlikely that I will "mix apples with oranges."

Last edited by sundialsvcs; 05-04-2013 at 09:35 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Package compilation for Mandriva RPM from Source code. How to do those??? jeevanism Mandriva 2 03-14-2011 03:44 AM
compilation error: something to do with finding the right kernel source directories? Gatemaze Linux - Kernel 4 06-15-2008 06:17 PM
Kernel module with multiple source files compilation problem Last Attacker Programming 7 05-06-2006 10:10 AM
does kernel-source installs with the compilation cum installtion of a new kernel? luqman Linux - General 18 03-04-2005 08:33 AM
Kernel Module compilation and running imransadat Programming 3 03-04-2005 07:56 AM


All times are GMT -5. The time now is 09:34 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration