Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save simons-public/fec3bd16c3042c05805bcd91998abc10 to your computer and use it in GitHub Desktop.
Save simons-public/fec3bd16c3042c05805bcd91998abc10 to your computer and use it in GitHub Desktop.
Running Debian on Goke GK710x devices (chroot)

WIP

Prerequisites

  • A Goke GK710x-based device(uname -r === 3.4.43-gk)
  • Ubuntu 18.04 as a build environment

Set up the toolchain

  • Install crosstool-ng
$ wget http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.24.0.tar.xz
$ tar xvf http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.24.0.tar.xz
$ cd crosstool-ng-1.24.0.tar.xz
$ sudo apt install -y libtool-bin texinfo help2man # Add packages if missing
$ ./bootstrap && ./configure && make
$ sudo make install
  • Generate the toolchain
$ mkdir ct-ng-arm-goke-linux-uclibcgnueabi
$ cd ct-ng-arm-goke-linux-uclibcgnueabi
$ ct-ng ct-ng arm-unknown-linux-uclibcgnueabi # init .config
$ ct-ng menuconfig
# Toolchain options ---> Tuple's vendor string ---> "goke"
# Operating System ---> Version of linux ---> 3.4.113
# C compiler ---> Version of gcc ---> 4.9.4
$ ct-ng build # it may take a while
$ ls ~/x-tools/arm-goke-linux-uclibcgnueabi/ # verify installed

Build the kernel modules

  • Fetch the source
$ wget https://github.com/likeablob/IP001_linux-mirror/raw/master/linux-kernel-3.4.43.tgz
$ tar xvf linux-kernel-3.4.43.tgz
$ cd 3.4.43
$ wget https://github.com/likeablob/IP001_linux-mirror/blob/master/linux_config -O .config
  • Build the modules
$ export PATH=~/x-tools/arm-goke-linux-uclibcgnueabi/bin:$PATH
$ export ARCH=arm
$ export CROSS_COMPILE=arm-goke-linux-uclibcgnueabi-
$ make menuconfig
# File systems  ---> <M> The Extended 4 (ext4) filesystem
$ make modules -j4
$ INSTALL_MOD_PATH=./tmp_modules make modules_install
$ tar cvzf tmp_modules.tgz tmp_modules

Set up the rootfs of Debian stretch (armel)

  • Create a disk image
$ dd if=/dev/zero of=./debian-stretch-armel.img bs=1M count=1024 # 1 GiB 
$ mkfs.ext4 ./debian-stretch-armel.img
$ mkdir debian-stretch-armel
$ sudo mount -o loop debian-stretch-armel.img debian-stretch-armel
  • Init rootfs
$ sudo apt install -y qemu-user-static debootstrap
$ sudo qemu-debootstrap --arch armel stretch debian-stretch-armel http://ftp.jp.debian.org/debian # it may take a while

Let's have fun

$ ssh root@${your-device-ip}
# cd /media
# insmod fs/mbcache.ko
# insmod fs/jbd2/jbd2.ko
# insmod fs/ext4/ext4.ko
# mkdir debian-stretch-armel
# mount -o loop debian-stretch-armel.img debian-stretch-armel
# chroot debian-stretch-armel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment