first commit
This commit is contained in:
131
external/config/templates/Dockerfile
vendored
Normal file
131
external/config/templates/Dockerfile
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
FROM ubuntu:22.04
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get update && apt-get -y install \
|
||||
joe \
|
||||
software-properties-common \
|
||||
gnupg \
|
||||
gnupg1 \
|
||||
gpgv1 \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN sh -c " \
|
||||
if [ $(dpkg --print-architecture) = amd64 ]; then \
|
||||
apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
lib32ncurses6 \
|
||||
lib32stdc++6 \
|
||||
lib32tinfo6 \
|
||||
libc6-i386; \
|
||||
fi"
|
||||
RUN apt-get update \
|
||||
&& apt-get -y upgrade \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
acl \
|
||||
aptly \
|
||||
aria2 \
|
||||
bc \
|
||||
binfmt-support \
|
||||
binutils \
|
||||
bison \
|
||||
btrfs-progs \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
ccache \
|
||||
cpio \
|
||||
cryptsetup \
|
||||
cryptsetup-bin \
|
||||
debian-archive-keyring \
|
||||
debian-keyring \
|
||||
debootstrap \
|
||||
device-tree-compiler \
|
||||
dialog \
|
||||
distcc \
|
||||
dosfstools \
|
||||
dwarves \
|
||||
f2fs-tools \
|
||||
fakeroot \
|
||||
fdisk \
|
||||
flex \
|
||||
gawk \
|
||||
gcc-arm-linux-gnueabihf \
|
||||
gcc-arm-linux-gnueabi \
|
||||
gcc-arm-none-eabi \
|
||||
gdisk \
|
||||
git \
|
||||
imagemagick \
|
||||
jq \
|
||||
kmod \
|
||||
libbison-dev \
|
||||
libc6-amd64-cross \
|
||||
libc6-dev-armhf-cross \
|
||||
libfdt-dev \
|
||||
libelf-dev \
|
||||
libfile-fcntllock-perl \
|
||||
libfl-dev \
|
||||
liblz4-tool \
|
||||
libncurses5-dev \
|
||||
libpython2.7-dev \
|
||||
libpython3-dev \
|
||||
libssl-dev \
|
||||
libusb-1.0-0-dev \
|
||||
linux-base \
|
||||
locales \
|
||||
lsb-release \
|
||||
lzop \
|
||||
ncurses-base \
|
||||
ncurses-term \
|
||||
nfs-kernel-server \
|
||||
ntpdate \
|
||||
openssh-client \
|
||||
p7zip-full \
|
||||
parted \
|
||||
patchutils \
|
||||
pigz \
|
||||
pixz \
|
||||
pkg-config \
|
||||
psmisc \
|
||||
pv \
|
||||
python2 \
|
||||
python3 \
|
||||
python3-dev \
|
||||
python3-distutils \
|
||||
python3-pkg-resources \
|
||||
python3-setuptools \
|
||||
qemu \
|
||||
qemu-utils \
|
||||
qemu-user-static \
|
||||
rsync \
|
||||
swig \
|
||||
sudo \
|
||||
systemd-container \
|
||||
tzdata \
|
||||
u-boot-tools \
|
||||
udev \
|
||||
unzip \
|
||||
uuid \
|
||||
uuid-dev \
|
||||
uuid-runtime \
|
||||
wget \
|
||||
whiptail \
|
||||
xfsprogs \
|
||||
xxd \
|
||||
zip \
|
||||
zlib1g-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN locale-gen en_US.UTF-8
|
||||
|
||||
RUN git config --system --add safe.directory /root/orangepi
|
||||
|
||||
# Static port for NFSv3 server used for USB FEL boot
|
||||
RUN sed -i 's/\(^STATDOPTS=\).*/\1"--port 32765 --outgoing-port 32766"/' /etc/default/nfs-common \
|
||||
&& sed -i 's/\(^RPCMOUNTDOPTS=\).*/\1"--port 32767"/' /etc/default/nfs-kernel-server
|
||||
|
||||
RUN echo 'loop max_loop=128' >> /etc/modules
|
||||
|
||||
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8' TERM=screen
|
||||
WORKDIR /root/orangepi
|
||||
LABEL org.opencontainers.image.source="https://github.com/orangepi-xunlong/orangepi-build/blob/main/external/config/templates/Dockerfile" \
|
||||
|
||||
org.opencontainers.image.authors="Igor Pecovnik" \
|
||||
org.opencontainers.image.licenses="GPL-2.0"
|
||||
ENTRYPOINT [ "/bin/bash", "/root/orangepi/build.sh" ]
|
||||
53
external/config/templates/Vagrantfile
vendored
Normal file
53
external/config/templates/Vagrantfile
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
Vagrant.require_version ">= 1.5"
|
||||
|
||||
$provisioning_script = <<SCRIPT
|
||||
# use remote git version instead of sharing a copy from host to preserve proper file permissions
|
||||
# and prevent permission related issues for the temp directory
|
||||
git clone https://github.com/armbian/build /home/vagrant/armbian
|
||||
mkdir -p /vagrant/output /vagrant/userpatches
|
||||
ln -sf /vagrant/output /home/vagrant/armbian/output
|
||||
ln -sf /vagrant/userpatches /home/vagrant/armbian/userpatches
|
||||
SCRIPT
|
||||
|
||||
Vagrant.configure(2) do |config|
|
||||
|
||||
# What box should we base this build on?
|
||||
config.vm.box = "ubuntu/focal64"
|
||||
config.vm.box_version = ">= 20180719.0.0"
|
||||
|
||||
# Default images are not big enough to build Armbian.
|
||||
config.vagrant.plugins = "vagrant-disksize"
|
||||
config.disksize.size = "40GB"
|
||||
|
||||
# provisioning: install dependencies, download the repository copy
|
||||
config.vm.provision "shell", inline: $provisioning_script
|
||||
|
||||
# forward terminal type for better compatibility with Dialog - disabled on Ubuntu by default
|
||||
config.ssh.forward_env = ["TERM"]
|
||||
|
||||
# default user name is "ubuntu", please do not change it
|
||||
|
||||
# SSH password auth is disabled by default, uncomment to enable and set the password
|
||||
#config.ssh.password = "armbian"
|
||||
|
||||
config.vm.provider "virtualbox" do |vb|
|
||||
vb.name = "Armbian Builder"
|
||||
|
||||
# uncomment this to enable the VirtualBox GUI
|
||||
#vb.gui = true
|
||||
|
||||
# Tweak these to fit your needs.
|
||||
#vb.memory = "8192"
|
||||
#vb.cpus = "4"
|
||||
end
|
||||
|
||||
case File.basename(Dir.getwd)
|
||||
when "templates"
|
||||
config.vm.synced_folder "../..", "/vagrant"
|
||||
when "userpatches"
|
||||
config.vm.synced_folder "..", "/vagrant"
|
||||
end
|
||||
end
|
||||
10
external/config/templates/build_all.config
vendored
Normal file
10
external/config/templates/build_all.config
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
START="0"
|
||||
BSP_BUILD="no"
|
||||
MULTITHREAD="0"
|
||||
STABILITY="stable"
|
||||
BUILD_OPT="image"
|
||||
BRANCH_OVER=""
|
||||
RELEASE_OVER=""
|
||||
CLEAN_LEVEL="oldcache"
|
||||
KERNEL_CONFIGURE="no"
|
||||
REBUILD_IMAGES=""
|
||||
144
external/config/templates/config-docker.conf
vendored
Normal file
144
external/config/templates/config-docker.conf
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
# DO NOT EDIT THIS FILE
|
||||
#
|
||||
# This is a Docker launcher file. To set up the configuration, use command line arguments to compile.sh
|
||||
# or use pass a config file as a parameter ./compile docker [example] BUILD_KERNEL="yes" ...
|
||||
|
||||
[[ ! -c /dev/loop-control ]] && display_alert "/dev/loop-control does not exist, image building may not work" "" "wrn"
|
||||
|
||||
# second argument can be a build parameter or a config file
|
||||
# create user accessible directories and set their owner group and permissions
|
||||
# if they are created from Docker they will be owned by root and require root permissions to change/delete
|
||||
mkdir -p $SRC/{output,userpatches}
|
||||
grep -q '^docker:' /etc/group && chgrp --quiet docker $SRC/{output,userpatches}
|
||||
chmod --quiet g+w,g+s $SRC/{output,userpatches}
|
||||
VERSION=latest
|
||||
|
||||
if grep -q $VERSION <(grep orangepi <(docker images)); then
|
||||
display_alert "Using existed a orangepi Docker container"
|
||||
else
|
||||
# build a new container based on provided Dockerfile
|
||||
display_alert "Docker container not found or out of date"
|
||||
display_alert "Building a Docker container"
|
||||
if ! docker build -t orangepi:$VERSION . ; then
|
||||
STATUS=$?
|
||||
# Adding a newline, so the alert won't be shown in the same line as the error
|
||||
echo
|
||||
display_alert "Docker container build exited with code: " "$STATUS" "err"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
DOCKER_FLAGS=()
|
||||
|
||||
# Running this container in privileged mode is a simple way to solve loop device access issues
|
||||
# Required for USB FEL or when writing image directly to the block device, when CARD_DEVICE is defined
|
||||
#DOCKER_FLAGS+=(--privileged)
|
||||
|
||||
# add only required capabilities instead (though MKNOD should be already present)
|
||||
# CAP_SYS_PTRACE is required for systemd-detect-virt in some cases
|
||||
DOCKER_FLAGS+=(--cap-add=SYS_ADMIN --cap-add=MKNOD --cap-add=SYS_PTRACE)
|
||||
|
||||
# mounting things inside the container on Ubuntu won't work without this
|
||||
# https://github.com/moby/moby/issues/16429#issuecomment-217126586
|
||||
DOCKER_FLAGS+=(--security-opt=apparmor:unconfined)
|
||||
|
||||
# remove resulting container after exit to minimize clutter
|
||||
# bad side effect - named volumes are considered not attached to anything and are removed on "docker volume prune"
|
||||
DOCKER_FLAGS+=(--rm)
|
||||
|
||||
# pass through loop devices
|
||||
for d in /dev/loop*; do
|
||||
DOCKER_FLAGS+=(--device=$d)
|
||||
done
|
||||
|
||||
# accessing dynamically created devices won't work by default
|
||||
# and --device doesn't accept devices that don't exist at the time "docker run" is executed
|
||||
# https://github.com/moby/moby/issues/27886
|
||||
# --device-cgroup-rule requires new Docker version
|
||||
|
||||
# Test for --device-cgroup-rule support. If supported, appends it
|
||||
# Otherwise, let it go and let user know that only kernel and u-boot for you
|
||||
if docker run --help | grep device-cgroup-rule > /dev/null 2>&1; then
|
||||
# allow loop devices (not required)
|
||||
DOCKER_FLAGS+=(--device-cgroup-rule='b 7:* rmw')
|
||||
# allow loop device partitions
|
||||
DOCKER_FLAGS+=(--device-cgroup-rule='b 259:* rmw')
|
||||
|
||||
# this is an ugly hack, but it is required to get /dev/loopXpY minor number
|
||||
# for mknod inside the container, and container itself still uses private /dev internally
|
||||
DOCKER_FLAGS+=(-v /dev:/tmp/dev:ro)
|
||||
else
|
||||
display_alert "Your Docker version does not support device-cgroup-rule" "" "wrn"
|
||||
display_alert "and will be able to create only Kernel and u-boot packages (KERNEL_ONLY=yes)" "" "wrn"
|
||||
fi
|
||||
|
||||
# Expose ports for NFS server inside docker container, required for USB FEL
|
||||
#DOCKER_FLAGS+=(-p 0.0.0.0:2049:2049 -p 0.0.0.0:2049:2049/udp -p 0.0.0.0:111:111 -p 0.0.0.0:111:111/udp -p 0.0.0.0:32765:32765 -p 0.0.0.0:32765:32765/udp -p 0.0.0.0:32767:32767 -p 0.0.0.0:32767:32767/udp)
|
||||
# Export usb device for FEL, required for USB FEL
|
||||
#DOCKER_FLAGS+=(-v /dev/bus/usb:/dev/bus/usb:ro)
|
||||
|
||||
# map source to Docker Working dir.
|
||||
DOCKER_FLAGS+=(-v=$SRC/:/root/orangepi/)
|
||||
|
||||
# mount 2 named volumes - for cacheable data and compiler cache
|
||||
DOCKER_FLAGS+=(-v=orangepi-cache:/root/orangepi/cache -v=orangepi-ccache:/root/.ccache)
|
||||
|
||||
DOCKER_FLAGS+=(-e COLUMNS="`tput cols`" -e LINES="`tput lines`")
|
||||
|
||||
# pass other command line arguments like KERNEL_ONLY=yes, KERNEL_CONFIGURE=yes, etc.
|
||||
# pass "docker-guest" as an additional config name that will be sourced in the container if exists
|
||||
if [[ $SHELL_ONLY == yes ]]; then
|
||||
display_alert "Running the container in shell mode" "" "info"
|
||||
cat <<\EOF
|
||||
Welcome to the docker shell of Armbian.
|
||||
|
||||
To build the whole thing using default profile, run:
|
||||
./compile.sh
|
||||
|
||||
To build the U-Boot only, run:
|
||||
# Optional: prepare the environment first if you had not run `./compile.sh`
|
||||
./compile.sh 'prepare_host && compile_sunxi_tools && install_rkbin_tools'
|
||||
|
||||
# build the U-Boot only
|
||||
./compile.sh compile_uboot
|
||||
|
||||
If you prefer to use profile, for example, `userpatches/config-my.conf`, try:
|
||||
./compile.sh my 'prepare_host && compile_sunxi_tools && install_rkbin_tools'
|
||||
./compile.sh my compile_uboot
|
||||
|
||||
EOF
|
||||
docker run "${DOCKER_FLAGS[@]}" -it --entrypoint /usr/bin/env orangepi:$VERSION "$@" /bin/bash
|
||||
else
|
||||
display_alert "Running the container" "" "info"
|
||||
docker run "${DOCKER_FLAGS[@]}" -it orangepi:$VERSION "$@"
|
||||
fi
|
||||
|
||||
# Docker error treatment
|
||||
STATUS=$?
|
||||
# Adding a newline, so the message won't be shown in the same line as the error
|
||||
echo
|
||||
case $STATUS in
|
||||
0)
|
||||
# No errors from either Docker or build script
|
||||
echo
|
||||
;;
|
||||
125)
|
||||
display_alert "Docker command failed, check syntax or version support. Error code: " "$STATUS" "err"
|
||||
;;
|
||||
126)
|
||||
display_alert "Failure when running containerd command. Error code: " "$STATUS" "err"
|
||||
;;
|
||||
127)
|
||||
display_alert "containerd command not found. Error code: " "$STATUS" "err"
|
||||
;;
|
||||
137)
|
||||
display_alert "Container exit from docker stop. Error code: " "$STATUS" "info"
|
||||
;;
|
||||
*)
|
||||
# Build script exited with error, but the error message should have been already printed
|
||||
echo
|
||||
;;
|
||||
esac
|
||||
|
||||
# don't need to proceed further on the host
|
||||
exit 0
|
||||
32
external/config/templates/config-example.conf
vendored
Normal file
32
external/config/templates/config-example.conf
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
KERNEL_CONFIGURE="" # leave empty to select each time, set to "yes" or "no" to skip dialog prompt
|
||||
CLEAN_LEVEL="debs,oldcache" # comma-separated list of clean targets: "make" = make clean for selected kernel and u-boot,
|
||||
# "debs" = delete packages in "./output/debs" for current branch and family,
|
||||
# "alldebs" = delete all packages in "./output/debs", "images" = delete "./output/images",
|
||||
# "cache" = delete "./output/cache", "sources" = delete "./sources"
|
||||
# "oldcache" = remove old cached rootfs except for the newest 8 files
|
||||
|
||||
DEST_LANG="en_US.UTF-8" # sl_SI.UTF-8, en_US.UTF-8
|
||||
|
||||
# advanced
|
||||
EXTERNAL_NEW="prebuilt" # compile and install or install prebuilt additional packages
|
||||
INSTALL_HEADERS="" # install kernel headers package
|
||||
LIB_TAG="master" # change to "branchname" to use any branch currently available.
|
||||
USE_TORRENT="yes" # use torrent network for faster toolchain and cache download
|
||||
DOWNLOAD_MIRROR="china" # set to "china" to use mirrors.tuna.tsinghua.edu.cn
|
||||
|
||||
BOARD=""
|
||||
BRANCH=""
|
||||
RELEASE=""
|
||||
WIREGUARD="no"
|
||||
BUILD_KSRC="no"
|
||||
INSTALL_KSRC="no"
|
||||
IGNORE_UPDATES=""
|
||||
COMPRESS_OUTPUTIMAGE="no"
|
||||
NO_APT_CACHER="yes"
|
||||
GITEE_SERVER="no"
|
||||
|
||||
#install_balena_etcher="yes"
|
||||
#install_zfs="yes"
|
||||
#install_docker="yes"
|
||||
#install_chromium="yes"
|
||||
#install_firefox="yes"
|
||||
27
external/config/templates/config-vagrant.conf
vendored
Normal file
27
external/config/templates/config-vagrant.conf
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
# DO NOT EDIT THIS FILE
|
||||
#
|
||||
# This is a Vagrant launcher file. To set up the configuration, use command line arguments to compile.sh
|
||||
|
||||
# remove "vagrant" from the command line
|
||||
shift
|
||||
|
||||
# second argument can be a build parameter or a config file
|
||||
unset VAGRANT_CONF
|
||||
[[ $1 != *=* ]] && VAGRANT_CONF=$1
|
||||
|
||||
display_alert "Building and running the Vagrant box"
|
||||
VAGRANT_INSTALL_LOCAL_PLUGINS=1 vagrant up || vagrant up
|
||||
|
||||
display_alert "SSH config for the Vagrant box"
|
||||
vagrant ssh-config
|
||||
|
||||
display_alert "Trying to connect using SSH"
|
||||
|
||||
IFS=' ' vagrant ssh -c "cd armbian; sudo ./compile.sh $VAGRANT_CONF $*"
|
||||
|
||||
display_alert "Press <Enter> to halt the Vagrant box"
|
||||
read
|
||||
vagrant halt
|
||||
|
||||
# don't need to proceed further on the host
|
||||
exit 0
|
||||
242
external/config/templates/customize-image.sh.template
vendored
Normal file
242
external/config/templates/customize-image.sh.template
vendored
Normal file
@@ -0,0 +1,242 @@
|
||||
#!/bin/bash
|
||||
|
||||
# arguments: $RELEASE $LINUXFAMILY $BOARD $BUILD_DESKTOP
|
||||
#
|
||||
# This is the image customization script
|
||||
|
||||
# NOTE: It is copied to /tmp directory inside the image
|
||||
# and executed there inside chroot environment
|
||||
# so don't reference any files that are not already installed
|
||||
|
||||
# NOTE: If you want to transfer files between chroot and host
|
||||
# userpatches/overlay directory on host is bind-mounted to /tmp/overlay in chroot
|
||||
# The sd card's root path is accessible via $SDCARD variable.
|
||||
|
||||
RELEASE=$1
|
||||
LINUXFAMILY=$2
|
||||
BOARD=$3
|
||||
BUILD_DESKTOP=$4
|
||||
|
||||
Main() {
|
||||
case $RELEASE in
|
||||
xenial)
|
||||
# your code here
|
||||
;;
|
||||
stretch)
|
||||
# your code here
|
||||
# InstallOpenMediaVault # uncomment to get an OMV 4 image
|
||||
;;
|
||||
buster)
|
||||
# your code here
|
||||
;;
|
||||
bullseye)
|
||||
# your code here
|
||||
;;
|
||||
bionic)
|
||||
# your code here
|
||||
;;
|
||||
focal)
|
||||
# your code here
|
||||
;;
|
||||
esac
|
||||
} # Main
|
||||
|
||||
InstallOpenMediaVault() {
|
||||
# use this routine to create a Debian based fully functional OpenMediaVault
|
||||
# image (OMV 3 on Jessie, OMV 4 with Stretch). Use of mainline kernel highly
|
||||
# recommended!
|
||||
#
|
||||
# Please note that this variant changes Orange Pi default security
|
||||
# policies since you end up with root password 'openmediavault' which
|
||||
# you have to change yourself later. SSH login as root has to be enabled
|
||||
# through OMV web UI first
|
||||
#
|
||||
# This routine is based on idea/code courtesy Benny Stark. For fixes,
|
||||
# discussion and feature requests please refer to
|
||||
# https://forum.armbian.com/index.php?/topic/2644-openmediavault-3x-customize-imagesh/
|
||||
|
||||
echo root:openmediavault | chpasswd
|
||||
rm /root/.not_logged_in_yet
|
||||
. /etc/default/cpufrequtils
|
||||
export LANG=C LC_ALL="en_US.UTF-8"
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
export APT_LISTCHANGES_FRONTEND=none
|
||||
|
||||
case ${RELEASE} in
|
||||
jessie)
|
||||
OMV_Name="erasmus"
|
||||
OMV_EXTRAS_URL="https://github.com/OpenMediaVault-Plugin-Developers/packages/raw/master/openmediavault-omvextrasorg_latest_all3.deb"
|
||||
;;
|
||||
stretch)
|
||||
OMV_Name="arrakis"
|
||||
OMV_EXTRAS_URL="https://github.com/OpenMediaVault-Plugin-Developers/packages/raw/master/openmediavault-omvextrasorg_latest_all4.deb"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Add OMV source.list and Update System
|
||||
cat > /etc/apt/sources.list.d/openmediavault.list <<- EOF
|
||||
deb https://openmediavault.github.io/packages/ ${OMV_Name} main
|
||||
## Uncomment the following line to add software from the proposed repository.
|
||||
deb https://openmediavault.github.io/packages/ ${OMV_Name}-proposed main
|
||||
|
||||
## This software is not part of OpenMediaVault, but is offered by third-party
|
||||
## developers as a service to OpenMediaVault users.
|
||||
# deb https://openmediavault.github.io/packages/ ${OMV_Name} partner
|
||||
EOF
|
||||
|
||||
# Add OMV and OMV Plugin developer keys, add Cloudshell 2 repo for XU4
|
||||
if [ "${BOARD}" = "odroidxu4" ]; then
|
||||
add-apt-repository -y ppa:kyle1117/ppa
|
||||
sed -i 's/jessie/xenial/' /etc/apt/sources.list.d/kyle1117-ppa-jessie.list
|
||||
fi
|
||||
mount --bind /dev/null /proc/mdstat
|
||||
apt-get update
|
||||
apt-get --yes --force-yes --allow-unauthenticated install openmediavault-keyring
|
||||
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7AA630A1EDEE7D73
|
||||
apt-get update
|
||||
|
||||
# install debconf-utils, postfix and OMV
|
||||
HOSTNAME="${BOARD}"
|
||||
debconf-set-selections <<< "postfix postfix/mailname string ${HOSTNAME}"
|
||||
debconf-set-selections <<< "postfix postfix/main_mailer_type string 'No configuration'"
|
||||
apt-get --yes --force-yes --allow-unauthenticated --fix-missing --no-install-recommends \
|
||||
-o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install \
|
||||
debconf-utils postfix
|
||||
# move newaliases temporarely out of the way (see Ubuntu bug 1531299)
|
||||
cp -p /usr/bin/newaliases /usr/bin/newaliases.bak && ln -sf /bin/true /usr/bin/newaliases
|
||||
sed -i -e "s/^::1 localhost.*/::1 ${HOSTNAME} localhost ip6-localhost ip6-loopback/" \
|
||||
-e "s/^127.0.0.1 localhost.*/127.0.0.1 ${HOSTNAME} localhost/" /etc/hosts
|
||||
sed -i -e "s/^mydestination =.*/mydestination = ${HOSTNAME}, localhost.localdomain, localhost/" \
|
||||
-e "s/^myhostname =.*/myhostname = ${HOSTNAME}/" /etc/postfix/main.cf
|
||||
apt-get --yes --force-yes --allow-unauthenticated --fix-missing --no-install-recommends \
|
||||
-o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install \
|
||||
openmediavault
|
||||
|
||||
# install OMV extras, enable folder2ram and tweak some settings
|
||||
FILE=$(mktemp)
|
||||
wget "$OMV_EXTRAS_URL" -qO $FILE && dpkg -i $FILE
|
||||
|
||||
/usr/sbin/omv-update
|
||||
# Install flashmemory plugin and netatalk by default, use nice logo for the latter,
|
||||
# tweak some OMV settings
|
||||
. /usr/share/openmediavault/scripts/helper-functions
|
||||
apt-get -y -q install openmediavault-netatalk openmediavault-flashmemory
|
||||
AFP_Options="mimic model = Macmini"
|
||||
SMB_Options="min receivefile size = 16384\nwrite cache size = 524288\ngetwd cache = yes\nsocket options = TCP_NODELAY IPTOS_LOWDELAY"
|
||||
xmlstarlet ed -L -u "/config/services/afp/extraoptions" -v "$(echo -e "${AFP_Options}")" /etc/openmediavault/config.xml
|
||||
xmlstarlet ed -L -u "/config/services/smb/extraoptions" -v "$(echo -e "${SMB_Options}")" /etc/openmediavault/config.xml
|
||||
xmlstarlet ed -L -u "/config/services/flashmemory/enable" -v "1" /etc/openmediavault/config.xml
|
||||
xmlstarlet ed -L -u "/config/services/ssh/enable" -v "1" /etc/openmediavault/config.xml
|
||||
xmlstarlet ed -L -u "/config/services/ssh/permitrootlogin" -v "0" /etc/openmediavault/config.xml
|
||||
xmlstarlet ed -L -u "/config/system/time/ntp/enable" -v "1" /etc/openmediavault/config.xml
|
||||
xmlstarlet ed -L -u "/config/system/time/timezone" -v "UTC" /etc/openmediavault/config.xml
|
||||
xmlstarlet ed -L -u "/config/system/network/dns/hostname" -v "${HOSTNAME}" /etc/openmediavault/config.xml
|
||||
xmlstarlet ed -L -u "/config/system/monitoring/perfstats/enable" -v "0" /etc/openmediavault/config.xml
|
||||
echo -e "OMV_CPUFREQUTILS_GOVERNOR=${GOVERNOR}" >>/etc/default/openmediavault
|
||||
echo -e "OMV_CPUFREQUTILS_MINSPEED=${MIN_SPEED}" >>/etc/default/openmediavault
|
||||
echo -e "OMV_CPUFREQUTILS_MAXSPEED=${MAX_SPEED}" >>/etc/default/openmediavault
|
||||
for i in netatalk samba flashmemory ssh ntp timezone interfaces cpufrequtils monit collectd rrdcached ; do
|
||||
/usr/sbin/omv-mkconf $i
|
||||
done
|
||||
/sbin/folder2ram -enablesystemd || true
|
||||
sed -i 's|-j /var/lib/rrdcached/journal/ ||' /etc/init.d/rrdcached
|
||||
|
||||
# Fix multiple sources entry on ARM with OMV4
|
||||
sed -i '/stretch-backports/d' /etc/apt/sources.list
|
||||
|
||||
# rootfs resize to 7.3G max and adding omv-initsystem to firstrun -- q&d but shouldn't matter
|
||||
echo 15500000s >/root/.rootfs_resize
|
||||
sed -i '/systemctl\ disable\ orangepi-firstrun/i \
|
||||
mv /usr/bin/newaliases.bak /usr/bin/newaliases \
|
||||
export DEBIAN_FRONTEND=noninteractive \
|
||||
sleep 3 \
|
||||
apt-get install -f -qq python-pip python-setuptools || exit 0 \
|
||||
pip install -U tzupdate \
|
||||
tzupdate \
|
||||
read TZ </etc/timezone \
|
||||
/usr/sbin/omv-initsystem \
|
||||
xmlstarlet ed -L -u "/config/system/time/timezone" -v "${TZ}" /etc/openmediavault/config.xml \
|
||||
/usr/sbin/omv-mkconf timezone \
|
||||
lsusb | egrep -q "0b95:1790|0b95:178a|0df6:0072" || sed -i "/ax88179_178a/d" /etc/modules' /usr/lib/orangepi/orangepi-firstrun
|
||||
sed -i '/systemctl\ disable\ orangepi-firstrun/a \
|
||||
sleep 30 && sync && reboot' /usr/lib/orangepi/orangepi-firstrun
|
||||
|
||||
# add USB3 Gigabit Ethernet support
|
||||
echo -e "r8152\nax88179_178a" >>/etc/modules
|
||||
|
||||
case ${BOARD} in
|
||||
odroidxu4)
|
||||
HMP_Fix='; taskset -c -p 4-7 $i '
|
||||
# Cloudshell stuff (fan, lcd, missing serials on 1st CS2 batch)
|
||||
echo "H4sIAKdXHVkCA7WQXWuDMBiFr+eveOe6FcbSrEIH3WihWx0rtVbUFQqCqAkYGhJn
|
||||
tF1x/vep+7oebDfh5DmHwJOzUxwzgeNIpRp9zWRegDPznya4VDlWTXXbpS58XJtD
|
||||
i7ICmFBFxDmgI6AXSLgsiUop54gnBC40rkoVA9rDG0SHHaBHPQx16GN3Zs/XqxBD
|
||||
leVMFNAz6n6zSWlEAIlhEw8p4xTyFtwBkdoJTVIJ+sz3Xa9iZEMFkXk9mQT6cGSQ
|
||||
QL+Cr8rJJSmTouuuRzfDtluarm1aLVHksgWmvanm5sbfOmY3JEztWu5tV9bCXn4S
|
||||
HB8RIzjoUbGvFvPw/tmr0UMr6bWSBupVrulY2xp9T1bruWnVga7DdAqYFgkuCd3j
|
||||
vORUDQgej9HPJxmDDv+3WxblBSuYFH8oiNpHz8XvPIkU9B3JVCJ/awIAAA==" \
|
||||
| tr -d '[:blank:]' | base64 --decode | gunzip -c >/usr/local/sbin/cloudshell2-support.sh
|
||||
chmod 755 /usr/local/sbin/cloudshell2-support.sh
|
||||
apt install -y i2c-tools odroid-cloudshell cloudshell2-fan
|
||||
sed -i '/systemctl\ disable\ orangepi-firstrun/i \
|
||||
lsusb | grep -q -i "05e3:0735" && sed -i "/exit\ 0/i echo 20 > /sys/class/block/sda/queue/max_sectors_kb" /etc/rc.local \
|
||||
/usr/sbin/i2cdetect -y 1 | grep -q "60: 60" && /usr/local/sbin/cloudshell2-support.sh' /usr/lib/orangepi/orangepi-firstrun
|
||||
;;
|
||||
bananapim3|nanopifire3|nanopct3plus|nanopim3)
|
||||
HMP_Fix='; taskset -c -p 4-7 $i '
|
||||
;;
|
||||
edge*|ficus|firefly-rk3399|nanopct4|nanopim4|nanopineo4|renegade-elite|roc-rk3399-pc|rockpro64)
|
||||
HMP_Fix='; taskset -c -p 4-5 $i '
|
||||
;;
|
||||
esac
|
||||
echo "* * * * * root for i in \`pgrep \"ftpd|nfsiod|smbd|afpd|cnid\"\` ; do ionice -c1 -p \$i ${HMP_Fix}; done >/dev/null 2>&1" \
|
||||
>/etc/cron.d/make_nas_processes_faster
|
||||
chmod 600 /etc/cron.d/make_nas_processes_faster
|
||||
|
||||
# add SATA port multiplier hint if appropriate
|
||||
[ "${LINUXFAMILY}" = "sunxi" ] && \
|
||||
echo -e "#\n# If you want to use a SATA PM add \"ahci_sunxi.enable_pmp=1\" to bootargs above" \
|
||||
>>/boot/boot.cmd
|
||||
|
||||
# Filter out some log messages
|
||||
echo ':msg, contains, "do ionice -c1" ~' >/etc/rsyslog.d/omv-orangepi.conf
|
||||
echo ':msg, contains, "action " ~' >>/etc/rsyslog.d/omv-orangepi.conf
|
||||
echo ':msg, contains, "netsnmp_assert" ~' >>/etc/rsyslog.d/omv-orangepi.conf
|
||||
echo ':msg, contains, "Failed to initiate sched scan" ~' >>/etc/rsyslog.d/omv-orangepi.conf
|
||||
|
||||
# Fix little python bug upstream Debian 9 obviously ignores
|
||||
if [ -f /usr/lib/python3.5/weakref.py ]; then
|
||||
wget -O /usr/lib/python3.5/weakref.py \
|
||||
https://raw.githubusercontent.com/python/cpython/9cd7e17640a49635d1c1f8c2989578a8fc2c1de6/Lib/weakref.py
|
||||
fi
|
||||
|
||||
# clean up and force password change on first boot
|
||||
umount /proc/mdstat
|
||||
chage -d 0 root
|
||||
} # InstallOpenMediaVault
|
||||
|
||||
UnattendedStorageBenchmark() {
|
||||
# Function to create Orange Pi images ready for unattended storage performance testing.
|
||||
# Useful to use the same OS image with a bunch of different SD cards or eMMC modules
|
||||
# to test for performance differences without wasting too much time.
|
||||
|
||||
rm /root/.not_logged_in_yet
|
||||
|
||||
apt-get -qq install time
|
||||
|
||||
wget -qO /usr/local/bin/sd-card-bench.sh https://raw.githubusercontent.com/ThomasKaiser/sbc-bench/master/sd-card-bench.sh
|
||||
chmod 755 /usr/local/bin/sd-card-bench.sh
|
||||
|
||||
sed -i '/^exit\ 0$/i \
|
||||
/usr/local/bin/sd-card-bench.sh &' /etc/rc.local
|
||||
} # UnattendedStorageBenchmark
|
||||
|
||||
InstallAdvancedDesktop()
|
||||
{
|
||||
apt-get install -yy transmission libreoffice libreoffice-style-tango meld remmina thunderbird kazam avahi-daemon
|
||||
[[ -f /usr/share/doc/avahi-daemon/examples/sftp-ssh.service ]] && cp /usr/share/doc/avahi-daemon/examples/sftp-ssh.service /etc/avahi/services/
|
||||
[[ -f /usr/share/doc/avahi-daemon/examples/ssh.service ]] && cp /usr/share/doc/avahi-daemon/examples/ssh.service /etc/avahi/services/
|
||||
apt clean
|
||||
} # InstallAdvancedDesktop
|
||||
|
||||
Main "$@"
|
||||
BIN
external/config/templates/example.deb
vendored
Executable file
BIN
external/config/templates/example.deb
vendored
Executable file
Binary file not shown.
12
external/config/templates/fel-boot.cmd.template
vendored
Normal file
12
external/config/templates/fel-boot.cmd.template
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
setenv nfs_ip FEL_LOCAL_IP
|
||||
setenv nfs_root FEL_ROOTFS
|
||||
setenv branch BRANCH
|
||||
setenv bootargs "console=tty1 console=ttyS0,115200 root=/dev/nfs nfsroot=${nfs_ip}:${nfs_root} ip=dhcp rw panic=10 consoleblank=0 enforcing=0 loglevel=6 rootflags=noatime"
|
||||
# uncomment to disable initrd
|
||||
# setenv ramdisk_addr_r "-"
|
||||
if test ${branch} != legacy; then
|
||||
setenv fdt_high ffffffff
|
||||
bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
|
||||
else
|
||||
bootz ${kernel_addr_r} ${ramdisk_addr_r}
|
||||
fi
|
||||
24
external/config/templates/fel-hooks.sh.example
vendored
Normal file
24
external/config/templates/fel-hooks.sh.example
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# fel-hooks.sh.example -- this file is an example how
|
||||
# userpatches/fel-hooks.sh could be implemented.
|
||||
#
|
||||
# The following example assumes you use a Gembird power switch connected
|
||||
# through USB to be able to power cycle the board you want to fel boot. You
|
||||
# need the sispmctl package and use 'sispmctl -s' to get the ID of your
|
||||
# power switch.
|
||||
|
||||
fel_pre_load() {
|
||||
# power cycle socket 1 of Gembird power switch
|
||||
sispmctl -D01:01:51:23:cb -q -f1
|
||||
# 5 seconds delay since PSUs don't like be being power cycled too fast
|
||||
sleep 5
|
||||
sispmctl -D01:01:51:23:cb -q -o1
|
||||
# 3 seconds delay since the SoC has to initialise
|
||||
sleep 3
|
||||
} # fel_pre_load
|
||||
|
||||
fel_post_prepare() {
|
||||
# currently empty - sun8i-default tweaks were converted into u-boot patches
|
||||
echo "calling fel_post_prepare()"
|
||||
} # fel_post_prepare
|
||||
34
external/config/templates/nfs-boot.cmd.template
vendored
Normal file
34
external/config/templates/nfs-boot.cmd.template
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
## set this to NFS root path (ip:path)
|
||||
## or else provide dhcp option 17 (root-path)
|
||||
|
||||
setenv nfs_ip NFS_LOCAL_IP
|
||||
setenv nfs_root NFS_ROOTFS
|
||||
setenv branch BRANCH
|
||||
|
||||
# for DHCP
|
||||
setenv net_setup "ip=dhcp"
|
||||
|
||||
# for static configuration see documentation
|
||||
# https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/nfs/nfsroot.rst
|
||||
# setenv net_setup "ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>:<dns0-ip>:<dns1-ip>"
|
||||
|
||||
# you may need to add extra kernel arguments specific to your device
|
||||
setenv bootargs "console=tty1 console=ttyS0,115200 root=/dev/nfs nfsroot=${nfs_ip}:${nfs_root} ${net_setup} rw rootflags=noatime,nodiratime disp.screen0_output_mode=1920x1080p60 panic=10 consoleblank=0 enforcing=0 loglevel=6"
|
||||
|
||||
if test ${branch} != legacy; then
|
||||
ext4load mmc 0 ${fdt_addr_r} /dtb/${fdtfile} || fatload mmc 0 ${fdt_addr_r} /dtb/${fdtfile}
|
||||
ext4load mmc 0 ${kernel_addr_r} zImage || fatload mmc 0 ${kernel_addr_r} zImage
|
||||
setenv ramdisk_addr_r "-"
|
||||
# uncomment to enable initrd
|
||||
#ext4load mmc 0 ${ramdisk_addr_r} uInitrd || fatload mmc 0 ${ramdisk_addr_r} uInitrd || setenv ramdisk_addr_r "-"
|
||||
setenv fdt_high ffffffff
|
||||
bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
|
||||
else
|
||||
ext4load mmc 0 ${fdt_addr_r} script.bin || fatload mmc 0 ${fdt_addr_r} script.bin
|
||||
ext4load mmc 0 ${kernel_addr_r} zImage || fatload mmc 0 ${kernel_addr_r} zImage
|
||||
ext4load mmc 0 ${ramdisk_addr_r} uInitrd || fatload mmc 0 ${ramdisk_addr_r} uInitrd || setenv ramdisk_addr_r "-"
|
||||
bootz ${kernel_addr_r} ${ramdisk_addr_r}
|
||||
fi
|
||||
|
||||
# Recompile with:
|
||||
# mkimage -C none -A arm -T script -d boot.cmd boot.scr
|
||||
Reference in New Issue
Block a user