Dbox2:Create Images and Yadd's

Aus TuxBoxWIKI
Wechseln zu: Navigation, Suche


Review-KandidatDieser Artikel befindet sich derzeit im Reviewprozess. Hilf mit, ihn zu verbessern! Falls du bei weiteren Artikeln helfen willst, findest du hier eine Auswahl offener Artikel.

Build system prerequisites

The prerequisites on the host for building tuxbox images can done on almost any Unix/Linux system with some 2 GB of free disk space. I personally use ubuntu/gentoo as they are my favourite linux distro. I have helped people on SuSE and ReadHat systems and know it builds fine on them too. I once had it running on cygwin but it takes ages to setup and is not for the faint harted.

The official tool requirement and versions at the time of this writing this document are in the following table:

The build process will automatically check some of these requirements. If you are missing one of the programs, of if your version is older than the above requirements your build could fail.

Note: Other tools are require like fakeroot, mksquashfs, mkcramfs, mkjffs2fs (or mkfs.jffs2), and, possibly, mklibs to be installed on your system.

Once you have checked out your CVS you can use the following tool to check that your system prerequisite are up to standard

~/tuxbox/tuxbox-cvs/hostapps/toolchecker/toolchecker.sh

Creating images with Neutrino on JFFS2 or SquashFS.

There are many guides out there on how to create images. I have simply tried to simplify it so that it makes it a little easier for most people. I have looked at many guides and howto’s and decided it was about time someone summarised all their findings into one short but sweet document. So here goes:

Firstly let’s set up the necessary directory structure.

mkdir tuxbox
cd tuxbox
mkdir tuxbox-cvs
mkdir dbox2
mkdir private
mkdir private/archive
mkdir private/files
mkdir private/logos
mkdir private/locals

Lets explain the some of the directories we have just created. Our main directory is “tuxbox” this is where all our files and subdirectories will go in. We will download the CVS source into the foleder called “tuxbox-cvs”. The image will get compiled into “dbox2”. The “archive” directory will keep a copy of all the downloaded files needed in the compile process, we will get onto this a little later. The “files” directory is where you can copy all your files you wish to copy onto the image, we can make it part of the build process. “logos” is where you place your logo files and we set this in the configure. “ucodes” is the directory to place your ucodes in and again later on this directory will be specified in the configure process. The “locals” directory is if we use customisation files to automate things in our build. We will get onto that a bit later in the document.

Now let’s download the source from CVS for the first time:

cvs -z3 -d anoncvs@cvs.tuxbox.org:/cvs/tuxbox co -P .

NOTE: This is for first time updates only!

If you wish to update your CVS please use the following command, not only is it quicker it also saves a lot of bandwidth its around 60MB each time you run a complete update. So save your bandwidth and save others too! Use the following to checkout updates:

cvs -z3 -d anoncvs@cvs.tuxbox.org:/cvs/tuxbox up -dP .

The make process downloads all the dependencies into a folder called Archive. If you ever run a clean CVS build you do not want to download the packages over again. To resolve this issue we symlink the “private/archive” we created in the first step to the “cdk/Archive” which is where make downloads the packages to.

ln -sf ~/tuxbox/private/archive ~/tuxbox/tuxbox-cvs/cdk/Archive

Now we have all the mucking about out the way let’s start the build process. Firstly we need to run the autogen to generate all the necessary build files.

cd ~/tuxbox/tuxbox-cvs/cdk/
./autogen.sh

If you wish to patch your source now is the time to do it. For example:

cp patch.diff ~/tuxbox/tuxbox-cvs/
cd ~/tuxbox/tuxbox-cvs/
patch -p1 < patch.diff

NOTE: This step is not mandatory.

Now we can finally configure the build.

./configure \
          --prefix="$HOME/tuxbox/dbox2" \
          --with-cvsdir="$HOME/tuxbox/tuxbox-cvs" \
          --enable-flashrules \
          --enable-maintainer-mode \
          --with-logosdir="$HOME/tuxbox/private/logos" \
          --with-checkImage=warn \
          --enable-cdkVcInfo \
          --with-defaultlocale=english 

NOTE: Please see the Newmake Options for a list of all available options.

I use locals.sh files all the time as you can totally automate your build process. Please see the section on local.sh files for examples of some. If you wish to use them now is the time to copy local.sh over to the right location.

cp -r ~/tuxbox/private/locals/*local.sh ~/tuxbox/tuxbox-cvs/cdk/

Finally here it comes let’s build the image please use the relevant one dependent on your filesystem of choice.

Make JFFS2 filesystem

make flash-neutrino-jffs2-all

Make SquashFS filesystem

make flash-neutrino-squashfs-all

Sit back and relax. I use a dual Intel(R) Xeon(TM) CPU 3.20GHz and it takes me around 31 minutes to compile a image from scratch however if you are using VMware I have heard times from 90 minutes up to 210 minutes.

If you wish to rebuild your image you after you have updated your CVS please remember to clean your target. You can use the following clean target:

cd ~/tuxbox/tuxbox-cvs/cdk
make clean

NOTE: Please see Newmake Cleaning Targets for a complete list.

Building Images using local.sh files

Some useful customization scripts, most of these scripts should work out the box but please note that some of the scripts might not suite your needs. Please edit them to your liking.

flash-version-local.sh (JFFS2 / SquashFS)

#!/bin/sh
#flash-version-local.sh

outfile=$1/root/.version

echo "============================================================================================"
echo Hello, this is $0, flashprefix=$1 and buildprefix=$2
echo "============================================================================================"

echo Creating $outfile ...
#                               release / snapshot / internal
echo "version=`./customization/mkversion -internal -version 100`"    > $outfile
echo "creator=nitr8"                                                 >> $outfile
echo "imagename=lebelo"                                              >> $outfile
echo "homepage=http://www.lebelo.net"                              >> $outfile

root-local.sh (JFFS2 / SquashFS)

#!/bin/sh
#root-local.sh

flashprefix=$1
buildprefix=$2

echo "============================================================================================"
echo Hello, this is $0, flashprefix=$1 and buildprefix=$2
echo "============================================================================================"
set -x

#Install some non default components
make flash-fbshot
make flash-dboxshot
make flash-eraseall
make flash-hddtemp

neutrino-jffs2.img1x-local.sh (JFFS2 ONLY)

#!/bin/sh
#neutrino-jffs2-img2x-local.sh

flashprefix=$1
echo "============================================================================================"
echo Hello, this is $0, flashprefix=$1 and buildprefix=$2   PREPARE
echo "============================================================================================"
set -x

d=`date +%d-%m-%Y_%Hh%M`
#Rename Image
mv $flashprefix/neutrino-jffs2.img1x $flashprefix/`grep imagename $flashprefix/root-neutrino-jffs2/.version | sed -e 's/imagename=//'`_x1_$d.img

neutrino-jffs2.img2x-local.sh (JFFS2 ONLY)

#!/bin/sh
#neutrino-jffs2-img2x-local.sh

flashprefix=$1
echo "============================================================================================"
echo Hello, this is $0, flashprefix=$1 and buildprefix=$2   PREPARE
echo "============================================================================================"
set -x

#Rename Image
d=`date +%d-%m-%Y_%Hh%M`
mv $flashprefix/neutrino-jffs2.img2x $flashprefix/`grep imagename $flashprefix/root-neutrino-jffs2/.version | sed -e 's/imagename=//'`_x2_$d.img

root-neutrino-jffs2-local.sh (JFFS2 ONLY)

#!/bin/sh
# root-neutrino-jffs2-local.sh

flashprefix=$1
buildprefix=$2
myfiles=$HOME/tuxbox/private/files
root=$1/root-neutrino-jffs2
LANGUAGES="english deutsch"

echo "============================================================================================"
echo Hello, this is $0, flashprefix=$1 and buildprefix=$2
echo "============================================================================================"
set -x

## Remove all languages expect ones specified
for f in $newroot/share/tuxbox/neutrino/locale/*; do
    (echo $LANGUAGES | grep -v `basename $f .locale` >/dev/null) && rm -f $f
done

## Remove files and directories not needed
rm -Rf $root/share/tuxbox/satellites.xml
rm -Rf $root/share/tuxbox/neutrino/icons/radiomode.*
rm -Rf $root/share/tuxbox/neutrino/icons/scan.*
rm -Rf $root/share/tuxbox/neutrino/icons/shutdown.*
rm -Rf $root/share/tuxbox/lcdd/clock/*
rm -Rf $root/bin/satfind

touch $root/var/tuxbox/config/zapit/epgfilter.xml
touch $root/var/tuxbox/config/mybouquets.xml
touch $root/var/etc/.boot_info
touch $root/var/tuxbox/config/zapit/bouquets.xml
touch $root/var/tuxbox/config/zapit/services.xml

## Copy files accross
cp -r $myfiles/bin/* $root/bin/
cp -r $myfiles/etc/* $root/etc/
cp -r $myfiles/lib/* $root/lib/
cp -r $myfiles/share/* $root/share/
cp -r $myfiles/var/* $root/var/

## Set the right perms
chmod -R 755 $root/bin/smls
touch $root/var/etc/.initialize

neutrino-squashfs.img1x-local.sh (SquashFS ONLY)

#!/bin/sh
#neutrino-squashfs.img1x-local.sh

flashprefix=$1
echo "============================================================================================"
echo Hello, this is $0, flashprefix=$1 and buildprefix=$2   PREPARE
echo "============================================================================================"
set -x

d=`date +%d-%m-%Y_%Hh%M`
#Rename Image
mv $flashprefix/neutrino-squashfs.img1x $flashprefix/`grep imagename $flashprefix/root-neutrino-squashfs/.version | sed -e 's/imagename=//'`_x1_$d.img

neutrino-squashfs.img2x-local.sh (SquashFS ONLY)

#!/bin/sh
#neutrino-squashfs.img2x-local.sh

flashprefix=$1
echo "============================================================================================"
echo Hello, this is $0, flashprefix=$1 and buildprefix=$2   PREPARE
echo "============================================================================================"
set -x

d=`date +%d-%m-%Y_%Hh%M`
#Rename Image
mv $flashprefix/neutrino-squashfs.img2x $flashprefix/`grep imagename $flashprefix/root-neutrino-squashfs/.version | sed -e 's/imagename=//'`_x2_$d.img

root-neutrino-squashfs-local.sh (SquashFS ONLY)

#!/bin/sh
#root-neutrino-squashfs-local.sh

flashprefix=$1
buildprefix=$2
myfiles=$HOME/tuxbox/private/files
root=$1/root-neutrino-jffs2
LANGUAGES="english deutsch"

echo "============================================================================================"
echo Hello, this is $0, flashprefix=$1 and buildprefix=$2
echo "============================================================================================"
set -x

## Remove all languages expect ones specified
for f in $newroot/share/tuxbox/neutrino/locale/*; do
    (echo $LANGUAGES | grep -v `basename $f .locale` >/dev/null) && rm -f $f
done

## Remove files and directories not needed
rm -Rf $root/share/tuxbox/satellites.xml
rm -Rf $root/share/tuxbox/neutrino/icons/radiomode.*
rm -Rf $root/share/tuxbox/neutrino/icons/scan.*
rm -Rf $root/share/tuxbox/neutrino/icons/shutdown.*
rm -Rf $root/share/tuxbox/lcdd/clock/*
rm -Rf $root/bin/satfind

## Copy files accross
cp -r $myfiles/share/* $root/share/

## Set the right perms
chmod -R 755 $root/bin/smls

var-neutrino-local.sh (SquashFS ONLY)

#!/bin/sh
#var-neutrino-local.sh

flashprefix=$1
buildprefix=$2
myfiles=$HOME/tuxbox/private/files
root=$1/root-neutrino-jffs2

echo "============================================================================================"
echo Hello, this is $0, flashprefix=$1 and buildprefix=$2
echo "============================================================================================"
set -x

touch $root/var/tuxbox/config/zapit/epgfilter.xml
touch $root/var/tuxbox/config/mybouquets.xml
touch $root/var/etc/.boot_info
touch $root/var/tuxbox/config/zapit/bouquets.xml
touch $root/var/tuxbox/config/zapit/services.xml
touch $root/var/etc/.initialize

## Copy files accross
cp -r $myfiles/var/* $root/var/
## Create symbolic links
ln -sf /var/tuxbox/satellites.xml $root/share/tuxbox/satellites.xml
ln -sf /var/tuxbox/cables.xml $root/share/tuxbox/cables.xml

References