Reply To: HowTo: vmware-tools in ZeroShell

Home Page Forums Network Management ZeroShell HowTo: vmware-tools in ZeroShell Reply To: HowTo: vmware-tools in ZeroShell

#50097

jbo5112
Member

Thank you very much for this help. Adding the vmware modules isn’t very difficult if you know how to compile a kernel (you don’t even have to configure it). You’ll just have to find a full Linux distribution with a compatible GCC. I’m running 1.0.beta13, which uses GCC 4.3.2 and kernel 2.6.25.20. It requires another i386 (32-bit x86) linux distribution with GCC 4.3.x. The last number indicates a bug fix and is almost always binary compatible. Once you have a distribution with a compatible GCC, you compile/install the same kernel that zeroshell uses, reboot, install vmware-tools, and copy the modules to zeroshell. I apologize if this guide is a little incoherent, it’s getting quite late.

Creating Build Environment
I created a virtual machine with a minimal Ubuntu 9.04 server with the packages GCC and make installed and as many virtual CPU’s as I have real CPU cores. Next I downloaded the specific zeroshell kernel source from kernel.org (2.6.25.20) to the folder /usr/src on the Ubuntu server, by finding the specific, local url with a web browser then using that as an argument to ‘wget’ (e.g. “wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.25.20.tar.bz2“).

Compiling the Kernel
(note: should be replaced with the kernel version used e.g.: 2.6.25.20)
Unpack this by running the command “tar jxf linux-.tar.bz2 && ln -sf linux- linux”, and then run “cd linux” to change to the new folder. We now need the kernel configuration from zeroshell. Copy the file /proc/config.gz on the zeroshell machine to the newly created folder on your module build machine using whatever method you want. I copied it to and from network storage on a 3rd machine using sftp.

On the module build machine (in the /usr/src/linux folder, which now contains config.gz), run “gunzip config.gz && mv config .config && make -j4 bzImage && cp arch/i386/boot/bzImage /boot/vmlinuz- && make -j4 modules && make -j4 modules_install”. This will take several minutes on a fast machine, and the ‘4’ in -j4 should be the number of CPU’s in your build machine.

Set up boot entry
Now you need to create a new initram image, which I was able to do with “update-initram -c -k “. Finally, unless you’re running grub2, you’ll need to edit “/boot/grub/menu.lst”. It needs an entry for your new kernel. The easiest way is to duplicate the first entry (which begins with the keyword “title”) and edit your new first entry. The vmlinuz and initrd file names need to be updated to reflect the names of your newly created files, which are both in the /boot directory. If you don’t know an editor, you can probably use mcedit, nano, pico, or joe. Here is my entry:

title           Ubuntu 9.04, kernel 2.6.25.20
uuid 77b2642d-59df-47dd-86c8-62590146519d
kernel /boot/vmlinuz-2.6.25.20 root=UUID=77b2642d-59df-47dd-86c8-62590146519d ro quiet splash
initrd /boot/initrd.img-2.6.25.20
quiet

Build vmware modules
Once you save the file and quit the editor, you’re ready to reboot (the command is “reboot”) and install the vmware-tools package. The new entry is probably now your default, but you may need to select it from the boot list. Install the vmware-tools normally. The new kernel modules will be located in /lib/modules//misc and need to be copied to your modules folder on zeroshell (/Database/rootfs/modules). Run the command “cd /lib/modules/ && tar jcf misc.tar.bz2 misc”. This will generate a file misc.tar.bz2, which needs to be copied to the same kernel module folder on zeroshell (/Database/rootfs/modules//) and extracted (“tar jxf misc.tar.bz2”).

Installing vmware-tools also modified some of the files in /lib/modules/2.6.25.20, which I didn’t copy over to zeroshell. However, I’m not sure if it’s safe to copy them over to zeroshell. I didn’t check to see if the files on Ubuntu matched what is on Zeroshell before I installed vmware-tools, and I’m too tired to do this again. Without these changes, the modules aren’t properly installed, but they’re still perfectly usable. If the forum lets me edit this, I’ll check into copying the other files over and update this.

The modules will need to be loaded as part of the boot script. Here’s my updated script to actually load the modules:

!/bin/bash
mount -o remount,rw /

unlink /usr && /cdrom/usr/bin/ln -s /Database/rootfs/usr /usr
unlink /sbin && ln -s /Database/rootfs/sbin /sbin
unlink /lib/modules && ln -s /Database/rootfs/modules /lib/modules

cp -a /Database/vmware-tools/scripts/etc/* /etc

for f in /lib/modules/2.6*/misc/*.o; do
insmod "$f"
done

/Database/vmware-tools/etc/init.d/vmware-tools start
/etc/init.d/netconfig restart

Are there any plans to merge this into the vmware download, so it’s all pre-installed? At some point, I can clean up the installation and submit a tar of the necessary files to go on the virtual disk (assuming that is legal and there is somewhere to submit them). It would help if I understood the zeroshell boot process better. I don’t know that I’ll be available for much maintenance, but I try to do things well enough that no one gets that job.

Is there any reason that you put the vmware-tools in a separate folder from everything in rootfs?