1 |
On Sat, Sep 17, 2011 at 3:27 PM, Dale <rdalek1967@×××××.com> wrote: |
2 |
> Mark Knecht wrote: |
3 |
>> |
4 |
>> While I was out walking my dog I sort of remembered that there are |
5 |
>> just a few apps I had to build static, or at least that I build |
6 |
>> static. One, I think was grub. The first and only time I did it I had |
7 |
>> to do it 3 or 4 times before I got everything I needed working |
8 |
>> correctly. This page which is like the first one Google comes up with |
9 |
>> talks about that stuff, although you have to sort of dig it out and |
10 |
>> read between the lines. |
11 |
>> |
12 |
>> http://en.gentoo-wiki.com/wiki/Initramfs |
13 |
>> |
14 |
>> And, I think with the ldd command as long as you include the libraries |
15 |
>> ldd points at in your equivalent /lib directory within the initramfs |
16 |
>> then that works for most apps and keeps the initramfs smaller. |
17 |
>> |
18 |
>> HTH, |
19 |
>> Mark |
20 |
>> |
21 |
>> |
22 |
> |
23 |
> I think there are only a few that has that flag, at least that I would put |
24 |
> in the init thingy anyway. Maybe this is something that the devs will work |
25 |
> on if it can be done. May be a big if there. |
26 |
> |
27 |
> That is the guide I am trying to go by but I think I am missing something. |
28 |
> This is the script they have posted: |
29 |
> |
30 |
> #!/bin/busybox sh |
31 |
> |
32 |
> # Mount the /proc and /sys filesystems. |
33 |
> mount -t proc none /proc |
34 |
> mount -t sysfs none /sys |
35 |
> |
36 |
> # Do your stuff here. |
37 |
> echo "This script mounts rootfs and boots it up, nothing more!" |
38 |
> |
39 |
> # Mount the root filesystem. |
40 |
> mount -o ro /dev/sda1 /mnt/root |
41 |
> |
42 |
> # Clean up. |
43 |
> umount /proc |
44 |
> umount /sys |
45 |
> |
46 |
> # Boot the real thing. |
47 |
> exec switch_root /mnt/root /sbin/init |
48 |
> |
49 |
> That doesn't really make much sense to me. First it mounts the stuff then |
50 |
> umounts it right after that. Huh? Is the relevant part the "mount -o ro |
51 |
> /dev/sda1 /mnt/root" ? Then the exec switch_root part after that? The rest |
52 |
> seems to cancel each other out. |
53 |
> |
54 |
> Looking forward to that light bulb moment here. ;-) |
55 |
> |
56 |
> Dale |
57 |
|
58 |
Yup, that's what it does... ;-) |
59 |
|
60 |
As you know, I'm a user type, not a sys admin or anything like that, |
61 |
so I have no real training in how the Linux initialization process |
62 |
really works. It's my uninformed opinion that the kernel in the early |
63 |
stages needs /proc and /sys to basically run. I don't know what it |
64 |
does with them but they need to be mounted so that the kernel can see |
65 |
them. Remember, this isn't necessarily the same as what we see within |
66 |
those directories once we really boot, it's just something for the |
67 |
kernel to use for a while. The kernel does what it needs to do, then |
68 |
unmounts them and lets things proceed. |
69 |
|
70 |
If it helps here's an init file from the one I did to figure my mdadm |
71 |
RAID boot problems here: |
72 |
|
73 |
c2stable / # cat /usr/src/initramfs/init |
74 |
#!/bin/busybox sh |
75 |
|
76 |
rescue_shell() { |
77 |
echo "Something went wrong. Dropping you to a shell." |
78 |
busybox --install -s |
79 |
exec /bin/sh |
80 |
} |
81 |
|
82 |
|
83 |
# Mount the /proc and /sys filesystems. |
84 |
mount -t proc none /proc |
85 |
mount -t sysfs none /sys |
86 |
|
87 |
# Do your stuff here. |
88 |
echo "This script mounts rootfs and boots it up, nothing more!" |
89 |
|
90 |
mdadm --assemble --name=c2stable:3 /dev/md3 |
91 |
|
92 |
# Mount the root filesystem. |
93 |
mount -o ro /dev/md3 /mnt/root || rescue_shell |
94 |
|
95 |
# Clean up. |
96 |
umount /proc |
97 |
umount /sys |
98 |
|
99 |
# Boot the real thing. |
100 |
exec switch_root /mnt/root /sbin/init |
101 |
c2stable / # |
102 |
|
103 |
If I remember correctly I couldn't figure out what the right dev |
104 |
number was at the time, so I built the initramfs without the mdadm |
105 |
command, then used mdadm commands within the initramfs process using |
106 |
the busybox shell. When I figured it out I used the updated init file |
107 |
to prove it worked. |
108 |
|
109 |
That could all be wrong - it was over a year ago - but that's what I |
110 |
remember. Adding the busybox part at the top - the rescue shell part - |
111 |
was REALLY useful. |
112 |
|
113 |
HTH, |
114 |
Mark |