User FAQ
From WhitixDoc
Frequently asked questions by users, generally on the user mailing list, are answered here.
Is Whitix just another Linux?
No. It's a custom operating system developed for the desktop user.
How do I mount a harddisk/harddisk partition after I boot from cd image using Bochs emulator?
If you have bochs installed, you can follow these steps ...
- Create a hd image using bximage (this image creater comes with bochs)
- bximage
It will ask you easy questions, just follow the questions you will get output like...
ata0-master: type=disk, path="c.img", mode=flat, cylinders=20, heads=16, spt=63
Note the Cylinders,heads and Sector per track(spt). Save the above line, this will be usefull in editing bochsrc.txt(You get this bochs configuration file when you download Whitix).Note path="c.img" in output line, this is the default image name given by bximage, you can change it also its upto you. I am assuming c.img as default and using it in below examples.
- Partition The Image (c.img)
- fdisk c.img
- x ( go to expert mode)
- c (change cylinder number; this will be 20 as reported by the bximage output)
- h (change heads number; this will be 16 as reported by the bximage output)
- s (change sectors per track; this will be 63 as reported by the bximage output)
- r (return to main menu)
- n (create a primary partition)
- u (switch display units)
- p (print the partition you have just created;Note the Start value (63 in my case) it may be different but very unlikely)
- w (commit the changes and exit)
- For the Partition you have just Created format it with mkfs.ext3
- losetup -o 32256 /dev/loop0 c.img ( the value 32256 is(512 times Start Sector number we got in bullet 9) that is 512 * 63 = 32256
- mkfs.ext3 /dev/loop0
- losetup -d /dev/loop0
- Edit your bochsrc.txt
- ata0 is your cdrom leave it as it is to point to cd.iso.
- ata1 will be your harddisk(c.img).Copy verbatim the output of bximage(Create a hd image using bximage from above) into bochsrc.txt.The snippit output is below.
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=cdrom, path="cd.iso", status=inserted, biosdetect=auto, model="Generic CDROM drive"
ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
ata1-master: type=disk, path="c.img", mode=flat, cylinders=20, heads=16, spt=63
- Boot Whitix and mount the partition
After Whitx is booted ...
- cd system/devices/Storage
- ls ( here you should see HardDriveC and HardDriveC0. HardDriveA is your cdrom. HardDriveC is your c.img and HardDriveC0 is the first primary partition. We will mount HardDriveC0.)
- mount /system/devices/Storage/HardDriveC0 /mount
- ls /mount ( to check you ext filesystem)
How do I add my own userspace programs? Give me an example.
Internals of hosted and freestanding environment is documented under Porting Software. Here is the demonstration using small example of how this can be done. We will be using "test" as an sample userspace program which we want to add. Here we go.
Download Whitix source. Your Downloaded Source should look like below. Notice the user folder.
# ls arch Boot.modules devices kernel Makefile out.txt tags video Authors cd.iso fs kernel.txt make.inc screen test.c bochsrc.txt CdRoot include lib memory Session.vim todo.txt bochsrc.txt.bk c.img kern link.ld net .svn user
Move inside user folder
cd user
Create a folder test ( our example is based on this name )
mkdir test
Copy this Makefile template under just created test folder. Note the "APPS = test" assignment. In case you want to rename your porgram differently, this line needs to be changed.
CFLAGS = -Wall -O2 -fomit-frame-pointer -fno-builtin -nostdinc -I../libc/include -I../sdk/include -fno-stack-protector -m32 APPS = test .c.o: $(CC) $(CFLAGS) -c $*.c -o $*.o OBJS = main.o build: $(OBJS) gcc -m32 -nodefaultlibs -nostdlib -L../libc -L../posix -lpthread -L../sdk/libs ../libc/init/init.o $(OBJS) -lconsole -lstdc -Wl,-I,/System/Runtime/liblinker.so -o $(APPS) clean: rm -rf *.o rm -rf $(APPS) install: cp -av $(APPS) ../../CdRoot/Applications
Finally your main program.
#include <stdio.h>
int
main(){
printf("Five Fourteen\n");
return 0;
}
Now, you need to make sure your binary is included in the CdRoot/Applications folder when Whitix is booted. Under user folder edit Makefile to include your program name.
install: #System $(MAKE) -C libc install $(MAKE) -C linker install $(MAKE) -C sdk install $(MAKE) -C posix install $(MAKE) -C burn install $(MAKE) -C fruity install $(MAKE) -C test install <--- YOUR PROGRAM WILL NOW BE AVAILABLE WHEN WHITIX BOOTS. $(MAKE) -C makefs install $(MAKE) -C xynth install $(MAKE) -C system install $(MAKE) ports_install
- This short article needs expansion or improvement. You can help by joining our documentation project.
| User manual > User FAQ |