Script: softice-osc-uml

From SOFTICE

Jump to: navigation, search
#!/bin/bash 

# expectations
# ubd0 should be the root file system 
# ubd1 should be a small virtual device containing kernel sources
#      it will be mounted on /usr/src/linux 
# ubd6 should be a small virtual device containing configuration scripts 
#      it will be mounted on /mnt/config 
#      this script is part of what will be on /mnt/config/init/softice-osc-uml 
#      we take care of fixing couple of things at each boot to ensure all 
#      bugs are documented and make it easier for others to create their own rfs images


cd /mnt/config/ 

# /etc/bashrc

         # copy the bashrc to /root/.bashrc 
         cp ./etc/bashrc /root/.bashrc


# /etc/fstab

         # mounting user account 
         mkdir /root/SOFTICE-USER-ACCOUNT/ 
         mount none /root/SOFTICE-USER-ACCOUNT/ -t hostfs -o `cat /mnt/config/username.dat`

         # mounting the kernel sources 
         mount /dev/ubd1  /usr/src/linux  -o ro 
         
         # see also the /mnt/config/etc/fstab for a reference on what you /etc/fstab 
         # in the rfs should look like 


# /usr/local/bin 
         
         # copying all executables we need to add in the uml image 

         cp ./bin/* /usr/local/bin/


# Bugfix: /lib/tls 
         
         # we check that /lib/tls is renamed into something else 

         # not doing so leads to some bugs as early as lab#01 (system calls tinkering)
         # the forkban lkm will load / unload perfectly but the fork function won't 
         # display information when fork is invoked. You will also get in the dmesg 
         # some error message indicating that line_write_room complains about 
         # "no room left in buffer" 

         if [[ -d /lib/tls ]]
         then 
             mv /lib/tls /lib/tls.notwithuml
         fi