ENEE 447 - Operating Systems by B. Jacob

Spring 2021


Course Information:

Instructor Information:


Course Handouts, General Information, and some ARM documentation:

Additional Reading Material:


Running in 32-bit mode vs 64-bit mode

When you run 32-bit mode on the Raspberry Pi, you have to take out the line in the config.txt file that says the following:
    arm_control=0x200
Also, make sure there is no kernel image called "kernel8.img" on your SD card, because the bootloader will search for the kernel with the largest number in its name (up to 8). Between kernel7 and kernel8, it will boot kernel8.

Cross-Compiler Information

This is fairly macOS-specific, since that is what I use (and, anyway, for Windows and Linux you can get pre-built installations). But hopefully it helps.

You have to install binutils and gcc, and the order matters, depending on the install.

If you are running a Mac laptop, you will need to get Xcode installed. If you are running Mojave, you will also need to do the following at the command-line:

    sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

    [see https://apple.stackexchange.com/questions/337940/why-is-usr-include-missing-i-have-xcode-and-command-line-tools-installed-moja]
This command creates and populates the /usr/include directory, which is the standard C-language directory that contains all system header files required for building anything. And, should you fail to run that rather obscure command on the command line, the /usr/include directory will otherwise not exist. Yes, I know exactly how stupid that sounds. Apple has gone WAYYYYYYY downhill since Steve Jobs died.

Also, I'm assuming that you have already done the other steps for macOS:

    brew install gmp
    brew install mpfr
    brew install libmpc
You will have to make binutils to get the assembler, the linker/loader, and the objdump/objcopy executables. Go to the GNU website for that:
    http://ftp.gnu.org/gnu/binutils/
Grab the most recent version. Currently, it is "binutils-2.36.tar.xz" ...

For gcc, get the source code at

    https://developer.arm.com/open-source/gnu-toolchain/gnu-a/downloads
Currently this is the file "gcc-arm-src-snapshot-10.2-2020.11.tar.xz" at the bottom of the page, but as they create new versions they update the page, so just scroll to the bottom and get what's there.

The instructions for building binutils and gcc are provided below.

Note: the only difference between building a 32-bit cross-compiler and a 64-bit cross-compiler is that, for a 32-bit arch, you give the target as "arm-none-eabi" and for the 64-bit arch, you give the taret as "aarch64-elf" ... that part is very well done (thank you, GNU!).

Setting Up a 32-bit Cross-Compiler (arm-none-eabi)

Re: BINUTILS - Download it, untar it, etc. Outside of the binutils directory, create a directory called "build32" or whatever you want. Go to that directory and type the following:
    ../binutils-2.36/configure --target=arm-none-eabi --disable-nls --enable-languages=c --without-headers
    make -j4 all
    make install
Re: GCC - Download it, untar it, etc. Inside the main directory, create a subdirectory called "build32" or whatever you want. Go to that directory and type the following:
    ../gcc-arm-src-snapshot-10.2-2020.11/configure --target=arm-none-eabi --disable-nls --enable-languages=c --without-headers
    make -j4 all-gcc
    make install-gcc
You will probably have to run the installs as root (sudo make install, sudo make install-gcc) so that the make processes can put the files into the /usr/local/bin space.

Let me know if you have issues.

Optional: Setting Up a 64-bit Cross-Compiler (aarch64-elf)
[This is just in case you are curious; we will be using 32-bit mode in this course, not 64-bit mode]

Re: BINUTILS - Download it, untar it, etc. Outside of the binutils directory, create a directory called "build64" or whatever you want. Go to that directory and type the following:
    ../binutils-2.36/configure --target=aarch64-elf --disable-nls --enable-languages=c --without-headers
    make -j4 all
    make install
Re: GCC - Download it, untar it, etc. Inside the main directory, create a subdirectory called "build64" or whatever you want. Go to that directory and type the following:
    ../gcc-arm-src-snapshot-10.2-2020.11/configure --target=aarch64-elf --disable-nls --enable-languages=c --without-headers
    make -j4 all-gcc
    make install-gcc
You will probably have to run the installs as root (sudo make install, sudo make install-gcc) so that the make processes can put the files into the /usr/local/bin space.

Let me know if you have issues.


Projects:


Last updated: recently by Bruce Jacob (email address) using the vi text editor ... best viewed in Safari