commit f80e51f7c36ba4b77b8ebb58af7aa4fee0a1d58b Author: Kees Jongenburger Date: Tue Mar 20 22:25:50 2012 +0100 Added an autoinstalled for minix 3.2 on qemu. diff --git a/README b/README new file mode 100644 index 0000000..8bab84f --- /dev/null +++ b/README @@ -0,0 +1,5 @@ +Miscellaneous MINIX3 related code. + + +The first project is about automated installation of MINIX on qemu +see projects/autoinstall/README diff --git a/projects/autoinstall/.gitignore b/projects/autoinstall/.gitignore new file mode 100644 index 0000000..4c35347 --- /dev/null +++ b/projects/autoinstall/.gitignore @@ -0,0 +1,6 @@ +# +#artifacts downloaded or created +# +*.img +*.bz2 +*.iso diff --git a/projects/autoinstall/Makefile b/projects/autoinstall/Makefile new file mode 100644 index 0000000..31cdbf5 --- /dev/null +++ b/projects/autoinstall/Makefile @@ -0,0 +1,20 @@ +default:minix.base.8g.img + +minix_R3.2.0-116fcea.iso.bz2: + wget http://www.minix3.org/iso/minix_R3.2.0-116fcea.iso.bz2 + md5sum -c minix_R3.2.0-116fcea.iso.bz2.md5 + + +# +# unzip the bz2 +# +%.iso:%.iso.bz2 + bunzip2 -k $< + + +# +# +# @TODO make the script more configurable +minix.base.8g.img:script/02_qemu_minix_base.install.expect minix_R3.2.0-116fcea.iso + script/02_qemu_minix_base.install.expect + mv minix.tmp.img minix.base.8g.img diff --git a/projects/autoinstall/README b/projects/autoinstall/README new file mode 100644 index 0000000..c998601 --- /dev/null +++ b/projects/autoinstall/README @@ -0,0 +1,25 @@ +The scripts in this directory perform an automated install of +MINIX R3.2.0 on a qemu instance. it "uses" the qemu curses +feature to screen scape the display and use the expect program +to interact with the system. + +The main goal currently is to perform an automated install +for test automation purposes. + +Running: + type make + +After that you can start the image using + qemu -hda minix.base.8g.img + + +@TODO: +* Improve the expect scipt to allow passing of arguments. +* Perform automated building of system packages. The image is +currently 8G and this is large enough to install pkgsrc +* Add some automated tests for the fun of it. +* Add more testing +* The current system currently uses the qemu curses to interact +with. way better would be to make the serial line the main +console. I did not figure out how to do this in the kernel and +bootloader. diff --git a/projects/autoinstall/script/02_qemu_minix_base.install.expect b/projects/autoinstall/script/02_qemu_minix_base.install.expect new file mode 100755 index 0000000..10a33bf --- /dev/null +++ b/projects/autoinstall/script/02_qemu_minix_base.install.expect @@ -0,0 +1,128 @@ +#!/usr/bin/expect -f +# +# Script to perform unattended install of minix on qemu +# +# +# required: qemu , expect and minix_R3.2.0-116fcea.iso in the current directory +# sha1sum 127e79c76538b8066dbcf549b246be1f22a986e7 +# +set timeout 30 + + +# Remove the previous install +exec rm -rf minix.tmp.img + +# Create a new empty raw qemu image +exec qemu-img create minix.tmp.img 8G + + +# Spawn qemu using the curses front-end and start interacting with it +spawn qemu -hda minix.tmp.img -cdrom minix_R3.2.0-116fcea.iso -boot d -curses + +#pass past the bootloader +expect "1. Regular MINIX 3" { + send "1\n" +} + +#wait for the kernel to be booted and a shell to be spawned +expect "minix login:" { + send "root\n" +} + +expect "#" { + send "setup\n" +} + + +#expect +#Welcome to the MINIX 3 setup script. This script will guide you in setting up +#MINIX on your machine. Please consult the manual for detailed instructions. +# +#Note 1: If the screen blanks, hit CTRL+F3 to select "software scrolling". +#Note 2: If things go wrong then hit CTRL+C to abort and start over. +#Note 3: Default answers, like [y], can simply be chosen by hitting ENTER. +#Note 4: If you see a colon (:) then you should hit ENTER to continue. + +expect "Note 4: If you see a colon (:) then you should hit ENTER to continue." { + send "\n" +} + +# Keyboard type? [us-std] +# TODO Fix escape sequence . how does this work in TCL? +expect "Keyboard type? " { + send "\n" +} +# Press ENTER for automatic mode, or type 'expert': +# TODO Fix escape sequence +expect "Press ENTER for automatic mode, or type " { + send "\n" +} + +# +#expect "--- Substep 3.1: Select a disk to install MINIX 3 ---------------------" {} + +#Enter the disk number to use: [0] +expect "Enter the disk number to use" { + send "\n" +} + +#Enter the region number to use or type 'delete': [0] +expect "Enter the region number to use or type" { + send "\n" +} + +#--- Substep 3.3: Confirm your choices --------------------------------- +# +#This is the point of no return. You have selected to install MINIX 3 +#into region 0 of disk /dev/c0d0. Please confirm that you want +#to use this selection to install MINIX 3. +# +#Are you sure you want to continue? Please enter 'yes' or 'no': +expect "Are you sure you want to continue" { + send "yes\n" +} +#How big do you want your /home to be in MB (0-1623) ? [324] +expect "How big do you want your /home to be" { + send "\n" +} + +# 324 MB Ok? [Y] +expect "MB Ok?" { + send "\n" +} +#Block size in kilobytes? [4] +expect "Block size in kilobytes?" { + send "\n" +} +set timeout 600 +# Ethernet card? +expect "Ethernet card?" { + send "\n" +} +#Configure network using DHCP or manually? +# +# 1. Automatically using DHCP +# 2. Manually +# +# Configure method? [1] +expect "Configure method?" { + send "\n" +} + +#Please type 'shutdown' to exit MINIX 3 and reboot. To boot into your new +#system, you might have to remove installation media. +# +# This ends the MINIX 3 setup script. After booting your newly set up system, +# you can run the test suites as indicated in the setup manual. You also +# may want to take care of local configuration, such as securing your system +# with a password. Please consult the usage manual for more information. +# +# +# # + +expect "with a password. Please consult the usage manual for more information." { + send "shutdown\n" +} +expect "Choose an option; RETURN for default; SPACE to stop countdown." + +