How to manually build an initrd for ESX 3.5

notes came from here:

http://communities.vmware.com/thread/116768

Hi,

i managed to get my ESX3.5 to boot and run on a HP ML 115.

onboard raid: yes, this “raid” really sucks, because my rescue cd found 2 controllers/disks -> NO RAID

TODO-List to get ESX-3.5 up and running.

1.) install it from the cd (of course)

2.) reboot with a linux live cd of your choice.

and now i hope that there are no typos…because i created this “script” on my laptop during i tried and tested it on my ESX box!

mkdir /mnt/eboot
mkdir /mnt/eroot

1. /boot of ESX box

mount /dev/sda1 /mnt/eboot

1. /root of ESX box

mount /dev/sda2 /mnt/eroot

mkdir /mnt/eroot/tmp/initrd
mkdir /mnt/eroot/tmp/initrd/extracted
mkdir /mnt/eroot/tmp/initrd/extractednew

cp /mnt/eboot/boot/initrd-2.4.21-47.0.1.ELvmnix.img /mnt/eroot/tmp/initrd

cd /mnt/eroot/tmp/initrd
mv initrd-2.4.21-47.0.1.ELvmnix.img initrd-2.4.21-47.0.1.ELvmnix.img.gz
gunzip initrd-2.4.21-47.0.1.ELvmnix.img.gz
mount initrd-2.4.21-47.0.1.ELvmnix.img extracted -o loop

cd extracted
cd etc/vmware
cp simple.map simple.map.org

vi simple.map
2nd go for SED!

search for 037e
double this line
change one 037e to 037f
save

cd ..
cd ..

dd if=dev/zero of=initrd.img bs=1k count=97000
mke2fs -i 1024 -b 1024 -m 5 -F -v initrd.img

mount initrd.img extractednew -t ext2 -o loop

tar -C extracted/ -cmf – . | tar -C extractednew/ -xmf – .

1. umount initrd.img

umount extracted
umount extractednew

gzip -best initrd.img
ls -alh
mv initrd.img.gz initrd.img

cd /mnt/eboot
mv initrd-2.4.21-47.0.1.ELvmnix.img initrd-2.4.21-47.0.1.ELvmnix.img.org
cp /mnt/eroot/tmp/initrd/initrd.img initrd-2.4.21-47.0.1.ELvmnix.img

cd /mnt/eroot
cd etc
cd vmware

cp pci.ids pci.ids.org
vi pci.ids
2nd go for SED!

search for 037e
double this line
change one 037e to 037f
save

cp pci.xml.merged pci.xml.merged.org
vi pci.xml.merged
2nd go for SED!

search for 037e
double this SECTION
change one 037e to 037f
save

cd pciid
cp sata_nv.xml sata_nv.xml.org
vi sata_nv.xml
2nd go for SED!

search for 037e
double this SECTION
change one 037e to 037f
save

reboot from your resuce system into ESX and JUCHEEEEE….

kind regards,

Reinhard

________________________________________________________________________________________

#!/bin/bash

vmware esx initrd changer
#/bin/bash
Reinhard Partmann
date created: 2007-12-17
date modified: 2007-12-17
version: 0.2
echo “creating directories…”
mkdir -p /mnt/eboot
mkdir -p /mnt/eroot

echo “mounting..”
mount /dev/sda1 /mnt/eboot
mount /dev/sda2 /mnt/eroot
mount | grep sda

echo “copying original initrd file…”
mkdir -p /mnt/eroot/tmp/initrd/extracted
cp /mnt/eboot/initrd-2.4.21-47.0.1.ELvmnix.img /mnt/eroot/tmp/initrd/initrd-2.4.21-47.0.1.ELvmnix.img.gz
cd /mnt/eroot/tmp/initrd

echo “unpacking & mounting original initrd file…”
gunzip -f initrd-2.4.21-47.0.1.ELvmnix.img.gz
mount initrd-2.4.21-47.0.1.ELvmnix.img extracted -t ext2 -o loop
cd extracted
cd etc
cd vmware

echo “changing simple.map…”
echo “10de:037f 0000:0000 sata_nv.o” >> simple.map

cd ..
cd ..
cd ..

umount extracted
echo “replacing original initrd file…”
gzip –best initrd-2.4.21-47.0.1.ELvmnix.img
mv /mnt/eroot/tmp/initrd/initrd-2.4.21-47.0.1.ELvmnix.img.gz /mnt/eboot/
cp /mnt/eboot/initrd-2.4.21-47.0.1.ELvmnix.img.gz /mnt/eboot/initrd-2.4.21-47.0.1.ELvmnix.img

echo “patching xml files”

cd /mnt/eroot/etc/vmware/pciid
lines=`wc -l sata_nv.xml | awk ‘ { print $1 } ‘`
echo “lines: $lines”
(( lines -= 2))
echo “subtr lines: $lines”
mv sata_nv.xml sata_nv.xml.org
head -$lines sata_nv.xml.org > sata_nv.xml

echo ” ” >> sata_nv.xml
echo ” ” >> sata_nv.xml
echo ” sata_nv” >> sata_nv.xml
echo ” ” >> sata_nv.xml
echo ” MCP55 SATA Controller” >> sata_nv.xml
echo ” ” >> sata_nv.xml
echo ” ” >> sata_nv.xml
echo “” >> sata_nv.xml

touch /mnt/eroot/etc/init.d/rp-esxcfg-pciid-boot
echo “#!/bin/bash” >> /mnt/eroot/etc/init.d/rp-esxcfg-pciid-boot
echo “esxcfg-pciid” >> /mnt/eroot/etc/init.d/rp-esxcfg-pciid-boot
echo “sleep 5” >> /mnt/eroot/etc/init.d/rp-esxcfg-pciid-boot
echo “rm /etc/rc3.d/S99rp-esxcfg-pciid-boot” >> /mnt/eroot/etc/init.d/rp-esxcfg-pciid-boot
chmod a+x /mnt/eroot/etc/init.d/rp-esxcfg-pciid-boot
cd /mnt/eroot/etc/rc3.d/
ln -s ../init.d/rp-esxcfg-pciid-boot S99rp-esxcfg-pciid-boot

echo “cleanup…”
cd /
rm -f -r /mnt/eroot/tmp/initrd
umount /mnt/eboot
umount /mnt/eroot
rm -f -r /mnt/eboot
rm -f -r /mnt/eroot]]>

[ad#ad-1]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.