Here is some direction to setup a developement environement for the LDK handheld, which share the same board as the RS-97 device and so, the same cross compiler.

This setup is done on Ubuntu 18.04, but will probably work on other version of Ubuntu, and other distribution with some modifications.

Download latest LTS buildroot version

sudo mkdir -p /opt/buildroot
sudo chown -R $USER:$USER /opt/buildroot
cd /opt/buildroot
wget http://www.buildroot.org/downloads/buildroot-2019.02.3.tar.bz2
tar xf buildroot-2019.02.3.tar.bz2
mkdir -p board/ldk/buildroot-2019.02.3/cross
cd buildroot-2019.02.3

Setup a toolchain build

make menuconfig
  • Target Options
    • Target Architecture: MIPS (little endian)
    • Use soft-float: [ ]
  • Build options:
    • Download dir: $(TOPDIR)/../dl
    • Host dir: $(TOPDIR)/../board/ldk/buildroot-2019.02.3/cross
  • Toolchain:
    • Enable WCHAR support
    • Enable C++ support
  • System configuration:
    • Init system: None
  • Target packages:
    • BusyBox: [ ]
  • Filesystem images:
    • tar: [ ]

Build the toolchain

cp .config ../board/ldk/buildroot-2019.02.3/toolchain.config
make -j7 toolchain

Build a complete system

cd ..
rm -rf buildroot-2019.02.3
tar xf buildroot-2019.02.3.tar.bz2 && cd buildroot-2019.02.3
make menuconfig
  • Target Options
    • Target Architecture: MIPS (little endian)
    • Use soft-float: [ ]
  • Build options:
    • Download dir : $(TOPDIR)/../dl
  • Toolchain:
    • Toolchain type: External toolchain
    • Toolchain : Custom toolchain
    • Toolchain origin: Pre-installed toolchain
    • Toolchain path: $(TOPDIR)/../board/ldk/buildroot-2019.02.3/cross/usr
    • External toolchain gcc version: 7.x
    • External toolchain kernel headers series: 4.19.x
    • Toolchain has WCHAR support: [*]
    • Toolchain has threads debugging support: [ ]
    • Toolchain has C++ support: [*]
  • Target Packages:
    • BusyBox configuration file to use?: $(TOPDIR)/../board/ldk/buildroot-2019.02.3/busybox.config
    • Graphics libraries and applications:
      • directfb: [*]
      • sdl2:
        • DirectFB video driver (NEW): [*]

Build final image

cp .config ../board/ldk/buildroot-2019.02.3/system-01.config
make -j7

LDK_SDK cross compilation setup

export LDK_SDK=/opt/buildroot/buildroot-2019.02.3/output/host
export LDK_SYS=/opt/buildroot/buildroot-2019.02.3/output/host/mipsel-buildroot-linux-uclibc/sysroot
echo "export LDK_SDK=${LDK_SDK}" > /opt/buildroot/ldk_vars.sh
echo "export LDK_SYS=${LDK_SYS}" >> /opt/buildroot/ldk_vars.sh
echo "export PATH=$PATH:${LDK_SDK}/bin" >> /opt/buildroot/ldk_vars.sh
echo "export ARCH=\"\"" >> /opt/buildroot/ldk_vars.sh
echo "export CFLAGS=\"${ARCH} -O2 -ffunction-sections -fdata-sections -D__LDK__ -I${LDK_SYS}/usr/include -isystem${LDK_SYS}\"" >> /opt/buildroot/ldk_vars.sh
echo "export CXXFLAGS=\"${CFLAGS}\"" >> /opt/buildroot/ldk_vars.sh
echo "export CPPFLAGS=\"${CFLAGS}\"" >> /opt/buildroot/ldk_vars.sh
echo "export LDFLAGS=\"${ARCH}  -L${LDK_SYS}/lib -L${LDK_SYS}/usr/lib\"" >> /opt/buildroot/ldk_vars.sh
echo "export LIBS=\"\"" >> /opt/buildroot/ldk_vars.sh
ln -sf ${LDK_SDK}/bin/pkg-config ${LDK_SDK}/bin/mipsel-linux-pkg-config
source /opt/buildroot/ldk_vars.sh

Previous Post