-
Notifications
You must be signed in to change notification settings - Fork 52
Building the Kernel
The RetroFW kernel is maintained at http://kernel.retrofw.com. The kernel is fully open source and easily buildable by anyone with even the slightest interest. Minor knowledge of the Linux command line is required.
In order to build the kernel, you will need a reasonably modern x86-based Linux machine with the following packages installed:
- bzip2
- curl
- git
- make
- gcc
- tar
- u-boot-tools
- 32-bit Linux libraries
- python2 (only for uboot)
These packages can typically be installed using a local packaging tool such as apt-get
or yum
. Check the documentation for your OS for more information.
Note that the automatic method below is able to automatically add requirements on Ubuntu systems. For that reason, Ubuntu is generally recommended for the build.
There are two separate options for building RetroFW; automatic and manual. The automatic method is very simple and provides a toolchain for getting to writable SD Card images in a single command. This method is recommended for casual developers. The scripts can still be useful if you're interested in serious kernel development work. However, serious kernel developers would be recommended to learn more about the build process by learning the manual method.
Download the RetroFW Kernel Tools and install. Then run the dist-all.sh
script to build all supported versions of the kernel. For example:
cd /opt
curl -L -o retrofw-kernel-tools.tar.bz2 https://github.com/retrofw/kernel/releases/download/tools/retrofw-kernel-tools.tar.bz2
tar -xjf retrofw-kernel-tools.tar.bz2
cd retrofw-kernel-tools
./dist-all.sh
You may need to run as root in order to modify your /opt
directory.
The package contains a readme.txt
file with a full explanation of all the tools available. The kernel sources will be installed to /opt/retrofw-kernel/kernel
where they can be modified.
- Download the Ingenic GCC 4.12 compiler from Ingenic's website or the toolchain release mirror. e.g.
curl -L -o /tmp/mipseltools-gcc412-glibc261.tar.bz2 https://github.com/retrofw/kernel/releases/download/tools/mipseltools-gcc412-glibc261.tar.bz2
- Extract the toolchain from the root directory of your Linux system. Make sure you add the toolchain to your PATH so the kernel build can find the compiler. e.g.
cd /
tar -xjf /tmp/mipseltools-gcc412-glibc261.tar.bz2
export PATH="/opt/mipseltools-gcc412-glibc261/bin:$PATH"
- Create a directory in which you want to work with the kernel. e.g.
mkdir -p /opt/retrofw-kernel
- Clone the kernel from GitHub into your new working directory. e.g.
cd /opt/retrofw-kernel
git clone https://github.com/retrofw/kernel
- Create a separate directory to build your kernel into. You can have different directories for different kernel configurations without interference. e.g.
cd /opt/retrofw-kernel
mkdir RetroFW_5B
- You will need to configure your kernel with the
make ARCH=mips O=<build dir> RetroFW_<model>_defconfig
command. Just replace<build dir>
with the directory path you created in step 5 and<model>
with the screen model you wish to build for. See the RetroFW release page and documentation for details on the different device models available. For example, the following command will configure a build for IPS enabled devices like the RG-300:
cd /opt/retrofw-kernel/kernel
make ARCH=mips O=/opt/retrofw-kernel/RetroFW_5B RetroFW_5B_defconfig
- Change your directory to the build directory you created in Step 5. Then run the
make ARCH=mips CROSS_COMPILE=mipsel-linux- uImage
command to build your very own kernel! e.g.
cd /opt/retrofw-kernel/RetroFW_5B
make ARCH=mips CROSS_COMPILE=mipsel-linux- uImage
- Congratulations! You've just built your very own kernel! You will find the kernel image under
arch/mips/boot/uImage
. To use this kernel, you will need to integrate it with a boot disk. Copy theuImage
file to a convenient location and obtain aRetroFW.img
file by downloading and extracting a recent RetroFW release. You can then use thedd
command to install your kernel into the image:
dd if=uImage of=RetroFW.img bs=1M seek=4194304 conv=notrunc iflag=skip_bytes oflag=seek_bytes
sync
You can then write the RetroFW.img
file to an SD Card using a tool like balenaEtcher. Pop the card into your device, and enjoy your new kernel!
Note that the RetroFW.img file you obtain must contain the appropriate U-Boot for your system in order to boot. To overcome this, you will need to build your own U-Boot (check the Building U-Boot page).
This wiki was made for RetroFW usage and tools. If we missed something or if you have a question/suggestion, please send us a message in our Discord server here.
RetroFW
- Home
- Install Firmware
- Emulators and Apps
- Bug Reporting
- USB Networking
- Button mapping and combos
- Changelog
Emulators
- Arcade
- GameBoy
- Java Games
- Nintendo NES, Famicom Disk System
- PlayStation
- Sega Genesis/Megadrive
Devices
- RetroArcade Mini (RS07)
- RG300
Themes
Development
- Configuring a Toolchain
- Making Games
- How to build IPK packages
- How to build OPK packages
- Supporting Game Controllers
- GitHub Development Flow
- Building the Kernel
- Building U-Boot
Modding