What's Service OS (SOS)
Service OS is small Linux os which resides on USB/SDHC or hard disk partition. It can boot
target platform individually. By combined with specific script upon, it can achieve various
of purposes. Typical usage is on automated testing system, help do image auto-installation,
HW health check.
Create SOS file system
Root file system of SOS can be gotten from any Linux Distros - Fedora, Ubuntu, MeeGo, etc. Below is a way to create SOS root filesystem from MeeGo
mic-image-creator --record-pkgs=name -P $prefix -S $suffix -c ./sos.ks -f loop --cache=./mycache
- File system is in loop image file, do some tweaks before tarball
Mount fs: mount -o loop ${prefix}-meego-${suffix}.img $pmnt
Adjust run level: sed -i 's/id:5/id:3/' $pmnt/etc/inittab
Create grub configure file based on kernel and initrd under /boot
Create bootable SOS image
Assuming we have gotten root file system in last section as rootfs.tgz
dd if=/dev/zero of=$IMGFILE bs=512 count=$SECTORS
- Associate the image to free loop device
losetup $loopdev $IMGFILE
- Create a partition and its mapping
- Format the partition
mkfs.ext3 /dev/mapper/$part_name
- Copy whole root file system into image
mount /dev/mapper/$part_name $pmnt
tar vxf $FS -C $pmnt/
grub --batch --no-floppy <<EOF
device (hd0) $loopdev
root (hd0,0)
setup --stage2=$pmnt/boot/grub/stage2 (hd0)
EOF
- A bootable image is done.
dd if=serviceos.IMG of=/dev/[USBDevice]