diff options
-rwxr-xr-x | meta/recipes-bsp/grub/grub-2.00/40_custom | 2 | ||||
-rw-r--r-- | meta/recipes-core/initrdscripts/files/init-install.sh | 62 |
2 files changed, 30 insertions, 34 deletions
diff --git a/meta/recipes-bsp/grub/grub-2.00/40_custom b/meta/recipes-bsp/grub/grub-2.00/40_custom index ba488308b6..f891b02779 100755 --- a/meta/recipes-bsp/grub/grub-2.00/40_custom +++ b/meta/recipes-bsp/grub/grub-2.00/40_custom | |||
@@ -5,5 +5,5 @@ exec tail -n +3 $0 | |||
5 | # the 'exec tail' line above. | 5 | # the 'exec tail' line above. |
6 | menuentry "Linux" { | 6 | menuentry "Linux" { |
7 | set root=(hd0,1) | 7 | set root=(hd0,1) |
8 | linux /boot/vmlinuz root=__ROOTFS__ rw __CONSOLE__ __VIDEO_MODE__ __VGA_MODE__ quiet | 8 | linux /vmlinuz root=__ROOTFS__ rw __CONSOLE__ __VIDEO_MODE__ __VGA_MODE__ quiet |
9 | } | 9 | } |
diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh index c892075145..8e433d5eda 100644 --- a/meta/recipes-core/initrdscripts/files/init-install.sh +++ b/meta/recipes-core/initrdscripts/files/init-install.sh | |||
@@ -145,29 +145,32 @@ mkfs.ext3 $rootfs | |||
145 | echo "Formatting swap partition...($swap)" | 145 | echo "Formatting swap partition...($swap)" |
146 | mkswap $swap | 146 | mkswap $swap |
147 | 147 | ||
148 | mkdir /ssd | 148 | mkdir /tgt_root |
149 | mkdir /rootmnt | 149 | mkdir /src_root |
150 | mkdir /bootmnt | 150 | mkdir -p /boot |
151 | |||
152 | mount $rootfs /ssd | ||
153 | mount -o rw,loop,noatime,nodiratime /media/$1/$2 /rootmnt | ||
154 | 151 | ||
152 | # Handling of the target root partition | ||
153 | mount $rootfs /tgt_root | ||
154 | mount -o rw,loop,noatime,nodiratime /media/$1/$2 /src_root | ||
155 | echo "Copying rootfs files..." | 155 | echo "Copying rootfs files..." |
156 | cp -a /rootmnt/* /ssd | 156 | cp -a /src_root/* /tgt_root |
157 | 157 | if [ -d /tgt_root/etc/ ] ; then | |
158 | if [ -d /ssd/etc/ ] ; then | 158 | echo "$swap swap swap defaults 0 0" >> /tgt_root/etc/fstab |
159 | echo "$swap swap swap defaults 0 0" >> /ssd/etc/fstab | 159 | echo "$bootfs /boot ext3 defaults 1 2" >> /tgt_root/etc/fstab |
160 | |||
161 | # We dont want udev to mount our root device while we're booting... | 160 | # We dont want udev to mount our root device while we're booting... |
162 | if [ -d /ssd/etc/udev/ ] ; then | 161 | if [ -d /tgt_root/etc/udev/ ] ; then |
163 | echo "/dev/${device}" >> /ssd/etc/udev/mount.blacklist | 162 | echo "/dev/${device}" >> /tgt_root/etc/udev/mount.blacklist |
164 | fi | 163 | fi |
165 | fi | 164 | fi |
165 | umount /tgt_root | ||
166 | umount /src_root | ||
166 | 167 | ||
168 | # Handling of the target boot partition | ||
169 | mount $bootfs /boot | ||
170 | echo "Preparing boot partition..." | ||
167 | if [ -f /etc/grub.d/40_custom ] ; then | 171 | if [ -f /etc/grub.d/40_custom ] ; then |
168 | echo "Preparing custom grub2 menu..." | 172 | echo "Preparing custom grub2 menu..." |
169 | GRUBCFG="/bootmnt/boot/grub/grub.cfg" | 173 | GRUBCFG="/boot/grub/grub.cfg" |
170 | mount $bootfs /bootmnt | ||
171 | mkdir -p $(dirname $GRUBCFG) | 174 | mkdir -p $(dirname $GRUBCFG) |
172 | cp /etc/grub.d/40_custom $GRUBCFG | 175 | cp /etc/grub.d/40_custom $GRUBCFG |
173 | sed -i "s@__ROOTFS__@$rootfs $rootwait@g" $GRUBCFG | 176 | sed -i "s@__ROOTFS__@$rootfs $rootwait@g" $GRUBCFG |
@@ -177,31 +180,24 @@ if [ -f /etc/grub.d/40_custom ] ; then | |||
177 | sed -i "/#/d" $GRUBCFG | 180 | sed -i "/#/d" $GRUBCFG |
178 | sed -i "/exec tail/d" $GRUBCFG | 181 | sed -i "/exec tail/d" $GRUBCFG |
179 | chmod 0444 $GRUBCFG | 182 | chmod 0444 $GRUBCFG |
180 | umount /bootmnt | ||
181 | fi | 183 | fi |
182 | 184 | grub-install /dev/${device} | |
183 | umount /ssd | 185 | echo "(hd0) /dev/${device}" > /boot/grub/device.map |
184 | umount /rootmnt | ||
185 | |||
186 | echo "Preparing boot partition..." | ||
187 | mount $bootfs /ssd | ||
188 | grub-install --root-directory=/ssd /dev/${device} | ||
189 | |||
190 | echo "(hd0) /dev/${device}" > /ssd/boot/grub/device.map | ||
191 | 186 | ||
192 | # If grub.cfg doesn't exist, assume GRUB 0.97 and create a menu.lst | 187 | # If grub.cfg doesn't exist, assume GRUB 0.97 and create a menu.lst |
193 | if [ ! -f /ssd/boot/grub/grub.cfg ] ; then | 188 | if [ ! -f /boot/grub/grub.cfg ] ; then |
194 | echo "Preparing custom grub menu..." | 189 | echo "Preparing custom grub menu..." |
195 | echo "default 0" > /ssd/boot/grub/menu.lst | 190 | echo "default 0" > /boot/grub/menu.lst |
196 | echo "timeout 30" >> /ssd/boot/grub/menu.lst | 191 | echo "timeout 30" >> /boot/grub/menu.lst |
197 | echo "title Live Boot/Install-Image" >> /ssd/boot/grub/menu.lst | 192 | echo "title Live Boot/Install-Image" >> /boot/grub/menu.lst |
198 | echo "root (hd0,0)" >> /ssd/boot/grub/menu.lst | 193 | echo "root (hd0,0)" >> /boot/grub/menu.lst |
199 | echo "kernel /boot/vmlinuz root=$rootfs rw $3 $4 quiet" >> /ssd/boot/grub/menu.lst | 194 | echo "kernel /vmlinuz root=$rootfs rw $3 $4 quiet" >> /boot/grub/menu.lst |
200 | fi | 195 | fi |
201 | 196 | ||
202 | cp /media/$1/vmlinuz /ssd/boot/ | 197 | cp /media/$1/vmlinuz /boot/ |
198 | |||
199 | umount /boot | ||
203 | 200 | ||
204 | umount /ssd | ||
205 | sync | 201 | sync |
206 | 202 | ||
207 | echo "Remove your installation media, and press ENTER" | 203 | echo "Remove your installation media, and press ENTER" |