Ne^'u ta.o mo^.t vu`ng o^? cu+'ng qua "fdisk" (vo+'i n(ew), p(artition #?), 1 ...) vo+'i "drive geometry" trong "host environment" thi` sao mi`nh kho^ng ta.o mo^.t vu`ng a?o trong "virtual environment" ? vi` vu`ng a?o na^`y, bie^?u hie^.n qua file "c.img" cu~ng "persistent across host booting"? "qemu -cdrom ScratchboxToolkit-2.3.iso -hda c.img 200m -m 250 -b d" Lo+.i ddie^?m la` tra'nh ga^y kho' kha(n cho users kho^ng co`n unallocated diskspace trong hard disks (dda so^' ngu+o+`i du`ng dde^`u va^.y!) Vu`ng a?o "c.img" (nhi`n theo hu+o+'ng cu?a "virtual machine" la` vu`ng o^? cu+'ng "tha^.t") ne^'u ddu+o+.c accessed by "qemu" qua la^`n boot sau!
Ki'nh cha`o! ---------------------------------------- > From: [EMAIL PROTECTED] > To: vietlug-users@lists.sourceforge.net > Date: Sun, 24 Sep 2006 22:40:09 +0200 > Subject: [Vietlug] đĩa ảo để khởi động với qemu > > Tui vừa tạo script cho phép tạo đĩa ảo,có 1 phân vùng,và có thể khởi động. > Sau đó cài đặt từ đĩa livecd dsl-xx.iso,thế là chạy được dưói dạng > qemu đĩa_ảo (cd ảo thì fải gọi qemu -cdrom cd_ảo !!!) > > I ve created a script allowing to build > a virtual_bootable_disk from livecd_iso.(A DSL_linux_image for qemu ) > The requirements from your pc are very little: > presence of /lib/grub/i386-pc/stage* grub stuffs, /mnt/test, > dsl-xx.iso any xx ,qemu > you run > 1 mkdslvdsk dslvdisk 200 > (to create a virtual disk of 200Mb with grub installed,and inside it I store > an install_script "instvdsk"to be used in the follow) > 2 invoke > qemu -m 256 -cdrom dsl-xx.iso -hdb dslvdisk > at boot: prompt ,login console with user_dsl to preserve resource > boot: dsl 2 > 3 #mount /dev/hdb1 /mnt/hdb1 && /mnt/hdb1/instvdsk > this will install to virtual disk from livecd .at the end of the process (# > prompt) > # umont /mnt/hdb1 > 4 exit qemu instance,and launch now > qemu dslvdisk (you now start bootup dsl_on virtual disk !) > have fun > I check my script on 3 differents partitions(ubuntu-6,kanotix-9 and a > homemade_scratchbox-toolkit,and it worked > but on another machine,I could not get a bootable vdsk !(damned fdisk,and > geometry c-h-s stuffs !) > > you need to run as root (because manipulations of virtual disk > (dd,losetup,mount...) > The script is very short,self explanatory;I do not do anything on > device,hdd.... > mkdslvdsk.sh > -------------------------------cut------- > #!/bin/bash > # excute: " mkdslvdsk vdsk 200 " to create a virtual vdsk 200Mb bootable. > #this script creates a virtual bootble_disk,with an install script "instvdsk" > in side the vdisk > #invoking "qemu -cdrom dsl-xx.iso -hdb vdsk" allows to install dsl_filesystem > to vdsk by doing > #" qemu -m -cdrom dsl-xx.iso -hdb vdsk" ;choose console boot: "dsl 2 " to > get > more resource > #mount /dev/hdb1 /mnt/hdb1 && /mnt/hdb1/instvdsk to install > #at the end,umount /mnt/hdb1 ;exit qemu instance > #On pc host now start another instance with virtual disk : qemu vdsk !!!! > partit() > { > echo "create a vdisk size $2 Mbytes partition 1" > #qemu-img create $1 $2 > cnt=`expr $2 \* 2000 ` > dd if=/dev/zero of=$1 bs=512 count=$cnt > > cy=`expr $cnt \/ 8258 ` > #/usr/bin/expr ( $2 \/ 4 ) > cyl > > echo "cyl= $cy" > fdisk -b512 -C $cy -H128 -S63 $1 << EOF > > n > > p > > 1 > > > > a > > 1 > > w > > EOF > } > fmtit() > { > echo " format ext2" > losetup -d /dev/loop0 2>&1 >/dev/null > losetup -o 32256 /dev/loop0 $1 > mke2fs /dev/loop0 > losetup -d /dev/loop0 > } > grubit() > { > mount -oloop,offset=32256 $1 /mnt/test > mkdir /mnt/test/boot > mkdir /mnt/test/boot/grub > > cp -a /lib/grub/i386-pc/stage* /mnt/test/boot/grub > > cat > /mnt/test/boot/grub/menu.lst << EOF > default 2 > title DSL > kernel /boot/linux24 root=/dev/hda1 quiet vga=normal noacpi noapm nodma > noscsi > frugal > init=/etc/init > title DSL fb800x600 > kernel /boot/linux24 root=/dev/hda1 quiet vga=788 noacpi noapm nodma noscsi > frugal > init=/etc/init > title DSL fb1024x768 > kernel /boot/linux24 root=/dev/hda1 quiet vga=791 noacpi noapm nodma noscsi > frugal > init=/etc/init > title DSL fb1280x1024 > kernel /boot/linux24 root=/dev/hda1 quiet vga=794 noacpi noapm nodma noscsi > frugal > init=/etc/init > > EOF > echo " (hd6) $1" > devmap > grub --batch --no-floppy --device-map=devmap <<EOF >log > root (hd6,0) > setup (hd6) > quit > EOF > umount /mnt/test > } > cr_isotohd() > { > mount -oloop,offset=32256 $1 /mnt/test > cat > /mnt/test/instvdsk << EOF > mv /mnt/hdb1/boot/grub/menu.lst /mnt/hdb1/boot/grub/menu.lst_org > cp -a /KNOPPIX/* /mnt/hdb1 > cp -f /mnt/hdb1/boot/grub/menu.lst_org /mnt/hdb1/boot/grub/menu.lst > cp /KNOPPIX/.bash* /mnt/hdb1 > cp /etc/fstab /mnt/hdb1/etc > echo " x5:5:wait:/etc/init.d/xsession start" >> /mnt/hdb1/etc/inittab > sed s/cp/#cp/ /mnt/hdb1/etc/init.d/xsession > xsession0 > mv -f xsession0 /mnt/hdb1/etc/init.d/xsession > chmod +x /mnt/hdb1/etc/init.d/xsession > cp /cdrom/boot/isolinux/linux24 /mnt/hdb1/boot > mkdir /mnt/hdb1/KNOPPIX > mkdir /mnt/hdb1/ramdisk > #this part was reminiscent of trying to keep as closely as possible to > dsl-xx.iso > #meaning just modify the menu.lst from (iso)/KNOPPIX/boot/grub/ > #cp /mnt/hdb1/boot/grub/menu.lst /mnt/hdb1/boot/grub/menu.lst_org > #sed s/hda2/hda1/g /mnt/hdb1/boot/grub/menu.lst > menuu > #sed s_initrd_init=/etc/init_g menuu > menuv > #sed s_/boot/minirt24.gz_ww_g menuv > menuw > #sed s/ww// menuw > menux > #cp -f menux /mnt/hdb1/boot/grub/menu.lst > cd /mnt/hdb1/KNOPPIX > ln -s ../bin bin > ln -s ../etc etc > EOF > chmod +x /mnt/test/instvdsk > umount /mnt/test > } > #main > partit $1 $2 > fmtit $1 > grubit $1 > cr_isotohd $1 > exit > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > VietLUG-users mailing list > VietLUG-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/vietlug-users _________________________________________________________________ Express yourself - download free Windows Live Messenger themes! http://clk.atdmt.com/MSN/go/msnnkwme0020000001msn/direct/01/?href=http://imagine-msn.com/themes/vibe/default.aspx?locale=en-us&source=hmtagline ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ VietLUG-users mailing list VietLUG-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vietlug-users