armbian-next: remove all traces of Vagrant and FEL boot

This commit is contained in:
Ricardo Pardini
2023-02-09 15:47:31 +01:00
parent 7f1fb1cd69
commit ca6bf9046b
13 changed files with 7 additions and 329 deletions

View File

@@ -1,69 +0,0 @@
# -*- 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|
config.vm.define "Armbian Builder" do |builder|
# We should use a box that is compatible with Virtualbox and Libvirt
builder.vm.box = "generic/ubuntu2204"
builder.vm.box_version = ">= 4.0.2"
# provisioning: install dependencies, download the repository copy
builder.vm.provision "shell", inline: $provisioning_script
# forward terminal type for better compatibility with Dialog - disabled on Ubuntu by default
builder.ssh.forward_env = ["TERM"]
builder.vm.hostname = "armbian-builder"
# SSH password auth is disabled by default, uncomment to enable and set the password
#config.ssh.password = "armbian"
builder.vm.provider "virtualbox" do |vb|
vb.name = "Armbian Builder"
# Default images are not big enough to build Armbian.
#config.vagrant.plugins = "vagrant-disksize"
#config.disksize.size = "40GB"
# uncomment this to enable the VirtualBox GUI
#vb.gui = true
# Tweak these to fit your needs.
#vb.memory = "8192"
#vb.cpus = "4"
end
builder.vm.provider "libvirt" do |libvirt|
# Some specifics libvirt options
libvirt.driver = "kvm"
libvirt.uri = "qemu:///system"
libvirt.default_prefix = ""
# Default images are not big enough to build Armbian.
libvirt.storage_pool_name = "default"
libvirt.storage :file, :size => "40G"
# Tweak these to fit your needs.
libvirt.memory = "8192"
libvirt.cpus = "4"
end
case File.basename(Dir.getwd)
when "templates"
builder.vm.synced_folder "../..", "/vagrant", type: "sshfs"
when "userpatches"
builder.vm.synced_folder "..", "/vagrant", type: "sshfs"
end
end
end

View File

@@ -1,29 +0,0 @@
# DO NOT EDIT THIS FILE
#
# This is a Vagrant launcher file. To set up the configuration, use command line arguments to compile.sh
# While we are in config-vagrant.conf, we no longer need "vagrant" option
# So if "vagrant" wasn't removed from the command line by caller, we do it now
[[ "$1" == "vagrant" ]] && shift
# second argument can be a build parameter or a config file
unset VAGRANT_CONF
[[ $1 != *=* ]] && VAGRANT_CONF=$1 && shift
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 $*"
ret=$?
display_alert "Press <Enter> to halt the Vagrant box"
read
vagrant halt
# don't need to proceed further on the host
exit $ret

View File

@@ -1,12 +0,0 @@
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} != default; then
setenv fdt_high ffffffff
bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
else
bootz ${kernel_addr_r} ${ramdisk_addr_r}
fi

View File

@@ -1,24 +0,0 @@
#!/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

View File

@@ -1,8 +0,0 @@
# @TODO: Open JIRA. PR's are welcome. Open JIRA!
function cli_vagrant_pre_run() {
exit_with_error "cli_vagrant_pre_run: not implemented"
}
function cli_vagrant_run() {
exit_with_error "cli_vagrant_run: not implemented"
}

View File

@@ -8,8 +8,6 @@ function armbian_register_commands() {
["dockershell"]="docker"
["generate-dockerfile"]="docker"
["vagrant"]="vagrant" # thus requires cli_vagrant_pre_run and cli_vagrant_run
["requirements"]="requirements" # implemented in cli_requirements_pre_run and cli_requirements_run
["config-dump"]="config_dump" # implemented in cli_config_dump_pre_run and cli_config_dump_run

View File

@@ -365,10 +365,8 @@ function compile_uboot() {
Description: Das U-Boot for ${BOARD} ${artifact_version_reason:-"${version}"}
EOF
# copy config file to the package
# useful for FEL boot with overlayfs_wrapper
# copy license files, config, etc.
[[ -f .config && -n $BOOTCONFIG ]] && run_host_command_logged cp .config "$uboottempdir/${uboot_name}/usr/lib/u-boot/${BOOTCONFIG}"
# copy license files from typical locations
[[ -f COPYING ]] && run_host_command_logged cp COPYING "$uboottempdir/${uboot_name}/usr/lib/u-boot/LICENSE"
[[ -f Licenses/README ]] && run_host_command_logged cp Licenses/README "$uboottempdir/${uboot_name}/usr/lib/u-boot/LICENSE"
[[ -n $atftempdir && -f $atftempdir/license.md ]] && run_host_command_logged cp "${atftempdir}/license.md" "$uboottempdir/${uboot_name}/usr/lib/u-boot/LICENSE.atf"

View File

@@ -87,7 +87,7 @@ function do_main_configuration() {
# Prepare rootfs filesystem support
[[ -z $ROOTFS_TYPE ]] && ROOTFS_TYPE=ext4 # default rootfs type is ext4
case "$ROOTFS_TYPE" in
ext4 | fel) # nothing extra here
ext4) # nothing extra here
;;
nfs)
FIXED_IMAGE_SIZE=256 # small SD card with kernel, boot script and .dtb/.bin files
@@ -110,7 +110,6 @@ function do_main_configuration() {
exit_with_error "Unknown rootfs type: ROOTFS_TYPE='${ROOTFS_TYPE}'"
;;
esac
# Support for LUKS / cryptroot
if [[ $CRYPTROOT_ENABLE == yes ]]; then
@@ -219,8 +218,7 @@ function do_main_configuration() {
## ------ Sourcing family config ---------------------------
source_family_config_and_arch
if [[ "$HAS_VIDEO_OUTPUT" == "no" ]]; then
SKIP_BOOTSPLASH="yes"
PLYMOUTH="no"
@@ -443,6 +441,6 @@ function source_family_config_and_arch() {
display_alert "Sourcing arch configuration" "${ARCH}.conf" "info"
# shellcheck source=/dev/null
source "${SRC}/config/sources/${ARCH}.conf"
return 0
}

View File

@@ -1,102 +0,0 @@
#!/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 the Armbian build script
# https://github.com/armbian/build/
# FEL_ROOTFS should be set to path to debootstrapped root filesystem
# unless you want to kill your /etc/fstab and share your rootfs on NFS
# without any access control
fel_prepare_host() {
# Start rpcbind for NFS if inside docker container
if armbian_is_running_in_container; then service rpcbind start; fi
# remove and re-add NFS share
rm -f /etc/exports.d/armbian.exports
mkdir -p /etc/exports.d
echo "$FEL_ROOTFS *(rw,async,no_subtree_check,no_root_squash,fsid=root)" > /etc/exports.d/armbian.exports
# Start NFS server if inside docker container
if armbian_is_running_in_container; then service nfs-kernel-server; fi
exportfs -ra
}
fel_prepare_target() {
if [[ -f $USERPATCHES_PATH/fel-boot.cmd ]]; then
display_alert "Using custom boot script" "userpatches/fel-boot.cmd" "info"
cp "$USERPATCHES_PATH"/fel-boot.cmd "${FEL_ROOTFS}"/boot/boot.cmd
else
cp "${SRC}"/config/templates/fel-boot.cmd.template "${FEL_ROOTFS}"/boot/boot.cmd
fi
if [[ -z $FEL_LOCAL_IP ]]; then
FEL_LOCAL_IP=$(ifconfig "${FEL_NET_IFNAME}" | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
fi
sed -i "s#BRANCH#$BRANCH#" "${FEL_ROOTFS}"/boot/boot.cmd
sed -i "s#FEL_LOCAL_IP#$FEL_LOCAL_IP#" "${FEL_ROOTFS}"/boot/boot.cmd
sed -i "s#FEL_ROOTFS#$FEL_ROOTFS#" "${FEL_ROOTFS}"/boot/boot.cmd
mkimage -C none -A arm -T script -d "${FEL_ROOTFS}"/boot/boot.cmd "${FEL_ROOTFS}"/boot/boot.scr > /dev/null
# kill /etc/fstab on target
echo > "${FEL_ROOTFS}"/etc/fstab
echo "/dev/nfs / nfs defaults 0 0" >> "${FEL_ROOTFS}"/etc/fstab
echo "tmpfs /tmp tmpfs defaults,nosuid 0 0" >> "${FEL_ROOTFS}"/etc/fstab
}
fel_load() {
# update each time in case boot/script.bin link was changed in multi-board images
local dtb_file
if [[ -n $FEL_DTB_FILE ]]; then
dtb_file=$FEL_DTB_FILE
else
if [[ $BRANCH == default ]]; then
# script.bin is either regular file or absolute symlink
if [[ -L $FEL_ROOTFS/boot/script.bin ]]; then
dtb_file=boot/bin/$(basename "$(readlink "${FEL_ROOTFS}"/boot/script.bin)")
else
dtb_file=boot/script.bin
fi
else
dtb_file=boot/dtb/$(grep CONFIG_DEFAULT_DEVICE_TREE "${FEL_ROOTFS}/usr/lib/u-boot/${BOOTCONFIG}" | cut -d '"' -f2).dtb
fi
fi
[[ $(type -t fel_pre_load) == function ]] && fel_pre_load
display_alert "Loading files via" "FEL USB" "info"
sunxi-fel "${FEL_EXTRA_ARGS}" -p uboot "${FEL_ROOTFS}/usr/lib/${CHOSEN_UBOOT}_${REVISION}_armhf/u-boot-sunxi-with-spl.bin" \
write 0x42000000 "${FEL_ROOTFS}"/boot/zImage \
write 0x43000000 "${FEL_ROOTFS}/${dtb_file}" \
write 0x43300000 "${FEL_ROOTFS}"/boot/uInitrd \
write 0x43100000 "${FEL_ROOTFS}"/boot/boot.scr
}
function start_fel_boot() {
if [[ -f $USERPATCHES_PATH/fel-hooks.sh ]]; then
display_alert "Using additional FEL hooks in" "userpatches/fel-hooks.sh" "info"
# shellcheck source=/dev/null
source "$USERPATCHES_PATH"/fel-hooks.sh
fi
# basic sanity check
if [[ -n $FEL_ROOTFS ]]; then
fel_prepare_host
fel_prepare_target
[[ $(type -t fel_post_prepare) == function ]] && fel_post_prepare
RES=b
while [[ $RES != q ]]; do
if [[ $FEL_AUTO != yes ]]; then
display_alert "Connect device in FEL mode and press" "<Enter>" "info"
read -r
fi
fel_load
display_alert "Press any key to boot again, <q> to finish" "FEL" "info"
read -r -n 1 RES
echo
done
service nfs-kernel-server restart
fi
}

View File

@@ -357,7 +357,7 @@ function docker_cli_prepare_launch() {
declare -g -a DOCKER_ARGS=(
"--rm" # side effect - named volumes are considered not attached to anything and are removed on "docker volume prune", since container was removed.
"--privileged" # 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
"--privileged" # Yep. Armbian needs /dev/loop access, device access, etc. Don't even bother trying without it.
"--cap-add=SYS_ADMIN" # add only required capabilities instead
"--cap-add=MKNOD" # (though MKNOD should be already present)
"--cap-add=SYS_PTRACE" # CAP_SYS_PTRACE is required for systemd-detect-virt in some cases @TODO: rpardini: so lets eliminate it @TODO: rpardini maybe it's dead already?
@@ -595,12 +595,3 @@ function docker_purge_deprecated_volumes() {
fi
done
}
# Leftovers from original Dockerfile before rewrite
## OLD DOCKERFILE ## RUN locale-gen en_US.UTF-8
## OLD DOCKERFILE ##
## OLD DOCKERFILE ## # Static port for NFSv3 server used for USB FEL boot
## OLD DOCKERFILE ## RUN sed -i 's/\(^STATDOPTS=\).*/\1"--port 32765 --outgoing-port 32766"/' /etc/default/nfs-common \
## OLD DOCKERFILE ## && sed -i 's/\(^RPCMOUNTDOPTS=\).*/\1"--port 32767"/' /etc/default/nfs-kernel-server
## OLD DOCKERFILE ##
## OLD DOCKERFILE ## ENTRYPOINT [ "/bin/bash", "/root/armbian/compile.sh" ]

View File

@@ -1,30 +0,0 @@
# @TODO: called by no-one, yet, or ever. This should not be done here.
function vagrant_install_vagrant() {
# Check for Vagrant
# @TODO yeah, checks for ${1} in a function. not cool. not the place to install stuff either.
if [[ "${1}" == vagrant && -z "$(command -v vagrant)" ]]; then
display_alert "Vagrant not installed." "Installing"
sudo apt-get update
sudo apt-get install -y vagrant virtualbox
fi
}
function vagrant_prepare_userpatches() {
# Create example configs if none found in userpatches
if [[ ! -f "${SRC}"/userpatches/config-vagrant.conf ]]; then
display_alert "Create example Vagrant config using template" "config-vagrant.conf" "info"
# Create Vagrant config
if [[ ! -f "${SRC}"/userpatches/config-vagrant.conf ]]; then
cp "${SRC}"/config/templates/config-vagrant.conf "${SRC}"/userpatches/config-vagrant.conf || exit 1
fi
fi
if [[ ! -f "${SRC}"/userpatches/Vagrantfile ]]; then
# Create Vagrant file
if [[ ! -f "${SRC}"/userpatches/Vagrantfile ]]; then
cp "${SRC}"/config/templates/Vagrantfile "${SRC}"/userpatches/Vagrantfile || exit 1
fi
fi
}

View File

@@ -59,14 +59,8 @@ function build_rootfs_and_image() {
#------------------------------------ DOWN HERE IT's 'image' stuff -------------------------------
if [[ $ROOTFS_TYPE == fel ]]; then
FEL_ROOTFS=$SDCARD/
display_alert "Starting FEL boot" "$BOARD" "info"
start_fel_boot
else
LOG_SECTION="prepare_partitions" do_with_logging prepare_partitions
LOG_SECTION="create_image_from_sdcard_rootfs" do_with_logging create_image_from_sdcard_rootfs
fi
LOG_SECTION="prepare_partitions" do_with_logging prepare_partitions
LOG_SECTION="create_image_from_sdcard_rootfs" do_with_logging create_image_from_sdcard_rootfs
# Completely and recursively unmount the directory. --> This will remove the tmpfs mount too <--
umount_chroot_recursive "${SDCARD}" "SDCARD rootfs finished"

View File

@@ -163,15 +163,6 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/cli/cli-undecided.sh
source "${SRC}"/lib/functions/cli/cli-undecided.sh
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
### lib/functions/cli/cli-vagrant.sh
# shellcheck source=lib/functions/cli/cli-vagrant.sh
source "${SRC}"/lib/functions/cli/cli-vagrant.sh
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
@@ -487,15 +478,6 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/configuration/package-lists.sh
source "${SRC}"/lib/functions/configuration/package-lists.sh
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
### lib/functions/extras/fel.sh
# shellcheck source=lib/functions/extras/fel.sh
source "${SRC}"/lib/functions/extras/fel.sh
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
@@ -712,15 +694,6 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/host/tmpfs-utils.sh
source "${SRC}"/lib/functions/host/tmpfs-utils.sh
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
### lib/functions/host/vagrant.sh
# shellcheck source=lib/functions/host/vagrant.sh
source "${SRC}"/lib/functions/host/vagrant.sh
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled