Skip to contentSkip to conversation

create an initrd for dom0 in install.sh script

RFC PATCH In review Harry Butterworth 3 participants 5 messages Mar 30, 2006

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 create an initrd for dom0 in install.sh script

The attached patch creates an initrd for dom0 during execution of the install.sh script when the installation is being performed to the root directory.

I chose the initrd name to correspond with the documentation in the README file in the dist directory.

It works for me on my ubuntu x86_64 installation but it's untested on anything else. I'm guessing that this stuff is probably very distro specific so it probably not a good idea to actually apply this patch until it has been tested on some other distros etc.

I'm guessing that the initrd created for dom0 in general won't work for domU domains. I'm not sure what to do about that.

Also my script-fu is weak so even what little is here could probably be better.

Harry.

# HG changeset patch
# User [email protected]
# Node ID 7d648c1099b21f36de09acf5481122ceaeb1fde4 # Parent 9239f190736d85933bbe64eca0613c24c07617df Create an initrd for dom0 in the install script.

install.sh +1 -0
diff -r 9239f190736d -r 7d648c1099b2 install.sh
@@ -44,6 +44,18 @@
 (cd $tmp; tar -cf - *) | tar --no-same-owner -C "$dst" -xf -
 rm -rf "$tmp"
 
+if [ -x "$(which mkinitrd)" ] && [ -x "$(which depmod)" ] && [ $dst ==

'/' ]; then
+ cd $src/lib/modules
+ for i in *; do

+    echo " - creating initrd-$i.img for dom0"
+    depmod $i
+    mkinitrd -o $dst/boot/initrd-$i.img $i

+ done
+ cd -
+else
+ echo " - you may need to create an initrd for dom0" +fi
+
echo "All done."

echo "Checking to see whether prerequisite tools are installed..."
diff -r 9239f190736d -r 7d648c1099b2 linux-2.6-xen-sparse/arch/i386/boot-xen/Makefile
--- a/linux-2.6-xen-sparse/arch/i386/boot-xen/Makefile Wed Mar 29
23:11:53 2006
+++ b/linux-2.6-xen-sparse/arch/i386/boot-xen/Makefile Thu Mar 30
14:57:57 2006
@@ -19,3 +19,4 @@
install -m0664 .config
$(INSTALL_ROOT)/boot/config-$(XINSTALL_NAME)$(INSTALL_SUFFIX)
install -m0664 System.map
$(INSTALL_ROOT)/boot/System.map-$(XINSTALL_NAME)$(INSTALL_SUFFIX)
ln -f -s vmlinuz-$(XINSTALL_NAME)$(INSTALL_SUFFIX)
$(INSTALL_ROOT)/boot/vmlinuz-$(VERSION).$(PATCHLEVEL)$(XENGUEST)$(INSTALL_SUFFIX)
+ ln -f -s initrd-$(XINSTALL_NAME)$(INSTALL_SUFFIX).img
$(INSTALL_ROOT)/boot/initrd-$(VERSION).$(PATCHLEVEL)$(XENGUEST)$(INSTALL_SUFFIX).img

# HG changeset patch
# User [email protected]
# Node ID 7d648c1099b21f36de09acf5481122ceaeb1fde4 # Parent 9239f190736d85933bbe64eca0613c24c07617df Create an initrd for dom0 in the install script.

install.sh +12 -0
diff -r 9239f190736d -r 7d648c1099b2 install.sh
@@ -44,6 +44,18 @@
 (cd $tmp; tar -cf - *) | tar --no-same-owner -C "$dst" -xf -
 rm -rf "$tmp"
 
+if [ -x "$(which mkinitrd)" ] && [ -x "$(which depmod)" ] && [ $dst == '/' ]; then
+  cd $src/lib/modules
+  for i in *; do
+    echo " - creating initrd-$i.img for dom0"
+    depmod $i
+    mkinitrd -o $dst/boot/initrd-$i.img $i
+  done
+  cd -
+else
+  echo " - you may need to create an initrd for dom0"
+fi
+
 echo "All done."
 
 echo "Checking to see whether prerequisite tools are installed..."
linux-2.6-xen-sparse/arch/i386/boot-xen/Makefile +1 -0
diff -r 9239f190736d -r 7d648c1099b2 linux-2.6-xen-sparse/arch/i386/boot-xen/Makefile
@@ -19,3 +19,4 @@
 	install -m0664 .config $(INSTALL_ROOT)/boot/config-$(XINSTALL_NAME)$(INSTALL_SUFFIX)
 	install -m0664 System.map $(INSTALL_ROOT)/boot/System.map-$(XINSTALL_NAME)$(INSTALL_SUFFIX)
 	ln -f -s vmlinuz-$(XINSTALL_NAME)$(INSTALL_SUFFIX) $(INSTALL_ROOT)/boot/vmlinuz-$(VERSION).$(PATCHLEVEL)$(XENGUEST)$(INSTALL_SUFFIX)
+	ln -f -s initrd-$(XINSTALL_NAME)$(INSTALL_SUFFIX).img $(INSTALL_ROOT)/boot/initrd-$(VERSION).$(PATCHLEVEL)$(XENGUEST)$(INSTALL_SUFFIX).img

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 9 lines · Harry Butterworth

diff -r 9239f190736d -r 7d648c1099b2 linux-2.6-xen-sparse/arch/i386/boot-xen/Makefile
--- a/linux-2.6-xen-sparse/arch/i386/boot-xen/Makefile Wed Mar 29 23:11:53 2006
+++ b/linux-2.6-xen-sparse/arch/i386/boot-xen/Makefile Thu Mar 30 14:57:57 2006

(quoted diff) +1 -0
@@ -19,3 +19,4 @@
+       ln -f -s initrd-$(XINSTALL_NAME)$(INSTALL_SUFFIX).img

$(INSTALL_ROOT)/boot/initrd-$(VERSION).$(PATCHLEVEL)$(XENGUEST)$(INSTALL_SUFFIX).img

This certainly doesn't belong in this file.

christian

#2 lore raw

I put it there because that file is the one that creates the other symbolic links in /boot for the kernel images. Maybe they don't belong there either. I did think it was a bit weird that i386/boot-xen was creating symbolic links for the X86_64 build.

I could create the link in the install.sh script instead.

What do you think?

Quoted 20 lines · Christian Limpach
Quoted 9 lines · Harry Butterworth

diff -r 9239f190736d -r 7d648c1099b2 linux-2.6-xen-sparse/arch/i386/boot-xen/Makefile
--- a/linux-2.6-xen-sparse/arch/i386/boot-xen/Makefile Wed Mar 29 23:11:53 2006
+++ b/linux-2.6-xen-sparse/arch/i386/boot-xen/Makefile Thu Mar 30 14:57:57 2006

(quoted diff) +1 -0
@@ -19,3 +19,4 @@
+       ln -f -s initrd-$(XINSTALL_NAME)$(INSTALL_SUFFIX).img

$(INSTALL_ROOT)/boot/initrd-$(VERSION).$(PATCHLEVEL)$(XENGUEST)$(INSTALL_SUFFIX).img

This certainly doesn't belong in this file.

christian

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw
Quoted 3 lines · Harry Butterworth

I put it there because that file is the one that creates the other symbolic links in /boot for the kernel images. Maybe they don't belong there either.

The other links belong there because they create links of files which are created by the linux build. The initrd doesn't get created by the linux build, so creating a link for it doesn't belong there.

Quoted 2 lines

I did think it was a bit weird that i386/boot-xen was creating symbolic links for the X86_64 build.

It's not weird -- like many other i386 files, this file is re-used from the x86_64 build.

Quoted 1 line

I could create the link in the install.sh script instead.

yes please.

christian

#4 lore raw
In reply to Harry Butterworth
Quoted 11 lines · Harry Butterworth

diff -r 9239f190736d -r 7d648c1099b2 install.sh

install.sh Thu Mar 30 14:57:57 2006 renamed from install.sh Wed Mar 29 23:11:53 2006 +1 -0
@@ -44,6 +44,18 @@
 (cd $tmp; tar -cf - *) | tar --no-same-owner -C "$dst" -xf -
 rm -rf "$tmp"
 
+if [ -x "$(which mkinitrd)" ] && [ -x "$(which depmod)" ] && [ $dst ==

'/' ]; then

install.sh Thu Mar 30 14:57:57 2006 renamed from install.sh Wed Mar 29 23:11:53 2006 +2 -0
+  cd $src/lib/modules
+  for i in *; do

install.sh Thu Mar 30 14:57:57 2006

Quoted 10 lines
install.sh Thu Mar 30 14:57:57 2006 renamed from install.sh Wed Mar 29 23:11:53 2006 +9 -0
+    echo " - creating initrd-$i.img for dom0"
+    depmod $i
+    mkinitrd -o $dst/boot/initrd-$i.img $i
+  done
+  cd -
+else
+  echo " - you may need to create an initrd for dom0"
+fi
+
 echo "All done."

Could you move it to a seperate script which we call from install.sh? With multi-distro support it looks like it will become significantly bigger and it might also be convenient being able to call it independently anyway.

christian