Code Instructions

  1. 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.

  2. 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.

  3. 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 like sudo apt install gcc or sudo apt install vim.

  4. 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.

  5. Unzip the downloaded code, and note where you unzipped it to.

  6. Close Firefox, then go back to the Terminal. Navigate to the code you just unzipped using cd command.

  7. Inside that folder, navigate to the “intro” directory, which is the code for Chapter 2 of your book.

  8. Install the ‘make’ program to “make” your life easier (pun intended): sudo apt install make

  9. 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”.
  10. To run the cpu program, type: ./cpu "hello" (ctrl-c will stop the program, since it is an infinite loop)

  11. Try to run the other code samples from Chapter 2 of your book (all of them are in the “intro” directory.