Skip to content

Commit

Permalink
Removed original information from KoboLabs
Browse files Browse the repository at this point in the history
  • Loading branch information
Melissa Jenkins committed Jun 13, 2013
0 parents commit 18d914e
Show file tree
Hide file tree
Showing 34,754 changed files with 14,849,945 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
114 changes: 114 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# About

This repository is a fork of the KoboLabs e-reader that provides a build
environment and a USB Host kernel for running XCSoar on a Kobo Mini.

# Caveats

This has only been tested on a Kobo Mini, but it will probably work on
other new kobo devices

At present you can't boot your device between e-Reader and XCSoar without
reflashing the kernel. This will be rectified with an 'auto-reflash' option
in the boot sequence

# Rebuilding

## Kernel

Unfortunately the Kobo Kernel must be compiled with an older version of GCC (4.4) and XCSoar requires 4.6 or later. To resolve this you will need to build chains - one for the XCSoar packages and one for the kernel.

### Setup

* I used a new Ubuntu 12.04 Virtual Machine on my laptop

* Install codesourcery GCC toolchain to /usr/arm-none-linux-gnueabi by untaring the downloaded archive into the /usr (ditching the arm2010-blah directory) directory
> http://sources.buildroot.net/arm-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
> wget http://sources.buildroot.net/arm-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
> bunzip2 arm-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
> sudo tar -C /usr -xvf arm-2010q1-202-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar --strip 1
* Changed the ownership of this directory to me (chown ...)
> sudo chown ${USER}:${USER} /usr/arm-none-linux-gnueabi
* Install the uboot-mkimage tool
> sudo apt-get install uboot-mkimage ncurses-dev
* clone repository if you already haven't
> sudo apt-get install git
> git clone https://github.com/ifly7charlie/XCSoar-Kobo-Build.git
### Building

* Change into the ./hw/imx507/linux-2.6.35.3-USBHOST directory

* Run the make command
>make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm clean uImage
* This will leave you a uImage file in arch/arm/boot/uImage

### Installing

* To install to the boot SD card you have a few options
> dd if=arch/arm/boot/uImage of=/dev/[your memory card] bs=512 seek=2048
or
> copy to /mnt/onboard/.kobo/upgrade/uImage and touch /mnt/onboard/.kobo/KoboRoot.tgz then insert card and reboot kobo
or
> copy to SD card (XCSoar installed), or normal Kobo plugged into laptop in .kobo/upgrade/uImage touch .kobo/KoboRoot.tgz then reboot kobo
note that the memory card is the WHOLE card, not a partition. So if your card is /dev/sdb use this not the root partition of /dev/sdb1. The kernel is installed outside of the filesystem at an absolute offset!

## Building XCSoar

This is a two part process - one is seting up the build environment, which can be done using this git repository. The second is actually building XCSoar, which requires code from the XCSoar repository

### Setup - CodeSourcery

* Use a new VM - it makes the buildchain easier as you can't have the same compilers on both...

* Get a version of the CodeSourcery ARM GNU toolchain which contains 4.6 or later (I built using 4.7)
> http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/request?id=478dff82-62bc-44b2-afe2-4684d83b19b9&downloadlite=scblite2012&fmpath=/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/form
* Install it into the /usr/arm-none-linux-gnueabi directory (will have ./bin etc)

* Change ownership so you don't need to compile as root (as above)

### Setup - G++ - Hardware Float

* Install g++ toolchain, this should go into /usr/arm-linux-gnueabihf directory
> sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
* Change ownership so you don't need to compile as root (as above)

### Building

* Change into the <git>/packages directory

* Run ../build/fetchxcsoarpackages.sh to download all the XCSoar specific packages

* Install build tools that are needed
> sudo apt-get install xsltproc imagemagick g++ librsvg2-bin libboost-dev
These are all needed to run the build process, but don't need to be crosscompiled
If your platform doesn't support pushd or popd then you should install them as well

* change into build directory

* edit buildsetup.sh to put the correct paths in!

* run buildsetup.sh, which will configure this and start a build.
* to restart you can just run the last commands from the buildsetup.sh script

* Output for all the libraries will go into the /usr/arm-none-linux-gnueabi/[lib|include] directories

* Clone the xcsoar repository somewhere

### Compiling XCSoar

* Change into this directory and run make
> make TARGET=KOBO KOBO=/usr/arm-none-linux-gnueabi
* Output will be in output/KOBO/bin

2 changes: 2 additions & 0 deletions build/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build-config-user.sh
status
45 changes: 45 additions & 0 deletions build/build-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

cd ~/kobo/tmp

# Exit on subcommand failure or on undefined variable reference
set -e -u

export KOBO_SCRIPT_DIR="`dirname $0`"

while test $# -gt 0; do
if test "$1" = "clean"; then
echo "Just delete all files in your build directory to clean"
exit 0
else
echo "Unknown argument $1, exiting"
exit 1
fi
done

for i in \
termcap \
zlib \
bzip2 \
libpng \
jpegsrc \
libtool \
freetype \
icns \
curl \
SDL \
SDL_ttf \
SDL_gfx \
; do
if echo "${SKIP:-}" | grep -q \\\<"$i"\\\> ; then
echo "Building of $i suppressed by \$SKIP"
continue
fi
$KOBO_SCRIPT_DIR/scripts/$i.sh 2>&1 | tee $i.log
if test "${PIPESTATUS[0]}" -ne 0 ; then
echo "Build failed at $i.sh, aborting"
exit 1
fi
done

echo "All library builds completed successfully"
38 changes: 38 additions & 0 deletions build/build-common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
. $KOBO_SCRIPT_DIR/build-config.sh

# Argument processing
while [ $# -gt 0 ]; do
if [ "$1" = "clean" ]; then
rm -rf "$ARCHIVEDIR"
rm status/`basename $0 .sh`
exit 0
else
echo "ERROR: unknown argument $1 to $0"
exit 1
fi
shift 1
done

# Do we need to do the build at all?
# Doesn't consider dependencies; you still have to clean for that. Should be using `make'.
mkdir -p status
if [ -e status/`basename $0 .sh` ]; then
echo "No need to rebuild `basename $0 .sh`"
exit 0
fi

rm -rf "${ARCHIVEDIR}"
ARCHIVESUFFIX="${ARCHIVE##*.}"
if [ "$ARCHIVESUFFIX" = "bz2" ]; then
tar xjf ${ARCHIVESDIR}/${ARCHIVE}
elif [ "$ARCHIVESUFFIX" = "gz" ]; then
tar xzf ${ARCHIVESDIR}/${ARCHIVE}
else
echo "Unknown archive suffix $ARCHIVESUFFIX on $ARCHIVE"
exit 1
fi

function markbuilt() {
touch status/`basename $0 .sh`
}
37 changes: 37 additions & 0 deletions build/build-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Read configuration overrides file from the build directory, if present. Use
# this file instead of editing build-config.sh directly, as it will never be
# checked into revision control.
#
# All these variables may be overridden by setting them in build-config-user.sh
# or in the environment, as values are only set if the variable is empty.
#
[ -e $KOBO_SCRIPT_DIR/build-config-user.sh ] && . $KOBO_SCRIPT_DIR/build-config-user.sh

# Where produced binaries should be installed to. It must not have a trailing slash.
def_device_root=/chroot
DEVICEROOT=${DEVICEROOT:-$def_device_root}

def_archives_dir=$KOBO_SCRIPT_DIR/../packages
def_patches_dir=$KOBO_SCRIPT_DIR/../patches
ARCHIVESDIR=${ARCHIVESDIR:-$def_archives_dir}
PATCHESDIR=${PATCHESDIR:-$def_patches_dir}

# How to invoke make
MAKE=${MAKE:-"make"}
MAKE_JOBS=${MAKE_JOBS:-"2"}

# Target host. Omit any trailing hyphen.
CROSSTARGET=${CROSSTARGET:-"arm-linux"}

# Invocation of tools. These should NOT be exported to the environment; the
# individual scripts decide how and when to pass them to commands.
CPPFLAGS=${CPPFLAGS:-"-I${DEVICEROOT}/include -I${DEVICEROOT}/usr/include"}
CFLAGS=${CFLAGS:-"${CPPFLAGS}"}
LIBS=${LIBS:-"-L${DEVICEROOT}/lib -L${DEVICEROOT}/usr/lib"}
LDFLAGS=${LDFLAGS:-"${LIBS}"}

LIBTOOL=${LIBTOOL:-"${DEVICEROOT}/usr/local/bin/${CROSSTARGET}-libtool"}
CC=${CC:-"${CROSSTARGET}-gcc"}

# Qt options are empty by default, but may be overridden by the user.
QT_EXTRA_ARGS="${QT_EXTRA_ARGS:-}"
12 changes: 12 additions & 0 deletions build/buildsetup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# make the stuff needed to get it to build
# note the directory is where your cross compilation tools are installed

mkdir -p ~/kobo/tmp
cat > /kobo/KoboLabs/build/build-config-user.sh <<__END__
DEVICEROOT=/usr/arm-none-linux-gnueabi
CROSSTARGET=arm-none-linux-gnueabi
__END__

# then to build
cd ~/kobo/tmp
/kobo/KoboLabs/build/build-all.sh
13 changes: 13 additions & 0 deletions build/fetchxcsoarpackages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
pushd ../packages
wget http://zlib.net/zlib-1.2.8.tar.gz
wget http://freefr.dl.sourceforge.net/project/icns/libicns-0.8.1.tar.gz
wget http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz
wget http://www.libsdl.org/release/SDL-1.2.15.tar.gz
wget ftp://ftp.gnu.org/gnu/termcap/termcap-1.3.1.tar.gz
wget http://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-2.0.11.tar.gz
wget http://www.ferzkopp.net/Software/SDL_gfx-2.0/SDL_gfx-2.0.23.tar.gz
wget http://netcologne.dl.sourceforge.net/project/boost/boost/1.53.0/boost_1_53_0.tar.bz2
wget http://www.ijg.org/files/jpegsrc.v9.tar.gz
wget http://curl.haxx.se/download/curl-7.30.0.tar.bz2
popd
15 changes: 15 additions & 0 deletions build/scripts/SDL.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -e -u
ARCHIVE=SDL-1.2.15.tar.gz
ARCHIVEDIR=SDL-1.2.15
. $KOBO_SCRIPT_DIR/build-common.sh

# add the hacky patch
patch -p0 < $PATCHESDIR/SDL-1.2.15-kobo-new.patch

pushd $ARCHIVEDIR
CFLAGS="-DKOBO" ./configure --prefix=/${DEVICEROOT} --host=${CROSSTARGET} --disable-video-x11 --disable-cdrom --disable-audio --disable-opengl --disable-json
$MAKE -j$MAKE_JOBS
$MAKE install
popd
markbuilt
16 changes: 16 additions & 0 deletions build/scripts/SDL_gfx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -e -u
ARCHIVE=SDL_gfx-2.0.23.tar.gz
ARCHIVEDIR=SDL_gfx-2.0.23
. $KOBO_SCRIPT_DIR/build-common.sh

patch -p0 < $PATCHESDIR/SDL-gfx-kobo.patch

pushd $ARCHIVEDIR
SDL_CFLAGS=`/${DEVICEROOT}/bin/sdl-config --cflags` SDL_LIBS=`/${DEVICEROOT}/bin/sdl-config --libs` PREFIX=/${DEVICEROOT} CHOST=${CROSSTARGET} CROSS_PREFIX=${CROSSTARGET} SDL_CONFIG=/${DEVICEROOT}/bin/sdl-config ./configure --prefix=/${DEVICEROOT} --host=${CROSSTARGET} --disable-sdltest --disable-mmx --with-sdl-prefix=/${DEVICEROOT}
aclocal
automake
$MAKE -j$MAKE_JOBS
$MAKE install
popd
markbuilt
17 changes: 17 additions & 0 deletions build/scripts/SDL_ttf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -e -u
ARCHIVE=SDL_ttf-2.0.11.tar.gz
ARCHIVEDIR=SDL_ttf-2.0.11
. $KOBO_SCRIPT_DIR/build-common.sh

# configure uses this to decide if it's doing opengl... it's installed even if we don't want it
# (sdl is configured without... probably should fix make file in SDL0
[ -e /${DEVICEROOT}/include/SDL/SDL_opengl.h ] && rm /${DEVICEROOT}/include/SDL/SDL_opengl.h

pushd $ARCHIVEDIR
SDL_CFLAGS=`/${DEVICEROOT}/bin/sdl-config --cflags` SDL_LIBS=`/${DEVICEROOT}/bin/sdl-config --libs` CHOST=${CROSSTARGET} CROSS_PREFIX=${CROSSTARGET} SDL_CONFIG=/${DEVICEROOT}/bin/sdl-config ./configure --prefix=/${DEVICEROOT} --host=${CROSSTARGET} --disable-sdltest --with-freetype-prefix=/${DEVICEROOT} --disable-opengl

$MAKE -j$MAKE_JOBS
$MAKE install
popd
markbuilt
14 changes: 14 additions & 0 deletions build/scripts/acl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
set -e -u
ARCHIVE=acl_2.2.47-1.tar.gz
ARCHIVEDIR=acl-2.2.47
. $KOBO_SCRIPT_DIR/build-common.sh

pushd $ARCHIVEDIR
LIBTOOL="${LIBTOOL}" CFLAGS="${CFLAGS}" CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}" ./configure --host=$CROSSTARGET --prefix=/${DEVICEROOT}
$MAKE CPPFLAGS="${CPPFLAGS}" -j$MAKE_JOBS
$MAKE install
$MAKE install-dev
$MAKE install-lib
popd
markbuilt
13 changes: 13 additions & 0 deletions build/scripts/attr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -e -u
ARCHIVE=attr_2.4.43-1.tar.gz
ARCHIVEDIR=attr-2.4.43
. $KOBO_SCRIPT_DIR/build-common.sh

pushd $ARCHIVEDIR
LIBTOOL="${LIBTOOL}" CC="${CC}" ./configure --host=${CROSSTARGET} --prefix=/${DEVICEROOT}
$MAKE install
$MAKE install-dev
$MAKE install-lib
popd
markbuilt
16 changes: 16 additions & 0 deletions build/scripts/boost.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -e -u
ARCHIVE=boost_1_53_0.tar.bz2
ARCHIVEDIR=boost_1_53_0
. $KOBO_SCRIPT_DIR/build-common.sh



pushd $ARCHIVEDIR
./bootstrap.sh --without-libraries=python
echo "using gcc : arm : ${CROSSTARGET}-gcc : ;" >> tools/build/v2/user-config.jam
./b2
./b2 install --prefix=/${DEVICEROOT}
popd

markbuilt
14 changes: 14 additions & 0 deletions build/scripts/busybox.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
set -e -u
ARCHIVE=busybox-1.17.1.tar.bz2
ARCHIVEDIR=busybox-1.17.1
. $KOBO_SCRIPT_DIR/build-common.sh

patch -p0 < $PATCHESDIR/busybox-1.17.1.patch
patch -p0 < $PATCHESDIR/busybox-1.17.1-make.patch
pushd $ARCHIVEDIR
$MAKE defconfig
$MAKE -j$MAKE_JOBS CROSS_COMPILE="${CROSSTARGET}-" install
cp -a _install/* /${DEVICEROOT}
popd
markbuilt
15 changes: 15 additions & 0 deletions build/scripts/bzip2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -e -u
ARCHIVE=bzip2-1.0.6.tar.gz
ARCHIVEDIR=bzip2-1.0.6
. $KOBO_SCRIPT_DIR/build-common.sh

patch -p0 < $PATCHESDIR/bzip2-libraryonly.patch


pushd $ARCHIVEDIR
CROSSPREFIX=${CROSSTARGET} $MAKE
$MAKE PREFIX=/${DEVICEROOT} install

popd
markbuilt
Loading

0 comments on commit 18d914e

Please sign in to comment.