Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] How to make a Initramfs image?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Gen_Too
n00b
n00b


Joined: 17 May 2011
Posts: 24

PostPosted: Wed May 18, 2011 3:07 pm    Post subject: [SOLVED] How to make a Initramfs image? Reply with quote

How could i make an Initramfs image for grub?

Thank you.


Last edited by Gen_Too on Wed May 18, 2011 7:22 pm; edited 2 times in total
Back to top
View user's profile Send private message
avx
Advocate
Advocate


Joined: 21 Jun 2004
Posts: 2152

PostPosted: Wed May 18, 2011 3:13 pm    Post subject: Reply with quote

Depends on what you need to have inside it. There's genkernel-stuff, mkinitrd, dracut and of course, you can do it by hand.

I've always done mine myself, it's not that complicated, but you learn something and have full control, so that in case something breaks, you don't have to understand the tool's magic.

Basics for doing it by hand:
- create a folder
- in there create the needed folder structure (dev, etc, bin, sbin, lib, ...)
- build busybox with the options you want/need and install it into the created folder
- populate the folder with statically linked programs you need, for example cryptsetup, udevadm, gpg, ...
- write an init-script, place it in the topdir, make it executable
- add devicenodes, if needed
- pack the whole folder using cpio and gzip
- done
_________________
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10589
Location: Somewhere over Atlanta, Georgia

PostPosted: Wed May 18, 2011 3:15 pm    Post subject: Reply with quote

The easiest way is to use Gentoo's genkernel package (sys-kernel/genkernel). See the Gentoo Linux Genkernel Guide and the Handbook, Chapter 10: Configuring the Bootloader, Code Listing 2.4: grub.conf for genkernel users.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
Gen_Too
n00b
n00b


Joined: 17 May 2011
Posts: 24

PostPosted: Wed May 18, 2011 3:24 pm    Post subject: Reply with quote

I think i explained bad. Ive an initramfs image and i get a new kernel. do i need to do a new initramfs image for grub and howto?
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10589
Location: Somewhere over Atlanta, Georgia

PostPosted: Wed May 18, 2011 3:29 pm    Post subject: Reply with quote

Do you mean, "How do I tell grub about this initramfs that I have?" If so, then see the code listing that I referenced from the Handbook. If that's not what you mean, then could you explain further, please?

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
Gen_Too
n00b
n00b


Joined: 17 May 2011
Posts: 24

PostPosted: Wed May 18, 2011 4:10 pm    Post subject: Reply with quote

I will explain again.

1. I dont know very much about this things, im new in gentoo and why not, in linux too.
2. I only now how to copy the kernel image to /boot.
3. I dont know nothing about Initramfs and the info in Google is a bit unhuman for my experience.

Now ill explain what have i done. I installed Gentoo. Then, i got a new kernel, copiled it and copied to /boot.

The question is: Now what have i to do with Initramfs???
Back to top
View user's profile Send private message
avx
Advocate
Advocate


Joined: 21 Jun 2004
Posts: 2152

PostPosted: Wed May 18, 2011 4:16 pm    Post subject: Reply with quote

Ok, since you are new, let me ask you this: Are you even sure you need an initrd? It's not that really everyone need one, in fact, most people don't. So if you think you do, tell us what purpose your initrd is for, that makes it easier to help you.
_________________
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Back to top
View user's profile Send private message
Gen_Too
n00b
n00b


Joined: 17 May 2011
Posts: 24

PostPosted: Wed May 18, 2011 4:50 pm    Post subject: Reply with quote

I dont know what is it. Maybe it means i dont need one.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10589
Location: Somewhere over Atlanta, Georgia

PostPosted: Wed May 18, 2011 4:52 pm    Post subject: Reply with quote

Is your system booting on its own? If so, please post the kernel line(s) from your /boot/grub/grub.conf file. That'll tell us if you need an initramfs or not.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
Gen_Too
n00b
n00b


Joined: 17 May 2011
Posts: 24

PostPosted: Wed May 18, 2011 5:03 pm    Post subject: Reply with quote

Yes, ive it added to grub by default
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10589
Location: Somewhere over Atlanta, Georgia

PostPosted: Wed May 18, 2011 5:07 pm    Post subject: Reply with quote

Sorry; what I meant to as was, could you show us exactly what the "kernel" line in your /etc/grub/grub.conf file looks like? For example, mine looks like this:
Code:
kernel /boot/vmlinuz root=/dev/sda3
- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
Gen_Too
n00b
n00b


Joined: 17 May 2011
Posts: 24

PostPosted: Wed May 18, 2011 5:38 pm    Post subject: Reply with quote

Its not well configured. Im not using a genkernel config:

# This is a sample grub.conf for use with Genkernel, per the Gentoo handbook
# http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=10#doc_chap2
# If you are not using Genkernel and you need help creating this file, you
# should consult the handbook. Alternatively, consult the grub.conf.sample that
# is included with the Grub documentation.

default 0
timeout 30
splashimage=(hd0,0)/boot/grub/splash.xpm.gz

title Gentoo Linux 2.6.37-r4
root (hd0,0)
kernel /boot/kernel-genkernel-x86_64-2.6.37-gentoo-r4 root=/dev/sda3
initrd /boot/initramfs-genkernel-x86_64-2.6.37-gentoo-r4
title Gentoo Linux 2.6.37-r4 (Rescate)
root (hd0,0)
kernel /boot/kernel-genkernel-x86_64-2.6.37-gentoo-r4 root=/dev/sda3 init=/bin/bb
initrd /boot/initramfs-genkernel-x86_64-2.6.37-gentoo-r4

# vim:ft=conf:
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10589
Location: Somewhere over Atlanta, Georgia

PostPosted: Wed May 18, 2011 5:43 pm    Post subject: Reply with quote

Hmm. You say that you are not using genkernel, but your grub.conf files shows a genkernel-generated kernel. Now I'm confused. Did you build your kernel with genkernel?

Note for ease of reading, it's nice to put code and configuration files inside [code] tags.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
Gen_Too
n00b
n00b


Joined: 17 May 2011
Posts: 24

PostPosted: Wed May 18, 2011 6:16 pm    Post subject: Reply with quote

I say that because i used genkernel at first but im configuring it manually right now
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10589
Location: Somewhere over Atlanta, Georgia

PostPosted: Wed May 18, 2011 6:26 pm    Post subject: Reply with quote

Well, two comments:
  • First, if you configure manually, like this
    Code:
    cd /usr/src/linux
    make menuconfig
    and then you compile it manually, like this
    Code:
    make
    make modules_install
    then, the resultant kernel is not named "kernel-genkernel-x86_64-2.6.37-gentoo-r4". In other words, no matter what you're doing with your manual kernel build, you don't yet have grub set up to launch your manually configured and built kernel. What is the name of the kernel in /boot that you manually built?
  • Second, your current grub.conf is not using the initramfs that is mentioned there, so that answers your initial question. You do not need an initramfs.
- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
avx
Advocate
Advocate


Joined: 21 Jun 2004
Posts: 2152

PostPosted: Wed May 18, 2011 6:26 pm    Post subject: Reply with quote

Gen_Too wrote:
I say that because i used genkernel at first but im configuring it manually right now
Do you (plan to) use anything not standard, ie. luks, mdadm/special RAID-controller, etc.? If not, then you won't really need an initrd.

Mine for example is just used, since I have fulldisk encryption running and I've got a minimal rescue system in there.
_________________
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Back to top
View user's profile Send private message
Gen_Too
n00b
n00b


Joined: 17 May 2011
Posts: 24

PostPosted: Wed May 18, 2011 7:11 pm    Post subject: No Reply with quote

Quote:
then, the resultant kernel is not named "kernel-genkernel-x86_64-2.6.37-gentoo-r4". In other words, no matter what you're doing with your manual kernel build, you don't yet have grub set up to launch your manually configured and built kernel. What is the name of the kernel in /boot that you manually built?


You are in error. Its only the name that says "genkernel", but i overwritted my own kernel to that with TAB (i said it hasnt configured well).

Thank you all very much!
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10589
Location: Somewhere over Atlanta, Georgia

PostPosted: Wed May 18, 2011 7:28 pm    Post subject: Re: No Reply with quote

Gen_Too wrote:
...
You are in error.
...
Well, I'm glad you were able to straighten me out. :wink:

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
kipas_angin
n00b
n00b


Joined: 08 Oct 2011
Posts: 3

PostPosted: Mon Oct 10, 2011 4:22 pm    Post subject: Reply with quote

well, it seems that this problem is quite the same as mine, but i think it's not solved yet,

here's the situation, i'm a baby-born to linux, just about a month using ubuntu and trying gentoo for my long lasting os

first, i've followed all the handbook intructed, and getting my sistem ready for first boot. the problem start after myself-compiled kernel extracted
it cannot enter the desktop like when i use live DVD. my screen just showing a message :"this is cacaa.unknown_domain (linux i686 2.6.39-gentoo-r3)"
FYI, cacaa is my localhost name, and my user that i've created after setting root's passwd (chapter 8.c on the handbook), i name my compiled kernel by gentoo, not linux i686 2.6.39-gentoo-r3

i thought that was my kernel problem, so i rebuilt it with genkernel. this time the log says error :"* ERROR: Could not copy the initramfs image to /boot!"
i've no idea of what is initramfs, and what it's used for.
FYI, i set my /boot on another partition which 7.4MiB harddrive.
the question is:
1 may my sistem could start without initramfs?
2 or if it has to have initramfs, should i resize my /boot?
3 is there any solution so i can resize my windows partition and /boot partition without making me to log in to windows first? because in fdisk there is no option for it.
Back to top
View user's profile Send private message
gerard27
Advocate
Advocate


Joined: 04 Jan 2004
Posts: 2377
Location: Netherlands

PostPosted: Mon Oct 10, 2011 5:46 pm    Post subject: Reply with quote

Slamet kipas_angin,
When you use genkernel and want to copy the kernel and initramfs to boot you should have boot mounted.
Initramfs contains modules needed to boot your system.
I suggest using rescuecd to install or repair the system.My sig contains a link where you can d/l it.
It also has tools to shrink Windows.Remember to defragment Windows first.
Gerard.
_________________
To install Gentoo I use sysrescuecd.Based on Gentoo,has firefox to browse Gentoo docs and mc to browse (and edit) files.
The same disk can be used for 32 and 64 bit installs.
You can follow the Handbook verbatim.
http://www.sysresccd.org/Download
Back to top
View user's profile Send private message
kipas_angin
n00b
n00b


Joined: 08 Oct 2011
Posts: 3

PostPosted: Mon Oct 10, 2011 6:41 pm    Post subject: Reply with quote

actually i've mounted /boot on my sistem, but it full.
when i'm making /boot partition, i've choose 5GB actually, but fdisk says that i don't have that much space, actually i have 50GB empty space, but i can't set 5GB for /boot partition, is there any partition size limit for the primary drive? all i know, the limit was for 4 primary partition, not for it size.
allright, I'd rather to defrag and shrink my windows partition from windows itself, so i do not lose any of my data.
thank you for your advice
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum