How to Set Up ttylinux
under the Bochs Emulator
If you have not yet done so, please install the Bochs Emulator under your OS Platform. Although most of the following will apply only to those using Microsoft® Windows, some of this page will also be useful to those running a Linux distribution as well. To install Bochs, please see our How to Set Up and Run the Bochs Emulator page with dlxlinux, and be sure to download the ttylinux-virtio_i486-16.1.iso.gz file from the ttylinux web site.
The following assumes you already have BOCHS installed on your PC, and know how to navigate to its install location. On a Windows PC, this should be: "C:\Program Files\Bochs-2.6.2\" (or whatever current version of Bochs is installed as the folder name). Let's begin:
1. Create a new subfolder under your main Bochs install folder and label it: ttylinux.
2. Extract the ttylinux-virtio_i486-16.1.iso from the *.gz file into the ttylinux folder using 7-Zip, WinRAR or anything else that allows you to do so.
3. Copy the file "bochsrc.bxrc" from the dlxlinux folder under your Bochs install folder into the
ttylinux folder.
At this point, if you simply want to 'play around' with the console commands of ttylinux from its .ISO file, there's no need to create a new 180 MB disk image file under Bochs; simply edit the "bochsrc.bxrc" file you copied into this folder by 'commenting out' or deleting the "ata0-master..." line containing the dlxlinux "hd10meg.img" file, then follow only step numbers 9 - 11 and 13 - 16; you're finished. The .ISO file has fewer commands than the installed version, but is running on Linux kernel |
4. Copy the file "bximage.exe" from the main Bochs folder into the ttylinux folder.
5. Execute (double-click on) bximage.exe in the ttylinux folder.
6. Answer the questions it asks as follows ( YELLOW is what action to
take, and GREEN shows what we entered):
======================================================================== bximage Disk Image Creation Tool for Bochs $Id: bximage.c 11315 2012-08-05 18:13:38Z vruppert $ ======================================================================== Do you want to create a floppy disk image or a hard disk image? Please type hd or fd. [hd] Press ENTER key! What kind of image should I create? Please type flat, sparse or growing. [flat] Press ENTER key! Enter the hard disk size in megabytes, between 1 and 8257535 [10] 180 Type 180, then press ENTER key! I will create a 'flat' hard disk image with cyl=365 heads=16 sectors per track=63 total sectors=367920 total size=179.65 megabytes What should I name the image? [c.img] hda.img Type hda.img, then press ENTER key! Writing: [] Done. I wrote 188375040 bytes to hda.img. The following line should appear in your bochsrc: ata0-master: type=disk, path="hda.img", mode=flat, cylinders=365, heads=16, spt=63 (The line is stored in your windows clipboard, use CTRL-V to paste) Press any key to continue _ |
Note: Even though this image file is supposed to be created 'flat' its name and information often appear in a BLUE
font under a Windows OS, which may indicate a 'sparse' file type; that is, not all 180 MiB bytes are written to disk, but rather a much smaller file which
simply notes which small number of bytes (from 1 or more) it contains and where, since the much larger remaining portion is composed of only the zero bytes!
7. Open the file "bochsrc.bxrc" in a text editor (Windows users should be able to 'right-click' on the file name and
choose 'Edit' from the menu; opening the file in Notepad). Replace the "ata0-master..." line containing the dlxlinux
"hd10meg.img" file with:
ata0-master: type=disk, path="hda.img", mode=flat, cylinders=365,
heads=16, spt=63
And leave the file open.
8. Close the bximage.exe window after you've entered the stored line
(just in case it didn't store correctly).
9. Add the following line under the one you replaced above:
ata0-slave:
type=cdrom, path="ttylinux-virtio_i486-16.1.iso", status=inserted
10. Locate the "boot: c" line. Comment-out that
line and add one for a CD-ROM drive as shown here:
#boot: c
boot: cdrom
11. We'd also
recommend changing the first line (for the amount of available Memory) from "megs: 32" to "megs: 128".
12. Creating two blank floppy diskettes to use for saving data to and from the ttylinux disk drive image would also be recommended, before deleting
bximage.exe from the folder:
======================================================================== bximage Disk Image Creation Tool for Bochs $Id: bximage.c 11315 2012-08-05 18:13:38Z vruppert $ ======================================================================== Do you want to create a floppy disk image or a hard disk image? Please type hd or fd. [hd] fd Type fd, then press ENTER key! Choose the size of floppy disk image to create, in megabytes. Please type 0.16, 0.18, 0.32, 0.36, 0.72, 1.2, 1.44, 1.68, 1.72, or 2.88. [1.44] Press ENTER key! I will create a floppy image with cyl=80 heads=2 sectors per track=18 total sectors=2880 total bytes=1474560 What should I name the image? [a.img] Press ENTER key! (Change to b.img 2nd time through.) Writing: [] Done. I wrote 1474560 bytes to a.img. The following line should appear in your bochsrc: floppya: image="a.img", status=inserted (The line is stored in your windows clipboard, use CTRL-V to paste) Press any key to continue _ |
13. If you installed BOCHS under Windows and see the special 'bochs (box) icon' next to your *.bxrc file, then you
should be able to simply 'right-click' on the bochsrc.bxrc file and choose Run from the menu in order to start the Bochs Emulator;
otherwise copy the "run.bat" file from the "dlxlinux" folder into this one, and edit it appropriately,
such as:
cd "C:\Program Files\Bochs-2.6.2\ttylinux"
..\bochs -q -f bochsrc.bxrc
14. After the Bochs Emulator starts booting-up from the ttylinux CD, you should briefly see this screen:
15. Eventually, after displaying many lines about its progress and pausing for a while at some lines (such as "RAMDISK: gzip image found at block 0"), you should see the following (also REMEMBER that it is very common for the Bochs window to turn completely BLACK; that is, 'blank out'. Simply press a 'SHIFT' key if this happens!):
16. Enter root as the 'login name' and password as the 'password' and the CD will respond with:
"Chop wood, carry water." and a Unix/Linux prompt (#).
17. Entering "fdisk -l" (the l switch lists all partitions on a disk) at this command prompt will show there
are currently no partitions on the disk:
# fdisk -l Disk /dev/hda: 188 MB, 188375040 bytes 255 heads, 63 sectors/track, 22 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/hda doesn't contain a valid partition table |
Note: Even though Bochs created the disk image file using 365 cylinders having only 16 heads, this 'BusyBox' version of fdisk defaulted to using cylinders having 255 heads each (it also enforces cylinder boundaries, meaning a partition could only be created as a multiple of 512 bytes/sector x 63 sectors/head x 255 heads = 8,225,280 bytes), so attempting to set a partition to a capacity of 24 MiB (25,165,824 bytes) would result in one actually having 4 cylinders = 32,901,120 bytes (or about 31 MiB) because 3 cylinders would be too small (about 23.5 MiB). We can, however, adjust how fdisk functions, to create partitions using a geometry of only 16 heads per cylinder (see instructions below).
So we must create some partitions on the empty disk image first (later, the ttylinux install script will format the partitions according to how we set up its configuration file). At the command prompt, enter "fdisk /dev/hda". And ttylinux will respond with (you ENTER what's shown in the GREEN font and note or do what's shown in the YELLOW font):
# fdisk /dev/hda Device contains neither a valid DOS partition table, nor Sun, SGI, OSF or GPT di sklabel Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that the previous content won't be recoverable. Command (m for help): c (ENTER c to turn off DOS Compatibility.) DOS Compatibility flag is not set Command (m for help): x (ENTER x to access additional 'expert' commands.) Expert command (m for help): c (ENTER c to change number of cylinders.) Number of cylinders (1-1048576, default 22): 365 (ENTER 365.) Expert command (m for help): h (ENTER h to change number of heads.) Number of heads (1-256, default 255): 16 (ENTER 16.) Expert command (m for help):r (ENTER r to return to main menu.) Command (m for help): n (ENTER n to create a new partition.) Command action e extended p primary partition (1-4) p (ENTER 'p' to create a primary partition.) Partition number (1-4): 1 (ENTER a 1.) First cylinder (1-365, default 1): Press the ENTER key (to use '1')! Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-365, default 365): +24M (ENTER +24M.) Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 (ENTER a 2.) First cylinder (49-365, default 49): Press the ENTER key (to use '49')! Using default value 49 Last cylinder or +size or +sizeM or +sizeK (49-365, default 365): +32M (ENTER +32M.) Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 3 (ENTER a 3.) First cylinder (112-365, default 112): Press the ENTER key (to use '112')! Using default value 112 Last cylinder or +size or +sizeM or +sizeK (112-365, default 365): Press the Using default value 365 ENTER key! Command (m for help): p (ENTER 'p' to print summary of partition table.) Disk /dev/hda: 188 MB, 188375040 bytes 16 heads, 63 sectors/track, 365 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Device Boot Start End Blocks Id System /dev/hda1 1 48 24191+ 83 Linux /dev/hda2 49 111 31752 83 Linux /dev/hda3 112 365 128016 83 Linux Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table |
The "w" command tells fdisk to 'write' the partitions we created in memory to the disk image; and if you use fdisk
again with the "-l" (list all partitions) switch, you'll find it understands (from doing some math) that we are indeed
using a geometry of only 16 heads per cylinder. (Curiously, both the '+24M' and '+32M' commands resulted in partitions having only 48 cylinders;
so about 23.63 MiB, and 63 cylinders; so about 31.0 MiB, respectively. So it appeared to 'round down' on these two instead of 'up'.)
18. Enter the following command to view (use the Up and Down Arrow and Page keys while doing so) the contents of the ttylinux configuration
file; don't worry, we'll show every step of just a handful necessary to edit and use it below (we simply wanted you to see what was in the file before using
what will likely be the difficult for you to learn vi editor; the only one available on this .ISO file):
cat install.conf | less
19. Press the q (quit) key to stop viewing the file, and enter the following command (making
sure you do *not* do ANYTHING ELSE except what we list below, until told otherwise!):
vi install.conf
Use
the Up and Down Arrows keys in order to place the 'cursor' at the beginning of these lines:
_y x x 8M /dev/hda5 /tmp ext2 defaults 1 1 y x x 16M /dev/hda6 /usr/local ext3 defaults 1 1 y x x 16M /dev/hda7 /var ext3 defaults 1 1
This is 'line 50' which will appear as 50/207 in the status line at the bottom of the screen like this:
-
install.conf [Modified] 50/207 24%
Press the "i" key one time (and you will be in what's called 'insert' mode; you
should also see the '-' in the status line change to a capital 'I'). Type in a '#' character at the beginning of this line, then use the Left
and Down Arrow keys to type another '#' character at the beginning of lines 51 and 52 like this:
# y x x 8M /dev/hda5 /tmp ext2 defaults 1 1 # y x x 16M /dev/hda6 /usr/local ext3 defaults 1 1 # y x x 16M /dev/hda7 /var ext3 defaults 1 1
Using the Up and Right Arrow keys, place the 'cursor' at the "64M" of line 47, and change it to "125M". NOTE: The 'delete' key will often act like a 'Backspace' key, so do what you can under that condition. The finished line should look like this:
y x x 125M /dev/hda3 / ext3 defaults 1 1
Now if you wish, you can move down to line 70 and change the time zone (TZ) from 'MST' to whatever 3 characters you know stand for your
own time zone; e.g., 'PST' is 'Pacific Standard Time'. There's no need to change anything else, since Bochs cannot easily do networking (whereas both VMWare
and VirtualBox are great for connecting their virtual machines to the Internet through whatever current connection you have!).
Now press the ESC
key to exit 'insert' mode, and lastly ENTER the following command wherever the 'cursor' happens to be:
:wq
The ':' key enters a special command response, 'w' tells vi to write the changes to disk and 'q' quits the
vi editor. You can check on your changes using the cat command from above. If they're OK, you're ready to install ttylinux on
your disk image!
20. Enter the following command at the console prompt:
ttylinux-installer
--config=install.conf /dev/hdb
In the command above, '/dev/hdb' refers to the CD-ROM drive (the source); not to where we intend to install the
ttylinux OS, since that's already noted in the configuration file we edited. After entering the command above, you should see the following:
# ttylinux-installer --config=install.conf /dev/hdb Listing device partition format options: ...will format /dev/hda3 as ext3 ...will format /dev/hda2 as swap ...will format /dev/hda1 as ext3 Making file systems: -> mkfs.ext3 on /dev/hda3 -> mkswap on /dev/hda2 Setting up swapspace version 1, size = 32509952 bytes UUID=15fb943a-9f11-4868-8c7c-8b9166982c0e -> mkfs.ext3 on /dev/hda1 Mounting file systems: -> mount [ext3] /dev/hda3 at /tmp/ttylinux/targt/ -> mount [ext3] /dev/hda1 at /tmp/ttylinux/targt/boot i> Mounting ttylinux CD-ROM on /dev/hdb ... OK i> Installing ttylinux distribution packages. ***** Installing ttylinux-i486-16.1 => bash-4.2 => busybox-1.21.0 => dropbear-2013.58 => e2fsprogs-1.42.7 => glibc-2.9 => iptables-1.4.18 => lilo-23.2 => ncurses-5.9 => retawq-0.2.6c => thttpd-2.25b => ttylinux-basefs-1.0 => ttylinux-devfs-1.0 => ttylinux-utils-1.5 i> Installing ttylinux distribution data [/ttylinux] ... DONE i> Copying ttylinux kernel ....... OK i> Unmounting ttylinux CD-ROM on /dev/hdb ... OK i> Installing LILO boot loader. Warning: Unable to determine video adapter in use in the present system. Warning: Video adapter does not support VESA BIOS extensions needed for display of 256 colors. Boot loader will fall back to TEXT only operation. Added ttylinux * 2 warnings were issued. -> umount /dev/hda1 from /tmp/ttylinux/targt/boot -> umount /dev/hda3 from /tmp/ttylinux/targt/ i> Installation complete. |
21. Use the command "shutdown -h" to shut down and halt this running Bochs emulation.
More will be posted in the near future... this page
is still Under Construction !!!
If you need any help in setting up the Bochs Debugger,
please email us.
First Published: July 28, 2013 (28.07.13).
Last Update: July 29, 2013 (29.07.2013).
You can write to me using this:
online reply form.
(It opens in a new window.)
The Starman's x86 ASSEMBLY Pages
The Starman's Realm Index Page