Merge branch 'master' of https://github.com/zador-blood-stained/lib
This commit is contained in:
commit
81157fba92
@ -158,14 +158,14 @@ install_board_specific (){
|
||||
fi
|
||||
|
||||
# if we have a special fat boot partition, alter rootfs=
|
||||
if [[ "$BOOTSIZE" -gt "0" ]]; then
|
||||
if [[ $BOOTSIZE -gt 0 ]]; then
|
||||
display_alert "Adjusting boot scripts" "$BOARD" "info"
|
||||
[[ -f "$CACHEDIR/sdcard/boot/boot.cmd" ]] && sed -e 's/p1 /p2 /g' -i $CACHEDIR/sdcard/boot/boot.cmd
|
||||
[[ -f $CACHEDIR/sdcard/boot/boot.cmd ]] && sed -e 's/p1 /p2 /g' -i $CACHEDIR/sdcard/boot/boot.cmd
|
||||
echo "/dev/mmcblk0p1 /boot vfat defaults 0 0" >> $CACHEDIR/sdcard/etc/fstab
|
||||
fi
|
||||
|
||||
# convert to uboot compatible script
|
||||
[[ -f "$CACHEDIR/sdcard/boot/boot.cmd" ]] && \
|
||||
[[ -f $CACHEDIR/sdcard/boot/boot.cmd ]] && \
|
||||
mkimage -C none -A arm -T script -d $CACHEDIR/sdcard/boot/boot.cmd $CACHEDIR/sdcard/boot/boot.scr >> /dev/null
|
||||
|
||||
# initial date for fake-hwclock
|
||||
|
||||
@ -100,9 +100,9 @@ n=0
|
||||
for line in "${buildlist[@]}"; do
|
||||
unset LINUXFAMILY LINUXCONFIG LINUXKERNEL LINUXSOURCE KERNELBRANCH BOOTLOADER BOOTSOURCE BOOTBRANCH ARCH UBOOT_NEEDS_GCC KERNEL_NEEDS_GCC \
|
||||
CPUMIN CPUMAX UBOOT_VER KERNEL_VER GOVERNOR BOOTSIZE UBOOT_TOOLCHAIN KERNEL_TOOLCHAIN PACKAGE_LIST_EXCLUDE KERNEL_IMAGE_TYPE
|
||||
read BOARD BRANCH RELEASE BUILD_DESKTOP <<< $line
|
||||
read BOARD BRANCH RELEASE BUILD_DESKTOP <<< $line
|
||||
n=$[$n+1]
|
||||
if [ "$from" -le "$n" ]; then
|
||||
if [[ $from -le $n ]]; then
|
||||
display_alert "Building" "Board: $BOARD Kernel:$BRANCH${RELEASE:+ Release: $RELEASE}${BUILD_DESKTOP:+ Desktop: $BUILD_DESKTOP}" "ext"
|
||||
source $SRC/lib/main.sh
|
||||
fi
|
||||
|
||||
@ -279,6 +279,8 @@ find_toolchain()
|
||||
local var_name=$2
|
||||
local dist=10
|
||||
local toolchain=""
|
||||
# extract target major.minor version from expression
|
||||
local target_ver=$(grep -oE "[[:digit:]].[[:digit:]]" <<< "$expression")
|
||||
for dir in $SRC/toolchains/*/; do
|
||||
# check if is a toolchain for current $ARCH
|
||||
[[ ! -f ${dir}bin/${COMPILER}gcc ]] && continue
|
||||
@ -286,8 +288,6 @@ find_toolchain()
|
||||
local gcc_ver=$(${dir}bin/${COMPILER}gcc -dumpversion | grep -oE "^[[:digit:]].[[:digit:]]")
|
||||
# check if toolchain version satisfies requirement
|
||||
awk "BEGIN{exit ! ($gcc_ver $expression)}" || continue
|
||||
# extract target major.minor version from expression
|
||||
local target_ver=$(grep -oE "[[:digit:]].[[:digit:]]" <<< "$expression")
|
||||
# check if found version is the closest to target
|
||||
local d=$(awk '{x = $1 - $2}{printf "%.1f\n", (x > 0) ? x : -x}' <<< "$target_ver $gcc_ver")
|
||||
if awk "BEGIN{exit ! ($d < $dist)}" ; then
|
||||
|
||||
@ -2,4 +2,4 @@
|
||||
ACTION=="remove", GOTO="power_switch_end"
|
||||
SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="axp20x-pek", TAG+="power-switch"
|
||||
SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="axp[12][890]-supplyer", TAG+="power-switch"
|
||||
LABEL="power_switch_end"
|
||||
LABEL="power_switch_end"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# Exynos5422 XU3/XU4 octa core
|
||||
LINUXFAMILY=odroidxu4
|
||||
BOOTSIZE=16
|
||||
BOOTSIZE=32
|
||||
OFFSET=2
|
||||
BOOTCONFIG=odroid_config
|
||||
MODULES="bonding"
|
||||
|
||||
@ -58,9 +58,7 @@ debootstrap_ng()
|
||||
local use_tmpfs=yes
|
||||
fi
|
||||
|
||||
if [[ $use_tmpfs == yes ]]; then
|
||||
mount -t tmpfs -o size=${tmpfs_max_size}M tmpfs $CACHEDIR/sdcard
|
||||
fi
|
||||
[[ $use_tmpfs == yes ]] && mount -t tmpfs -o size=${tmpfs_max_size}M tmpfs $CACHEDIR/sdcard
|
||||
|
||||
# stage: prepare basic rootfs: unpack cache or create from scratch
|
||||
create_rootfs_cache
|
||||
@ -75,9 +73,7 @@ debootstrap_ng()
|
||||
umount $CACHEDIR/sdcard/tmp
|
||||
|
||||
# install desktop files
|
||||
if [[ $BUILD_DESKTOP == yes ]]; then
|
||||
install_desktop
|
||||
fi
|
||||
[[ $BUILD_DESKTOP == yes ]] && install_desktop
|
||||
|
||||
# install additional applications
|
||||
[[ $EXTERNAL == yes ]] && install_external_applications
|
||||
@ -89,26 +85,14 @@ debootstrap_ng()
|
||||
# stage: cleanup
|
||||
rm -f $CACHEDIR/sdcard/usr/sbin/policy-rc.d
|
||||
rm -f $CACHEDIR/sdcard/usr/bin/$QEMU_BINARY
|
||||
if [[ -x $CACHEDIR/sdcard/sbin/initctl.REAL ]]; then
|
||||
mv -f $CACHEDIR/sdcard/sbin/initctl.REAL $CACHEDIR/sdcard/sbin/initctl
|
||||
fi
|
||||
if [[ -x $CACHEDIR/sdcard/sbin/start-stop-daemon.REAL ]]; then
|
||||
mv -f $CACHEDIR/sdcard/sbin/start-stop-daemon.REAL $CACHEDIR/sdcard/sbin/start-stop-daemon
|
||||
fi
|
||||
[[ -x $CACHEDIR/sdcard/sbin/initctl.REAL ]] && mv -f $CACHEDIR/sdcard/sbin/initctl.REAL $CACHEDIR/sdcard/sbin/initctl
|
||||
[[ -x $CACHEDIR/sdcard/sbin/start-stop-daemon.REAL ]] && mv -f $CACHEDIR/sdcard/sbin/start-stop-daemon.REAL $CACHEDIR/sdcard/sbin/start-stop-daemon
|
||||
|
||||
umount_chroot
|
||||
|
||||
if [[ ( $ROOTFS_TYPE == fel || $ROOTFS_TYPE == nfs ) && $RELEASE == xenial ]]; then
|
||||
# kill /etc/network/interfaces on target to prevent hang on shutdown on Xenial target
|
||||
rm -f $CACHEDIR/sdcard/etc/network/interfaces
|
||||
printf "auto lo\niface lo inet loopback\n" > $CACHEDIR/sdcard/etc/network/interfaces
|
||||
fi
|
||||
|
||||
if [[ $ROOTFS_TYPE != ext4 ]]; then
|
||||
# to prevent creating swap file on NFS (needs specific kernel options)
|
||||
# and f2fs/btrfs (not recommended or needs specific kernel options)
|
||||
touch $FEL_ROOTFS/var/swap
|
||||
fi
|
||||
# to prevent creating swap file on NFS (needs specific kernel options)
|
||||
# and f2fs/btrfs (not recommended or needs specific kernel options)
|
||||
[[ $ROOTFS_TYPE != ext4 ]] && touch $CACHEDIR/sdcard/var/swap
|
||||
|
||||
if [[ $ROOTFS_TYPE == fel ]]; then
|
||||
FEL_ROOTFS=$CACHEDIR/sdcard/
|
||||
@ -120,9 +104,7 @@ debootstrap_ng()
|
||||
fi
|
||||
|
||||
# stage: unmount tmpfs
|
||||
if [[ $use_tmpfs = yes ]]; then
|
||||
umount $CACHEDIR/sdcard
|
||||
fi
|
||||
[[ $use_tmpfs = yes ]] && umount $CACHEDIR/sdcard
|
||||
|
||||
rm -rf $CACHEDIR/sdcard
|
||||
|
||||
@ -136,10 +118,9 @@ debootstrap_ng()
|
||||
#
|
||||
create_rootfs_cache()
|
||||
{
|
||||
[[ $BUILD_DESKTOP == yes ]] && local variant_desktop=yes
|
||||
local packages_hash=$(get_package_list_hash $PACKAGE_LIST)
|
||||
local cache_fname="$CACHEDIR/rootfs/$RELEASE${variant_desktop:+_desktop}-ng-$ARCH.$packages_hash.tgz"
|
||||
local display_name=$RELEASE${variant_desktop:+_desktop}-ng-$ARCH.${packages_hash:0:3}...${packages_hash:29}.tgz
|
||||
local cache_fname=$CACHEDIR/rootfs/${RELEASE}-ng-$ARCH.$packages_hash.tgz
|
||||
local display_name=${RELEASE}-ng-$ARCH.${packages_hash:0:3}...${packages_hash:29}.tgz
|
||||
if [[ -f $cache_fname ]]; then
|
||||
local date_diff=$(( ($(date +%s) - $(stat -c %Y $cache_fname)) / 86400 ))
|
||||
display_alert "Extracting $display_name" "$date_diff days old" "info"
|
||||
@ -184,8 +165,7 @@ create_rootfs_cache()
|
||||
|
||||
mount_chroot
|
||||
|
||||
# policy-rc.d script prevents starting or reloading services
|
||||
# from dpkg pre- and post-install scripts during image creation
|
||||
# policy-rc.d script prevents starting or reloading services during image creation
|
||||
printf '#!/bin/sh\nexit 101' > $CACHEDIR/sdcard/usr/sbin/policy-rc.d
|
||||
chmod 755 $CACHEDIR/sdcard/usr/sbin/policy-rc.d
|
||||
# ported from debootstrap and multistrap for upstart support
|
||||
@ -227,7 +207,7 @@ create_rootfs_cache()
|
||||
${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'}
|
||||
|
||||
# stage: upgrade base packages from xxx-updates and xxx-backports repository branches
|
||||
display_alert "Updating base packages" "Armbian" "info"
|
||||
display_alert "Upgrading base packages" "Armbian" "info"
|
||||
eval 'LC_ALL=C LANG=C chroot $CACHEDIR/sdcard /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y -q \
|
||||
$apt_extra $apt_extra_progress upgrade"' \
|
||||
${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} \
|
||||
@ -363,10 +343,7 @@ prepare_partitions()
|
||||
|
||||
# stage: mount image
|
||||
LOOP=$(losetup -f)
|
||||
if [[ -z $LOOP ]]; then
|
||||
# NOTE: very unlikely with this debootstrap process
|
||||
exit_with_error "Unable to find free loop device"
|
||||
fi
|
||||
[[ -z $LOOP ]] && exit_with_error "Unable to find free loop device"
|
||||
|
||||
# NOTE: losetup -P option is not available in Trusty
|
||||
losetup $LOOP $CACHEDIR/tmprootfs.raw
|
||||
@ -401,7 +378,7 @@ prepare_partitions()
|
||||
mount ${LOOP}p1 $CACHEDIR/mount/boot/
|
||||
echo "/dev/mmcblk0p1 /boot ${mkfs[$bootfs]} defaults${mountopts[$bootfs]} 0 2" >> $CACHEDIR/sdcard/etc/fstab
|
||||
fi
|
||||
echo "tmpfs /tmp tmpfs defaults,rw,nosuid 0 0" >> $CACHEDIR/sdcard/etc/fstab
|
||||
echo "tmpfs /tmp tmpfs defaults,nosuid 0 0" >> $CACHEDIR/sdcard/etc/fstab
|
||||
|
||||
# stage: create boot script
|
||||
if [[ $ROOTFS_TYPE == nfs ]]; then
|
||||
@ -469,8 +446,8 @@ create_image()
|
||||
sync
|
||||
|
||||
# unmount /boot first, rootfs second, image file last
|
||||
if [[ $BOOTSIZE != 0 ]]; then umount -l $CACHEDIR/mount/boot; fi
|
||||
if [[ $ROOTFS_TYPE != nfs ]]; then umount -l $CACHEDIR/mount; fi
|
||||
[[ $BOOTSIZE != 0 ]] && umount -l $CACHEDIR/mount/boot
|
||||
[[ $ROOTFS_TYPE != nfs ]] && umount -l $CACHEDIR/mount
|
||||
losetup -d $LOOP
|
||||
|
||||
mv $CACHEDIR/tmprootfs.raw $CACHEDIR/$VERSION.raw
|
||||
|
||||
@ -82,19 +82,15 @@ jessie)
|
||||
sed -e "s/ttyS0/$SERIALCON/g" -i $CACHEDIR/sdcard/etc/init/$SERIALCON.conf
|
||||
chroot $CACHEDIR/sdcard /bin/bash -c "systemctl --no-reload enable serial-getty@$SERIALCON.service >/dev/null 2>&1"
|
||||
mkdir -p "$CACHEDIR/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d"
|
||||
echo "[Service]" > "$CACHEDIR/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d/10-rate.conf"
|
||||
echo "ExecStart=" >> "$CACHEDIR/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d/10-rate.conf"
|
||||
echo "ExecStart=-/sbin/agetty -L 115200 %I $TERM" >> "$CACHEDIR/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d/10-rate.conf"
|
||||
printf "[Service]\nExecStart=\nExecStart=-/sbin/agetty -L 115200 %%I $TERM" > "$CACHEDIR/sdcard/etc/systemd/system/serial-getty@$SERIALCON.service.d/10-rate.conf"
|
||||
|
||||
# don't clear screen tty1
|
||||
mkdir -p "$CACHEDIR/sdcard/etc/systemd/system/getty@tty1.service.d/"
|
||||
echo "[Service]" > "$CACHEDIR/sdcard/etc/systemd/system/getty@tty1.service.d/10-noclear.conf"
|
||||
echo "TTYVTDisallocate=no" >> "$CACHEDIR/sdcard/etc/systemd/system/getty@tty1.service.d/10-noclear.conf"
|
||||
printf "[Service]\nTTYVTDisallocate=no" > "$CACHEDIR/sdcard/etc/systemd/system/getty@tty1.service.d/10-noclear.conf"
|
||||
|
||||
# seting timeout
|
||||
mkdir -p $CACHEDIR/sdcard/etc/systemd/system/systemd-modules-load.service.d/
|
||||
echo "[Service]" > $CACHEDIR/sdcard/etc/systemd/system/systemd-modules-load.service.d/10-timeout.conf
|
||||
echo "TimeoutStopSec=10" >> $CACHEDIR/sdcard/etc/systemd/system/systemd-modules-load.service.d/10-timeout.conf
|
||||
printf "[Service]\nTimeoutStopSec=10" > $CACHEDIR/sdcard/etc/systemd/system/systemd-modules-load.service.d/10-timeout.conf
|
||||
|
||||
# handle PMU power button
|
||||
mkdir -p $CACHEDIR/sdcard/etc/udev/rules.d/
|
||||
@ -143,9 +139,6 @@ xenial)
|
||||
#sed -e "s/ORIGIN/Debian/g" -i $CACHEDIR/sdcard/etc/apt/apt.conf.d/50unattended-upgrades
|
||||
#sed -e "s/CODENAME/$RELEASE/g" -i $CACHEDIR/sdcard/etc/apt/apt.conf.d/50unattended-upgrades
|
||||
|
||||
# mount 256Mb tmpfs to /tmp (disabled while supported by debootstrap-ng only)
|
||||
#echo "tmpfs /tmp tmpfs nodev,nosuid,size=256M 0 0" >> $CACHEDIR/sdcard/etc/fstab
|
||||
|
||||
# fix selinux error
|
||||
mkdir $CACHEDIR/sdcard/selinux
|
||||
|
||||
@ -160,13 +153,11 @@ xenial)
|
||||
|
||||
# don't clear screen tty1
|
||||
mkdir -p "$CACHEDIR/sdcard/etc/systemd/system/getty@tty1.service.d/"
|
||||
echo "[Service]" > "$CACHEDIR/sdcard/etc/systemd/system/getty@tty1.service.d/10-noclear.conf"
|
||||
echo "TTYVTDisallocate=no" >> "$CACHEDIR/sdcard/etc/systemd/system/getty@tty1.service.d/10-noclear.conf"
|
||||
printf "[Service]\nTTYVTDisallocate=no" > "$CACHEDIR/sdcard/etc/systemd/system/getty@tty1.service.d/10-noclear.conf"
|
||||
|
||||
# seting timeout
|
||||
mkdir -p $CACHEDIR/sdcard/etc/systemd/system/systemd-modules-load.service.d/
|
||||
echo "[Service]" > $CACHEDIR/sdcard/etc/systemd/system/systemd-modules-load.service.d/10-timeout.conf
|
||||
echo "TimeoutStopSec=10" >> $CACHEDIR/sdcard/etc/systemd/system/systemd-modules-load.service.d/10-timeout.conf
|
||||
printf "[Service]\nTimeoutStopSec=10" > $CACHEDIR/sdcard/etc/systemd/system/systemd-modules-load.service.d/10-timeout.conf
|
||||
|
||||
# handle PMU power button
|
||||
mkdir -p $CACHEDIR/sdcard/etc/udev/rules.d/
|
||||
@ -177,8 +168,10 @@ xenial)
|
||||
chroot $CACHEDIR/sdcard /bin/bash -c "systemctl --no-reload mask ureadahead.service >/dev/null 2>&1"
|
||||
chroot $CACHEDIR/sdcard /bin/bash -c "systemctl --no-reload mask setserial.service etc-setserial.service >/dev/null 2>&1"
|
||||
|
||||
# disable initramfs
|
||||
#sed -i 's/update_initramfs=yes/update_initramfs=no/' $CACHEDIR/sdcard/etc/initramfs-tools/update-initramfs.conf
|
||||
# disable stopping network interfaces
|
||||
# fixes shutdown with root on NFS
|
||||
mkdir -p $CACHEDIR/sdcard/etc/systemd/system/networking.service.d/
|
||||
printf "[Service]\nExecStop=\n" > $CACHEDIR/sdcard/etc/systemd/system/networking.service.d/10-nostop.conf
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
### What is FEL/NFS boot?
|
||||
|
||||
FEL/NFS boot mode is a possibility to test freshly created Armbian distribution without using SD card. It is implemented by loading u-boot, kernel, boot script and .bin/.dtb file via [USB FEL mode](https://linux-sunxi.org/FEL/USBBoot) and providing root filesystem via NFS share.
|
||||
FEL/NFS boot mode is a possibility to test freshly created Armbian distribution without using SD card. It is implemented by loading u-boot, kernel, initrd, boot script and .bin/.dtb file via [USB FEL mode](https://linux-sunxi.org/FEL/USBBoot) and providing root filesystem via NFS share.
|
||||
|
||||
NOTE: this mode is designed only for testing. To use root on NFS permanently, use `ROOTFS_TYPE=nfs` option.
|
||||
NOTE: "hot" switching between kernel branches (default <-> dev/next) is not supported
|
||||
@ -14,6 +14,7 @@ NOTE: "hot" switching between kernel branches (default <-> dev/next) is not supp
|
||||
- Network connection between build host and board. For target board **wired** Ethernet connection is required (either via onboard Ethernet or via USB ethernet adapter that has required kernel modules built-in)
|
||||
- NFS ports on build host should be reachable from board perspective (you may need to open ports in firewall or change network configuration of your VM)
|
||||
- Selected kernel should have built-in support for DHCP and NFS root filesystem
|
||||
- `CLEAN_LEVEL="make,debs"` to always update u-boot configuration
|
||||
|
||||
#### Additional requirements (recommended)
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ fel_prepare_target()
|
||||
# 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,rw,nosuid 0 0" >> $FEL_ROOTFS/etc/fstab
|
||||
echo "tmpfs /tmp tmpfs defaults,nosuid 0 0" >> $FEL_ROOTFS/etc/fstab
|
||||
|
||||
# if for some reason uInitrd doesn't exist
|
||||
[[ ! -f $FEL_ROOTFS/boot/uInitrd ]] && touch $FEL_ROOTFS/boot/uInitrd
|
||||
|
||||
Loading…
Reference in New Issue
Block a user