The Noob Guide to Building Visopsys under Windows

General discussion about Visopsys.
Post Reply
User avatar
ap0r
Posts: 105
Joined: Tue Feb 14, 2012 12:40 am

The Noob Guide to Building Visopsys under Windows

Post by ap0r »

The Absolute n00b’s guide to compiling Visopsys under Windows, Version 1.6

So, you’ve found Visopsys. Cool little piece of software, huh? And it surely could use your awesome program or modification! Then you get hit in the face with those strange, fancy words like “CentOS”, “Gnu Make”, “NASM”, “GCC”, “Build from source”, "./install.sh -basic /dev/fd0“, and if you’re not a 1337 h4x0r and are instead an average Joe running Windows, you’re left with a feeling of “dude, wtf is this shit?”

But don’t despair, turns out it’s pretty simple actually, despite all the tech jargon. So onwards!

Things you will need:

*At least three and a half operating neurons. If you are reading this, you probably have them!
*A computer (o really?)
*Internet access (o really? X2)

Congratulations! Turns out you have pretty much everything you need!, so let's proceed!

First of all, this is a general set of steps, much like a resume of the process, and if you’re tech-minded, it’s probably the only thing you’ll need in order to sucessfully compile Visopsys under Windows. Scroll down below for more detailed instructions.

GENERAL STEPS:

*Download and install Vmware Player
*Create a new Linux compatible Virtual Machine
*Download the latest Xubuntu 32 bit edition (Probably will work with other 32 bit distros too)
*Install Xubuntu in the virtual machine.
*Install a C IDE (I use CodeBlocks)
*Install GNU G++ and GNU GCC.
*Install NASM.
*Get the Visopsys Source Code.
*Create, compile and test your C program, and include it on the source.
*Modify the makefile to include your program.
*Build the new Visopsys iso (including your modifications)by following the instructions in “Building.txt”, included in the source files.
*Boot or install Visopsys, and test your software!

DETAILED STEPS (ALTERNATIVE TITLE: "ENGAGE THE N00BMODE!

First of all, i am assuming some things:

*You already know that Google is your friend, wich means if you are stuck at some step or get an error, you will search the Interwebs for a solution before sending me hate mail like "YOUR A DISGUSTING SLIMY BITCH YOUR CRAPTORIAL MADE MY COMPUTER CATCH FIRE!!!!111!!!1"
*You know how to download files.
*You know your way around ISO files, know how to burn/mount one.
*You have at least a vague idea about C programming.
*You have at least a vague idea about Linux.
*Know compressed zip files, especially extracting them.

Woah, lots of assumptions, right? But don’t worry, if you don't understand something in this guide (a word, or a concept), just try Googling it, and if you still don’t have a clue, message me and i’ll do my best to help you.

Start here:

DOWNLOAD AND INSTALL VMWARE PLAYER:

*Open your favorite web browser, and point it to: https://my.vmware.com/web/vmware/free#d ... player/6_0
*Download VMWare Player for Windows.
*Open the Downloaded file, and proceed to install Vmware.
*Next.
*Accept the terms of the license.
*Next.
*Next.
*Don’t check for updates.
*Next.
*Next.
*Next.
*Continue.
*Finish.

DOWNLOAD, INSTALL AND RUN XUBUNTU:

*Download Xubuntu 32 bit Version 12.04 from Xubuntu.org, either with a torrent client (really fast) or from one of the mirrors listed on the site. Even if you have 64 bit capable hardware, you must use the 32 bit version.
*Open Vmware Player.
*Create a new Linux compatible Virtual Machine. Make sure to create it with as much RAM and HDD as you can, because you will be using this machine a lot.
*Set the Virtual CD-ROM drive to point at the Xubuntu ISO that you downloaded earlier.
*Install Xubuntu in the virtual machine, by following the onscreen instructions.
*Set the virtual machine to fullscreen mode. That is to avoid confusion, from now on all actions must be performed on the Xubuntu virtual machine, unless otherwise specified.
*That’s it, you’ve just installed Linux. Wasn’t that hard, was it?

INSTALL A C IDE:

*A C IDE is a piece of software that lets you edit the programs and most of the Visopsys source code. For this tutorial, we will be using CodeBlocks IDE.
*Go to the Applications Menu, (The Start-like button on the top left of the screen)
*Open Ubuntu Software Center.
*Search “Code Blocks IDE”
*Install CodeBlocks IDE, by following the onscreen instructions.
*Don’t start Codeblocks yet, proceed to the next step.
*Install GNU G++ and NASM (NASM and GNU G++ are a toolset that allows your computer to transform C code into machine code that Visopsys can understand and run.)
*Open Terminal with Ctrl + Alt + T or via Applications menu, Accesories, Terminal Emulator.
*Install NASM, by typing the comand "sudo apt-get install nasm"
*It will ask for your password.
*Once NASM is installed, do not close the terminal. Proceed to install GNU G++
*In the Terminal window, type "sudo apt-get install build-essential"
*It will ask for your password.
*Then it will tell you that it needs some disk space to continue, type "Y" (Yes), and hit Enter to continue.
*Wait until it finishes installing.
*Close the Terminal Window.

GET VISOPSYS SOURCE CODE:

*Go to http://visopsys.org/downloads.htm
*From the Quick Downloa-Links box, choose "Latest Source Code"
*Extract the source code to any folder. For this example, i’ll use /Desktop/visopsys/source

You now have pretty much everything you need to modify Visopsys, namely:

*The source code
*A way to edit the source code (Codeblocks IDE)
*Tools necessary to take those files and make them into Visopsys machine code (G++ & NASM)

CREATE, COMPILE AND TEST A C PROGRAM, AND INCLUDE IT ON THE SOURCE:

*This is supposed to be a tutorial about compiling visopsys, not a tutorial about programming, so just follow me step by step and search the Interwebs for tutorials on how to do C programming, and edit some of the programs already bundled with visopsys if you want to see examples. For the purposes of this document, we will add a simple “Hello World” program to Visopsys.
*Open CodeBlocks IDE that you installed earlier. (I hope you DID install it huh?)
*Set the GNU GCC as default compiler.
*File
*New
*Empty File
*Paste this code inside the new file:

Code: Select all

#include <errno.h>
#include <stdio.h>
#include <string.h>
int main(void)
{
printf("Hello World\n");
return (0);
}
Well, you've just created your first Visopsys Program!, and now let's save it.
*File -> Save
*Point the save dialog to the programs source folder. For this example, it will be: "/Desktop/visopsys/source/src/programs"
*You will notice there are already lots of programs, so let's choose a unique name for our program.
*Save it as "/Desktop/visopsys/source/src/programs/hello.c"
*Close CodeBlocks.

MODIFYING THE MAKEFILE TO INCLUDE YOUR NEW SOFTWARE:

*Makefile is a file that tells the compiler what C source programs to include when it's building the Visopsys machine code.
*In the earlier step, we saved our program in "/visopsys/source/src/programs/"
*Open that folder, you should see a lot of C files, including the "hello.c" file that we made earlier
*Now scroll down until you find a file named "Makefile"
*Double click this file, it should open on a Text Editor
*Scroll down to the section of the programs that are to be included, it should look like this:

Code: Select all

CNAMES = adduser \
bootmenu \
cal \
calc \
cat \
cdrom \
chkdisk \
etc. etc. etc.
*Add your program between two of the ones already in the list. It is not necessary to use alphabetical ordering. For example:

Code: Select all

CNAMES = adduser \
bootmenu \
cal \
hello \
calc \
cat \
cdrom \
chkdisk \
*File -> Save
*Exit the text editor, you are now ready to compile!

BUILD THE NEW VISOPSYS ISO FROM THE MODIFIED SOURCE CODE

*Open your source code folder. ("/Desktop/visopsys/source/", or wherever you downloaded the Visopsys source code)
*Right click on an empty space, much like if you were trying to create a new folder.
*Click "Open Terminal Here"
*It should say something like "username@machine name:~/Desktop/visopsys/source$
*Type "make"
*Hit Enter.
*If the command fails, make sure you typed it all lowercase, as Linux is case sensitive.
*Wait until the process is done, and keep an eye for any errors that might pop.
*Once it finishes, type "exit"
*Hit Enter.
*Check the source folder, you should have a new folder here called "build"

There is visopsys! Ready for bundling into an ISO file! Ain't it cute??? :animals-bunny:

*Now head to the visopsys/source/utils/ folder
*Right click on an empty space, much like if you were trying to create a new folder
*Click "Open Terminal Here"
*Type "sudo ./image-cd.sh -r"
*Hit Enter
*It will ask for your password, type your ubuntu account password and hit Enter again. You should see some text scroll by:

Code: Select all

Making Visopsys CD-ROM IMAGE file
- doing RELEASE version 0.73

Making/copying boot floppy image... Done
Copying build files... Done
Copying doc files... Done
Creating ISO image... Done
Archiving... Done
File is: visopsys-0.73-iso.zip
*Once it finishes, type "exit"
*Hit Enter
*Now, inside the /visopsys/source/utils/ folder, you should have a file named accordingly.
*Extract the Visopsys-iso.zip file anywhere you like.

Congratulations, you now have a Visopsys disc ISO that includes everything you need. Now you can burn that iso to a CD-ROM, copy it to a USB drive, etc

Finally, boot from this ISO like you would from a regular Visopsys ISO downloaded from the site and test your software!
Run or install Visopsys, head to the "Command Window" icon and type "Hello", without the quotes, then hit Enter.

You're done! Now nothing stops you from conquering the world, or improving that little "hello" program! The limit, as usual, is your imagination!


The End

Changelog:
1.0: Original doc.
1.2: Fix grammar and spelling and punctuation.
1.3: Add missing section and minor spelling fixes
1.4: Fixed spelling, punctuation. Removed Torrent as a requisite (you can download Xubuntu without using Torrent)
1.5: Added emphasis on the use of 32 bit Linux, and simplified the installation of NASM and G++. Simplified the "Hello World" program. Improved general format.
1.6: Added clarification on some concepts. Modified the source-code obtaining process to make it resemble the website.
Last edited by ap0r on Wed Feb 12, 2014 2:54 am, edited 5 times in total.
Image
Image
User avatar
andymc
Posts: 589
Joined: Tue Nov 16, 2010 7:20 pm

Re: The Noob Guide to Building Visopsys under Windows

Post by andymc »

This is great ap0r, thanks!

One small thing - it's missing the part about modifying the Makefile

This will be really useful for people to get started.
User avatar
ap0r
Posts: 105
Joined: Tue Feb 14, 2012 12:40 am

Re: The Noob Guide to Building Visopsys under Windows

Post by ap0r »

How strange, i typed that!

Edit: I remember typing it but i wasn't able to find it on the original document :/ So i just retyped it and updated the original doc, forum post and changelog.
Image
Image
User avatar
andymc
Posts: 589
Joined: Tue Nov 16, 2010 7:20 pm

Re: The Noob Guide to Building Visopsys under Windows

Post by andymc »

Looks great ap0r, well done :-))
User avatar
ap0r
Posts: 105
Joined: Tue Feb 14, 2012 12:40 am

Re: The Noob Guide to Building Visopsys under Windows

Post by ap0r »

thanks ;)
Image
Image
Post Reply