Difference between revisions of "Debian distro"

From IGEP - ISEE Wiki

Jump to: navigation, search
(Pbuilder)
(Pbuilder)
 
(8 intermediate revisions by the same user not shown)
Line 24: Line 24:
 
if you're idea is build ubuntu packages then you need install other packages
 
if you're idea is build ubuntu packages then you need install other packages
  
<pre>sudo apt-get install build-essential devscripts dh-make quilt autogen autoconf dh-autoreconf dh-buildinfo dh-make pkg-config
+
<pre>sudo apt-get install build-essential devscripts dh-make quilt autogen autoconf dh-autoreconf dh-buildinfo dh-make pkg-config kernel-package debootstrap
 
</pre>
 
</pre>
  
Line 30: Line 30:
 
A [https://wiki.ubuntu.com/PbuilderHowto pbuilder] environment is a chrooted environment which can have a different distro series or architecture than your host system.
 
A [https://wiki.ubuntu.com/PbuilderHowto pbuilder] environment is a chrooted environment which can have a different distro series or architecture than your host system.
  
<pre>sudo apt-get install pbuilder qemu-user-static</pre>
+
<pre>sudo apt-get install pbuilder pbuilder-scripts qemu-user-static debian-keyring debian-archive-keyring ubuntu-keyring emdebian-archive-keyring debian-ports-archive-keyring</pre>
  
Create ~/.pbuilderrc file with your own pbuilder setup like this:
+
Create ~/.pbuilderrc file with your own pbuilder setup script, upu can use below script:
 
 
<pre class="brush: bash; highlight: [5, 15]; html-script: true">
 
 
 
# !/bin/sh
 
  
 +
<pre class="brush:bash/shell"># !/bin/sh
 
set -e
 
set -e
 
 
if [ "$OS" == "debian" ]; then
 
if [ "$OS" == "debian" ]; then
 
 
     MIRRORSITE="http://ftp.no.debian.org/debian/"
 
     MIRRORSITE="http://ftp.no.debian.org/debian/"
 
     COMPONENTS="main contrib non-free"
 
     COMPONENTS="main contrib non-free"
 
     DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}"
 
     DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}"
        "--keyring=/usr/share/keyrings/debian-archive-keyring.gpg")
+
        "--keyring=/usr/share/keyrings/debian-archive-keyring.gpg")
 
     : ${DIST:="wheezy"}
 
     : ${DIST:="wheezy"}
 
     : ${ARCH:="amd64"}
 
     : ${ARCH:="amd64"}
Line 53: Line 48:
 
     fi
 
     fi
 
elif [ "$OS" == "raspbian" ]; then
 
elif [ "$OS" == "raspbian" ]; then
 
 
     MIRRORSITE="http://ftp.acc.umu.se/mirror/raspbian/raspbian/"
 
     MIRRORSITE="http://ftp.acc.umu.se/mirror/raspbian/raspbian/"
 
     COMPONENTS="main contrib non-free"
 
     COMPONENTS="main contrib non-free"
Line 61: Line 55:
 
     : ${ARCH:="armhf"}
 
     : ${ARCH:="armhf"}
 
elif [ "$OS" == "ubuntu" ]; then
 
elif [ "$OS" == "ubuntu" ]; then
 
 
     MIRRORSITE="http://no.archive.ubuntu.com/ubuntu/"
 
     MIRRORSITE="http://no.archive.ubuntu.com/ubuntu/"
 
     COMPONENTS="main restricted universe multiverse"
 
     COMPONENTS="main restricted universe multiverse"
Line 67: Line 60:
 
         "--keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg")
 
         "--keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg")
 
else
 
else
 
 
     echo "Unknown OS: $OS"
 
     echo "Unknown OS: $OS"
 
     exit 1
 
     exit 1
 
fi
 
fi
 
 
if [ "$DIST" == "" ]; then
 
if [ "$DIST" == "" ]; then
 
 
     echo "DIST is not set"
 
     echo "DIST is not set"
 
     exit 1
 
     exit 1
 
fi
 
fi
 
 
if [ "$ARCH" == "" ]; then
 
if [ "$ARCH" == "" ]; then
 
 
     echo "ARCH is not set"
 
     echo "ARCH is not set"
 
     exit 1
 
     exit 1
 
fi
 
fi
 
 
NAME="$OS-$DIST-$ARCH"
 
NAME="$OS-$DIST-$ARCH"
 
 
if [ "$ARCH" == "armel" ] && [ "$(dpkg --print-architecture)" != "armel" ]; then
 
if [ "$ARCH" == "armel" ] && [ "$(dpkg --print-architecture)" != "armel" ]; then
 
 
     DEBOOTSTRAP="qemu-debootstrap"
 
     DEBOOTSTRAP="qemu-debootstrap"
 
fi
 
fi
 
if [ "$ARCH" == "armhf" ] && [ "$(dpkg --print-architecture)" != "armhf" ]; then
 
if [ "$ARCH" == "armhf" ] && [ "$(dpkg --print-architecture)" != "armhf" ]; then
 
 
     DEBOOTSTRAP="qemu-debootstrap"
 
     DEBOOTSTRAP="qemu-debootstrap"
 
fi
 
fi
 
 
DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}" "--arch=$ARCH")
 
DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}" "--arch=$ARCH")
 
BASETGZ="/var/cache/pbuilder/$NAME-base.tgz"
 
BASETGZ="/var/cache/pbuilder/$NAME-base.tgz"
Line 102: Line 85:
 
BUILDPLACE="/var/cache/pbuilder/build"
 
BUILDPLACE="/var/cache/pbuilder/build"
 
HOOKDIR="/var/cache/pbuilder/hook.d/"
 
HOOKDIR="/var/cache/pbuilder/hook.d/"
 +
</pre>
 +
 +
The .pbuilderrc file cares about three environment variables:
 +
 +
OS: Either debian, raspbian, or ubuntu
 +
DIST: For example wheezy, jessie, trusty, stretch ...
 +
ARCH: For example amd64, i386, armel, or armhf
 +
 +
Examples:
 +
 +
<pre>sudo OS=debian DIST=wheezy ARCH=amd64 pbuilder --create
 +
sudo OS=debian DIST=wheezy ARCH=i386 pbuilder --create
 +
sudo OS=debian DIST=wheezy ARCH=armel pbuilder --create
 +
sudo OS=debian DIST=wheezy ARCH=armhf pbuilder --create
 
</pre>
 
</pre>

Latest revision as of 21:45, 24 June 2019

Overview

What we learn in this chapter? Install, play and fun with Debian distro ...


Host Enviroment

We suggest use Debian 9.02 (64 bits) in your host, you can download it from our server using this link or directly from debian website. You can install it in a Virtual Machine enviroment using any Virtualization software or directly in your PC.

After install is recommended update the package list with:

sudo apt-get update

Install Development packages

Now is time to install some packages if you want to build your own distribution.

GCC, G++, libc Cross Compiler

You can install the cross compiler if you want to build u-boot, linux kernel or applications using your host PC and compile for IGEP board as target.

sudo apt-get install gcc-arm-linux-gnueabi gcc-arm-linux-gnueabihf g++-arm-linux-gnueabi g++-arm-linux-gnueabihf libc6-armel-cross libc6-armhf-cross libc6-dev-armhf-cross libc6-dev-armel-cross crossbuild-essential-armel crossbuild-essential-armhf

Build Ubuntu packages

if you're idea is build ubuntu packages then you need install other packages

sudo apt-get install build-essential devscripts dh-make quilt autogen autoconf dh-autoreconf dh-buildinfo dh-make pkg-config kernel-package debootstrap

Pbuilder

A pbuilder environment is a chrooted environment which can have a different distro series or architecture than your host system.

sudo apt-get install pbuilder pbuilder-scripts qemu-user-static debian-keyring debian-archive-keyring ubuntu-keyring emdebian-archive-keyring debian-ports-archive-keyring

Create ~/.pbuilderrc file with your own pbuilder setup script, upu can use below script:

# !/bin/sh
set -e
if [ "$OS" == "debian" ]; then
    MIRRORSITE="http://ftp.no.debian.org/debian/"
    COMPONENTS="main contrib non-free"
    DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}"
         "--keyring=/usr/share/keyrings/debian-archive-keyring.gpg")
    : ${DIST:="wheezy"}
    : ${ARCH:="amd64"}
    if [ "$DIST" == "wheezy" ]; then
        #EXTRAPACKAGES="$EXTRAPACKAGES debian-backports-keyring"
        OTHERMIRROR="$OTHERMIRROR | deb $MIRRORSITE wheezy-backports $COMPONENTS"
    fi
elif [ "$OS" == "raspbian" ]; then
    MIRRORSITE="http://ftp.acc.umu.se/mirror/raspbian/raspbian/"
    COMPONENTS="main contrib non-free"
    DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}"
        "--keyring=/usr/share/keyrings/raspbian-archive-keyring.gpg")
    : ${DIST:="wheezy"}
    : ${ARCH:="armhf"}
elif [ "$OS" == "ubuntu" ]; then
    MIRRORSITE="http://no.archive.ubuntu.com/ubuntu/"
    COMPONENTS="main restricted universe multiverse"
    DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}"
        "--keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg")
else
    echo "Unknown OS: $OS"
    exit 1
fi
if [ "$DIST" == "" ]; then
    echo "DIST is not set"
    exit 1
fi
if [ "$ARCH" == "" ]; then
    echo "ARCH is not set"
    exit 1
fi
NAME="$OS-$DIST-$ARCH"
if [ "$ARCH" == "armel" ] && [ "$(dpkg --print-architecture)" != "armel" ]; then
    DEBOOTSTRAP="qemu-debootstrap"
fi
if [ "$ARCH" == "armhf" ] && [ "$(dpkg --print-architecture)" != "armhf" ]; then
    DEBOOTSTRAP="qemu-debootstrap"
fi
DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}" "--arch=$ARCH")
BASETGZ="/var/cache/pbuilder/$NAME-base.tgz"
DISTRIBUTION="$DIST"
BUILDRESULT="/var/cache/pbuilder/$NAME/result/"
APTCACHE="/var/cache/pbuilder/$NAME/aptcache/"
BUILDPLACE="/var/cache/pbuilder/build"
HOOKDIR="/var/cache/pbuilder/hook.d/"

The .pbuilderrc file cares about three environment variables:

OS: Either debian, raspbian, or ubuntu DIST: For example wheezy, jessie, trusty, stretch ... ARCH: For example amd64, i386, armel, or armhf

Examples:

sudo OS=debian DIST=wheezy ARCH=amd64 pbuilder --create
sudo OS=debian DIST=wheezy ARCH=i386 pbuilder --create
sudo OS=debian DIST=wheezy ARCH=armel pbuilder --create
sudo OS=debian DIST=wheezy ARCH=armhf pbuilder --create