Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Home

Maarten ter Huurne edited this page · 13 revisions
Clone this wiki locally

Building the kernel

First install the GCW Zero toolchain, which you can find on the development page of the GCW Zero web site, including installation instructions and add the toolchain to your $PATH.

Then issue the following commands:

git clone git://github.com/gcwnow/linux.git
cd linux
make ARCH=mips gcw0_defconfig
make ARCH=mips vmlinuz.bin -j4

Use a different -j<N> depending on the system you're building on; something near the number of cores you have is typically good.

To build loadable driver modules:

make ARCH=mips modules -j4
./create_modules_fs.sh

Loadable modules are used for the WiFi driver, but can also be useful for testing new drivers without rebooting all the time.

Installing the kernel

Add the following script to your Zero as /etc/local/init.d/S99mount-system.sh:

#!/bin/sh
/bin/mount -o remount,rw /media
/bin/mkdir -p /media/system
/bin/mount -o ro /dev/mmcblk0p1 /media/system
/bin/mount -o remount,ro /media
/bin/mount -o remount,rw /media/system

Now reboot and the system partition will be mounted read/write at /media/system.

Log in with SSH or telnet and check whether you have a backup kernel: in /media/system there should be a file named vmlinuz.bak. If it doesn't exist, make a copy the main kernel vmlinuz.bin to create the backup kernel vmlinuz.bak.

You can copy the kernel to the internal SD card of the Zero using FTP, SFTP or SCP. I recommend SCP since it is just one line on the command prompt. It does require setting up SSH keypair authentication though.

scp vmlinuz.bin root@10.1.1.2:/media/system
scp modules.squashfs root@10.1.1.2:/media/system/update_m.bin

Reboot the Zero to activate the new kernel. Don't use the reset button: part of the kernel may not have been flushed from the write cache yet.

Recovering from a non-working kernel

When you start hacking the kernel, it's almost inevitable that at some point you install a non-working kernel.

The easiest way to recover is to boot the backup kernel: hold the X button, then wait for the unit to reset itself (if it's in a reset loop) or push the reset button (if it's stuck).

If the backup kernel isn't working either, you can reflash the system partition. For this, build the ingenic-boot tool:

git clone git://github.com/gcwnow/ingenic-boot.git
cd ingenic-boot
make

If you want to run ingenic-boot as a non-root user, set up a udev rule as explained in the README. The next time you plug the device in while it is in USB boot mode, your normal user account should have permission to access it.

You can download read-made firmware images from the firmware flashing page on the of the GCW Zero web site.

Finally, put your device in USB boot mode by holding SELECT on power-up or reset and run the tool:

cd ingenic-boot
./ingenic-boot --system=../imager/images/system.<date>.bin

After the new kernel partition is written, the Zero will boot and load the kernel that was just written.

Something went wrong with that request. Please try again.