Code Instructions
Make sure you have access to a Linux operating system. You can either install Linux on your own computer using VirtualBox/UTM/etc., or you can log in to PicoCluster.
If you are using a GUI on Linux, open the Terminal app. If you are using PicoCluster, you will already be logged in to a terminal.
You need to have
gcc
and a text editor of your choice (vim, emacs, nano, etc.) installed. PicoCluster already has these, but you can also install them yourself with something likesudo apt install gcc
orsudo apt install vim
.You need to download the code for the textbook at https://github.com/remzi-arpacidusseau/ostep-code/archive/refs/heads/master.zip. Save it anywhere (maybe inside your home directory somewhere). If you download it on your own computer and you are using PicoCluster, you’ll need to use something like CyberDuck to move the files over.
Unzip the downloaded code, and note where you unzipped it to.
Close Firefox, then go back to the Terminal. Navigate to the code you just unzipped using
cd
command.Inside that folder, navigate to the “intro” directory, which is the code for Chapter 2 of your book.
Install the ‘make’ program to “make” your life easier (pun intended):
sudo apt install make
Once you are in the intro folder, compile all of the files by typing
make
, then hitting ENTER.- Note: you could compile these yourself manually too. For example, to compile the “cpu.c” file, type
gcc -o cpu cpu.c
, then hit ENTER. This will compile it to a program called “cpu”.
- Note: you could compile these yourself manually too. For example, to compile the “cpu.c” file, type
To run the cpu program, type:
./cpu "hello"
(ctrl-c will stop the program, since it is an infinite loop)Try to run the other code samples from Chapter 2 of your book (all of them are in the “intro” directory.