1 |
Am Donnerstag, 22. Februar 2007 schrieb ext Boyd Stephen Smith Jr.: |
2 |
|
3 |
> For the life of me, I always found it easier to get an initrd working |
4 |
> rather |
5 |
> than an initramfs -- the whole chroot/exec vs. pivot_root vs. switch_root |
6 |
> step always failed for me when using an initramfs (and the very same |
7 |
> shell script worked as an initrd). |
8 |
|
9 |
Here's what I use in my initramfs' linuxrc: |
10 |
|
11 |
# change roots |
12 |
echo "initramfs: Switching to real root volume" 2>&1 |
13 |
find -xdev / -exec rm '{}' ';' |
14 |
cd /newroot |
15 |
mount --move . / |
16 |
echo "initramfs: Starting init with options ${INIT_OPTS} ..." |
17 |
exec chroot . /bin/bash <<- EOF >/dev/console |
18 |
exec /sbin/init ${INIT_OPTS} |
19 |
EOF |
20 |
|
21 |
The only thing I didn't get to work so far is freeing the used space (that |
22 |
find command should do the job, but gives me som error msg). |
23 |
|
24 |
> Also, a script-made initrd is still |
25 |
> just a compressed filesystem, easy to deal with, but a script-made |
26 |
> initramfs (particularly one made by genkernel) is not just a cpio |
27 |
> archive, it's a series of them separated by some !!!!KERNEL_MAGIC!!!! |
28 |
> strings in the middle of binary data -- nearly impossible to work with |
29 |
> using standard tools. |
30 |
> |
31 |
> At least, that's been my experience, others may have found the process |
32 |
> easier. |
33 |
|
34 |
I just maintain /usr/src/initramfs which contains all the stuff that should |
35 |
go in, put the name of this directory into the kernel config |
36 |
(CONFIG_INITRAMFS_SOURCE="/usr/src/initramfs"), build the kernel. That's a |
37 |
very simple thing to do if you don't need to load any modules from within |
38 |
initramfs (I just do the evms_activate stuff) and will give you only one |
39 |
file to deal with. |
40 |
|
41 |
/usr/src/initramfs itself is filled by a self-constructed script prior to |
42 |
building a new kernel. |
43 |
|
44 |
Bye... |
45 |
|
46 |
Dirk |
47 |
-- |
48 |
Dirk Heinrichs | Tel: +49 (0)162 234 3408 |
49 |
Configuration Manager | Fax: +49 (0)211 47068 111 |
50 |
Capgemini Deutschland | Mail: dirk.heinrichs@×××××××××.com |
51 |
Hambornerstraße 55 | Web: http://www.capgemini.com |
52 |
D-40472 Düsseldorf | ICQ#: 110037733 |
53 |
GPG Public Key C2E467BB | Keyserver: www.keyserver.net |