2015-12-02 20:33:32 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Copyright (c) 2015 Igor Pecovnik, igor.pecovnik@gma**.com
|
|
|
|
#
|
|
|
|
# This file is licensed under the terms of the GNU General Public
|
|
|
|
# License version 2. This program is licensed "as is" without any
|
|
|
|
# warranty of any kind, whether express or implied.
|
|
|
|
#
|
|
|
|
# This file is a part of tool chain https://github.com/igorpecovnik/lib
|
|
|
|
#
|
2016-02-26 17:49:02 +03:00
|
|
|
|
|
|
|
# common options
|
2017-02-26 19:05:45 +03:00
|
|
|
REVISION="5.27$SUBREVISION" # all boards have same revision
|
2016-02-26 17:49:02 +03:00
|
|
|
ROOTPWD="1234" # Must be changed @first login
|
|
|
|
MAINTAINER="Igor Pecovnik" # deb signature
|
|
|
|
MAINTAINERMAIL="igor.pecovnik@****l.com" # deb signature
|
|
|
|
TZDATA=`cat /etc/timezone` # Timezone for target is taken from host or defined here.
|
2016-08-30 19:25:32 +03:00
|
|
|
USEALLCORES=yes # Use all CPU cores for compiling
|
2016-02-26 17:49:02 +03:00
|
|
|
EXIT_PATCHING_ERROR="" # exit patching if failed
|
2017-04-11 14:05:46 +02:00
|
|
|
HOST="$(echo "$BOARD" | cut -f1 -d-)" # set hostname to the board
|
2016-03-17 20:16:26 +01:00
|
|
|
CACHEDIR=$DEST/cache
|
2017-02-21 15:40:17 +03:00
|
|
|
ROOTFSCACHE_VERSION=3
|
2016-10-11 20:01:03 +03:00
|
|
|
|
2016-08-30 19:25:32 +03:00
|
|
|
[[ -z $ROOTFS_TYPE ]] && ROOTFS_TYPE=ext4 # default rootfs type is ext4
|
2016-10-11 20:01:03 +03:00
|
|
|
[[ "ext4 f2fs btrfs nfs fel" != *$ROOTFS_TYPE* ]] && exit_with_error "Unknown rootfs type" "$ROOTFS_TYPE"
|
|
|
|
|
|
|
|
# Fixed image size is in 1M dd blocks (MiB)
|
|
|
|
# to get size of block device /dev/sdX execute as root:
|
|
|
|
# echo $(( $(blockdev --getsize64 /dev/sdX) / 1024 / 1024 ))
|
|
|
|
[[ "btrfs f2fs" == *$ROOTFS_TYPE* && -z $FIXED_IMAGE_SIZE ]] && exit_with_error "Please define FIXED_IMAGE_SIZE"
|
|
|
|
|
2016-10-15 00:34:27 +03:00
|
|
|
# small SD card with kernel, boot script and .dtb/.bin files
|
2016-10-11 20:01:03 +03:00
|
|
|
[[ $ROOTFS_TYPE == nfs ]] && FIXED_IMAGE_SIZE=64
|
2016-02-26 17:49:02 +03:00
|
|
|
|
2016-05-02 16:33:37 +03:00
|
|
|
# used by multiple sources - reduce code duplication
|
|
|
|
if [[ $USE_MAINLINE_GOOGLE_MIRROR == yes ]]; then
|
2016-08-11 17:52:37 +03:00
|
|
|
MAINLINE_KERNEL_SOURCE='https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable'
|
2016-05-02 16:33:37 +03:00
|
|
|
else
|
2016-08-11 17:52:37 +03:00
|
|
|
MAINLINE_KERNEL_SOURCE='git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git'
|
2016-05-02 16:33:37 +03:00
|
|
|
fi
|
2016-07-27 20:38:29 +03:00
|
|
|
# allow upgrades for same major.minor versions
|
2017-05-14 17:59:04 +03:00
|
|
|
ARMBIAN_MAINLINE_KERNEL_VERSION='4.11'
|
2016-10-07 18:56:47 +03:00
|
|
|
MAINLINE_KERNEL_BRANCH=tag:v$(wget -qO- https://www.kernel.org/finger_banner | awk '{print $NF}' | grep -oE "^${ARMBIAN_MAINLINE_KERNEL_VERSION//./\\.}\.?[[:digit:]]*" | tail -1)
|
2016-08-21 01:39:21 +03:00
|
|
|
MAINLINE_KERNEL_DIR='linux-vanilla'
|
2016-03-17 20:16:26 +01:00
|
|
|
|
2016-11-24 18:44:30 +01:00
|
|
|
if [[ $USE_GITHUB_UBOOT_MIRROR == yes ]]; then
|
|
|
|
MAINLINE_UBOOT_SOURCE='https://github.com/RobertCNelson/u-boot'
|
2016-12-08 18:44:41 +03:00
|
|
|
else
|
2016-11-24 18:44:30 +01:00
|
|
|
MAINLINE_UBOOT_SOURCE='git://git.denx.de/u-boot.git'
|
|
|
|
fi
|
2017-05-08 19:56:18 +03:00
|
|
|
MAINLINE_UBOOT_BRANCH='tag:v2017.05'
|
2016-08-11 17:52:37 +03:00
|
|
|
MAINLINE_UBOOT_DIR='u-boot'
|
2016-03-17 20:16:26 +01:00
|
|
|
|
2016-09-17 18:40:04 +02:00
|
|
|
# Let's set default data if not defined in board configuration above
|
2017-03-01 20:10:00 +01:00
|
|
|
[[ -z $OFFSET ]] && OFFSET=1 # Bootloader space in MB (1 x 2048 = default)
|
2016-08-21 16:58:17 +03:00
|
|
|
ARCH=armhf
|
|
|
|
KERNEL_IMAGE_TYPE=zImage
|
|
|
|
SERIALCON=ttyS0
|
2016-10-14 22:04:32 +03:00
|
|
|
|
2017-04-23 16:56:19 +03:00
|
|
|
# single ext4 partition is the default and preferred configuration
|
2017-04-26 17:42:35 +03:00
|
|
|
#BOOTFS_TYPE=''
|
2016-08-21 16:58:17 +03:00
|
|
|
|
2016-11-23 20:05:43 +01:00
|
|
|
# set unique mounting directory
|
2016-12-30 17:35:13 +01:00
|
|
|
SDCARD="sdcard-${BRANCH}-${BOARD}-${RELEASE}-${BUILD_DESKTOP}"
|
|
|
|
MOUNT="mount-${BRANCH}-${BOARD}-${RELEASE}-${BUILD_DESKTOP}"
|
|
|
|
DESTIMG="image-${BRANCH}-${BOARD}-${RELEASE}-${BUILD_DESKTOP}"
|
2016-11-23 20:05:43 +01:00
|
|
|
|
2017-02-11 18:46:25 +03:00
|
|
|
[[ ! -f $SRC/lib/config/sources/$LINUXFAMILY.conf ]] && \
|
2016-08-21 16:58:17 +03:00
|
|
|
exit_with_error "Sources configuration not found" "$LINUXFAMILY"
|
2017-02-11 18:46:25 +03:00
|
|
|
|
|
|
|
source $SRC/lib/config/sources/$LINUXFAMILY.conf
|
2016-04-16 18:06:21 +03:00
|
|
|
|
2016-10-26 18:01:41 +03:00
|
|
|
if [[ -f $SRC/userpatches/sources/$LINUXFAMILY.conf ]]; then
|
|
|
|
display_alert "Adding user provided $LINUXFAMILY overrides"
|
|
|
|
source $SRC/userpatches/sources/$LINUXFAMILY.conf
|
|
|
|
fi
|
|
|
|
|
2016-04-16 18:06:21 +03:00
|
|
|
case $ARCH in
|
|
|
|
arm64)
|
2016-08-21 16:58:17 +03:00
|
|
|
[[ -z $KERNEL_COMPILER ]] && KERNEL_COMPILER="aarch64-linux-gnu-"
|
|
|
|
[[ -z $UBOOT_COMPILER ]] && UBOOT_COMPILER="aarch64-linux-gnu-"
|
|
|
|
[[ -z $INITRD_ARCH ]] && INITRD_ARCH=arm64
|
2016-04-18 19:20:15 +03:00
|
|
|
QEMU_BINARY="qemu-aarch64-static"
|
2016-08-21 16:58:17 +03:00
|
|
|
ARCHITECTURE=arm64
|
2016-04-16 18:06:21 +03:00
|
|
|
;;
|
|
|
|
|
|
|
|
armhf)
|
2016-08-21 16:58:17 +03:00
|
|
|
[[ -z $KERNEL_COMPILER ]] && KERNEL_COMPILER="arm-linux-gnueabihf-"
|
|
|
|
[[ -z $UBOOT_COMPILER ]] && UBOOT_COMPILER="arm-linux-gnueabihf-"
|
|
|
|
[[ -z $INITRD_ARCH ]] && INITRD_ARCH=arm
|
2016-04-18 19:20:15 +03:00
|
|
|
QEMU_BINARY="qemu-arm-static"
|
2016-08-21 16:58:17 +03:00
|
|
|
ARCHITECTURE=arm
|
2016-04-16 18:06:21 +03:00
|
|
|
;;
|
|
|
|
esac
|
2016-02-26 19:25:49 +03:00
|
|
|
|
2016-08-21 01:39:21 +03:00
|
|
|
[[ -z $LINUXCONFIG ]] && LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
|
|
|
|
|
2017-05-02 12:47:47 +03:00
|
|
|
[[ -z $BOOTPATCHDIR ]] && BOOTPATCHDIR="u-boot-$LINUXFAMILY"
|
2017-05-02 12:50:35 +03:00
|
|
|
[[ -z $KERNELPATCHDIR ]] && KERNELPATCHDIR="$LINUXFAMILY-$BRANCH"
|
2017-05-02 12:47:47 +03:00
|
|
|
|
2017-01-12 15:31:53 +03:00
|
|
|
if [[ $RELEASE == xenial ]]; then DISTRIBUTION="Ubuntu"; else DISTRIBUTION="Debian"; fi
|
2016-08-21 01:39:21 +03:00
|
|
|
|
2016-02-26 19:25:49 +03:00
|
|
|
# Essential packages
|
2016-12-08 18:44:41 +03:00
|
|
|
PACKAGE_LIST="bc bridge-utils build-essential cpufrequtils device-tree-compiler figlet fbset fping \
|
|
|
|
iw fake-hwclock wpasupplicant psmisc ntp parted rsync sudo curl linux-base dialog crda \
|
|
|
|
wireless-regdb ncurses-term python3-apt sysfsutils toilet u-boot-tools unattended-upgrades \
|
|
|
|
usbutils wireless-tools console-setup console-common unicode-data openssh-server initramfs-tools \
|
2017-05-09 10:48:33 -07:00
|
|
|
ca-certificates resolvconf"
|
2016-06-19 11:46:07 +03:00
|
|
|
|
|
|
|
# development related packages. remove when they are not needed for building packages in chroot
|
2016-08-30 19:25:32 +03:00
|
|
|
PACKAGE_LIST="$PACKAGE_LIST automake libwrap0-dev libssl-dev libusb-dev libusb-1.0-0-dev libnl-3-dev libnl-genl-3-dev"
|
2016-02-26 19:25:49 +03:00
|
|
|
|
|
|
|
# Non-essential packages
|
2016-12-08 18:44:41 +03:00
|
|
|
PACKAGE_LIST_ADDITIONAL="alsa-utils btrfs-tools dosfstools hddtemp iotop iozone3 stress sysbench screen ntfs-3g vim pciutils \
|
|
|
|
evtest htop pv lsof apt-transport-https libfuse2 libdigest-sha-perl libproc-processtable-perl aptitude dnsutils f3 haveged \
|
2017-02-05 19:05:18 +03:00
|
|
|
hdparm rfkill vlan sysstat bluez bluez-tools bash-completion hostapd git ethtool network-manager unzip ifenslave lirc \
|
2017-05-06 12:02:01 +03:00
|
|
|
libpam-systemd iperf3 software-properties-common libnss-myhostname f2fs-tools avahi-autoipd iputils-arping"
|
2016-02-26 19:25:49 +03:00
|
|
|
|
2017-05-14 21:45:54 +02:00
|
|
|
PACKAGE_LIST_DESKTOP="xserver-xorg xserver-xorg-video-fbdev gvfs-backends gvfs-fuse xfonts-base xinit nodm x11-xserver-utils xfce4 lxtask xterm mirage thunar-volman galculator hexchat \
|
2016-08-19 19:03:14 +02:00
|
|
|
gtk2-engines gtk2-engines-murrine gtk2-engines-pixbuf libgtk2.0-bin gcj-jre-headless xfce4-screenshooter libgnome2-perl gksu bluetooth \
|
2016-10-18 18:35:38 +02:00
|
|
|
network-manager-gnome xfce4-notifyd gnome-keyring gcr libgck-1-0 libgcr-3-common p11-kit pasystray pavucontrol pulseaudio \
|
2017-01-16 20:43:24 +03:00
|
|
|
paman pavumeter pulseaudio-module-gconf pulseaudio-module-bluetooth blueman libpam-gnome-keyring libgl1-mesa-dri mpv \
|
2017-05-21 17:59:07 +02:00
|
|
|
libreoffice-writer libreoffice-style-tango libreoffice-gtk policykit-1 fbi xfce4-power-manager profile-sync-daemon"
|
2016-06-17 19:00:11 +03:00
|
|
|
|
2016-02-26 19:25:49 +03:00
|
|
|
# Release specific packages
|
|
|
|
case $RELEASE in
|
|
|
|
jessie)
|
2017-02-05 19:05:18 +03:00
|
|
|
PACKAGE_LIST_RELEASE="less kbd"
|
2017-01-16 20:43:24 +03:00
|
|
|
PACKAGE_LIST_DESKTOP="$PACKAGE_LIST_DESKTOP mozo pluma iceweasel policykit-1-gnome eject"
|
2016-02-26 19:25:49 +03:00
|
|
|
;;
|
2016-03-08 21:22:35 +03:00
|
|
|
xenial)
|
2017-01-31 17:48:32 +03:00
|
|
|
PACKAGE_LIST_RELEASE="man-db wget nano linux-firmware"
|
2017-05-14 21:45:54 +02:00
|
|
|
PACKAGE_LIST_DESKTOP="$PACKAGE_LIST_DESKTOP thunderbird chromium-browser gnome-icon-theme-full tango-icon-theme language-selector-gnome paprefs numix-gtk-theme"
|
2017-01-31 16:48:59 +03:00
|
|
|
[[ $ARCH == armhf ]] && PACKAGE_LIST_DESKTOP="$PACKAGE_LIST_DESKTOP mate-utils ubuntu-mate-welcome mate-settings-daemon"
|
2016-02-26 19:25:49 +03:00
|
|
|
;;
|
2017-02-05 19:05:18 +03:00
|
|
|
stretch)
|
|
|
|
PACKAGE_LIST_RELEASE="man-db less kbd"
|
|
|
|
;;
|
2016-02-26 19:25:49 +03:00
|
|
|
esac
|
|
|
|
|
2016-05-04 17:16:39 +03:00
|
|
|
DEBIAN_MIRROR='httpredir.debian.org/debian'
|
|
|
|
UBUNTU_MIRROR='ports.ubuntu.com/'
|
|
|
|
|
2016-03-17 20:16:26 +01:00
|
|
|
# For user override
|
2016-05-02 16:33:37 +03:00
|
|
|
if [[ -f $SRC/userpatches/lib.config ]]; then
|
2016-02-26 17:49:02 +03:00
|
|
|
display_alert "Using user configuration override" "userpatches/lib.config" "info"
|
|
|
|
source $SRC/userpatches/lib.config
|
|
|
|
fi
|
2016-02-26 19:25:49 +03:00
|
|
|
|
2016-05-04 17:16:39 +03:00
|
|
|
# apt-cacher-ng mirror configurarion
|
2016-05-06 23:59:36 +03:00
|
|
|
if [[ $DISTRIBUTION == Ubuntu ]]; then
|
2016-05-04 17:16:39 +03:00
|
|
|
APT_MIRROR=$UBUNTU_MIRROR
|
|
|
|
else
|
|
|
|
APT_MIRROR=$DEBIAN_MIRROR
|
|
|
|
fi
|
|
|
|
|
|
|
|
[[ -n $APT_PROXY_ADDR ]] && display_alert "Using custom apt-cacher-ng address" "$APT_PROXY_ADDR" "info"
|
|
|
|
|
2016-02-26 19:25:49 +03:00
|
|
|
# Build final package list after possible override
|
2016-05-02 16:33:37 +03:00
|
|
|
PACKAGE_LIST="$PACKAGE_LIST $PACKAGE_LIST_RELEASE $PACKAGE_LIST_ADDITIONAL"
|
2016-10-09 21:12:19 +03:00
|
|
|
if [[ $ARCH == arm64 ]]; then
|
|
|
|
PACKAGE_LIST_DESKTOP="${PACKAGE_LIST_DESKTOP/iceweasel/iceweasel:armhf}"
|
2017-05-08 13:46:04 +02:00
|
|
|
PACKAGE_LIST_DESKTOP="${PACKAGE_LIST_DESKTOP/thunderbird/thunderbird:armhf}"
|
2016-10-09 21:12:19 +03:00
|
|
|
fi
|
2016-05-02 16:33:37 +03:00
|
|
|
[[ $BUILD_DESKTOP == yes ]] && PACKAGE_LIST="$PACKAGE_LIST $PACKAGE_LIST_DESKTOP"
|
2017-02-11 18:46:25 +03:00
|
|
|
|
2015-12-07 14:30:29 +01:00
|
|
|
# debug
|
2016-06-27 14:13:27 +03:00
|
|
|
cat <<-EOF >> $DEST/debug/output.log
|
2016-09-12 21:22:32 +03:00
|
|
|
## BUILD SCRIPT ENVIRONMENT
|
|
|
|
|
|
|
|
Version: $(cd $SRC/lib; git rev-parse @)
|
|
|
|
|
2016-06-27 14:13:27 +03:00
|
|
|
## BUILD CONFIGURATION
|
2016-09-12 21:22:32 +03:00
|
|
|
|
|
|
|
Build target:
|
|
|
|
Board: $BOARD
|
|
|
|
Branch: $BRANCH
|
2017-04-23 16:56:19 +03:00
|
|
|
Desktop: $BUILD_DESKTOP
|
2016-09-12 21:22:32 +03:00
|
|
|
|
2016-08-11 17:52:37 +03:00
|
|
|
Kernel configuration:
|
|
|
|
Repository: $KERNELSOURCE
|
2016-06-27 14:13:27 +03:00
|
|
|
Branch: $KERNELBRANCH
|
2016-08-11 17:52:37 +03:00
|
|
|
Config file: $LINUXCONFIG
|
|
|
|
|
|
|
|
U-boot configuration:
|
|
|
|
Repository: $BOOTSOURCE
|
|
|
|
Branch: $BOOTBRANCH
|
2017-04-23 16:56:19 +03:00
|
|
|
Config file: $BOOTCONFIG
|
|
|
|
|
|
|
|
Partitioning configuration:
|
|
|
|
Root partition type: $ROOTFS_TYPE
|
|
|
|
Boot partition type: ${BOOTFS_TYPE:-(none)}
|
|
|
|
User provided boot partition size: ${BOOTSIZE:-0}
|
2016-06-27 14:13:27 +03:00
|
|
|
Offset: $OFFSET
|
2016-08-11 17:52:37 +03:00
|
|
|
|
|
|
|
CPU configuration:
|
|
|
|
$CPUMIN - $CPUMAX with $GOVERNOR
|
2016-06-27 14:13:27 +03:00
|
|
|
EOF
|