Compilation of kernel from source code: Running into mess.
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
--------------------------/ (Only root and everything mounted with repstec to /)
|---Kernel is been compiled on this OS.
|---Now put the kernel image, initramfs, modules folder to
-----------------/(pre-ready root mountable)
Now add new entry to Booot loader for this new OS
--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(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!!!
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".
i am sure you will find compilng the kernel much easier by following this nifty guide
The word "shall" in the OP strongly implies that this is a homework assignment. :tisk:
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 ... :hattip: well, never mind!)
When compiling, I always recompile everything, every time, in a process that goes something like this:
|All times are GMT -5. The time now is 03:55 AM.|