This script fetches the latest GCC and Binutils from the GNU FTP, builds them from source, and installs NASM, QEMU, GDB, and Make alongside them. When it's done, you have everything you need to write, assemble, link, and emulate an x86 OS.
| Tool | Purpose |
|---|---|
i386-elf-gcc |
Freestanding C/C++ cross-compiler |
i386-elf-ld |
Cross-linker |
nasm |
x86 assembler |
qemu-system-i386 |
Emulator to run your OS |
gdb |
Debugger |
make |
Build system |
All binaries go to /usr/local. Source files build in ~/cross.
- Ubuntu or Debian-based Linux
sudoaccess- Internet connection (downloads from ftp.gnu.org)
chmod +x setup.sh
./setup.shThe script will:
- Auto-detect the latest GCC and Binutils versions
- Show you the config and ask for confirmation
- Install build dependencies via
apt - Download, build, and install Binutils, then GCC
- Verify all tools are working
- Offer to clean up the build workspace
GCC takes a while to compile. That's expected — go outside.
Re-running the script on a machine that already has the toolchain will detect the installed version and offer to:
- Reinstall (same version, reuses cached sources)
- Upgrade (newer version available, downloads fresh)
After install, run:
i386-elf-gcc --version
i386-elf-ld --version
nasm --version
qemu-system-i386 --versionThe script asks at the end whether to delete ~/cross. You can always do it manually:
rm -rf ~/crossThe installed binaries in /usr/local are unaffected.