From df1b8857e5708a61ceb2717626b99f1bece17be3 Mon Sep 17 00:00:00 2001 From: zador-blood-stained Date: Thu, 3 Mar 2016 17:06:01 +0300 Subject: [PATCH] FEL/NFS boot for mainline sunxi --- config/linux-sunxi-next.config | 35 +++++++++++++--------- debootstrap-ng.sh | 8 ++++- fel-load.sh | 55 ++++++++++++++++++++++++++++++++++ scripts/fel-boot.cmd.template | 5 ++++ 4 files changed, 88 insertions(+), 15 deletions(-) create mode 100644 fel-load.sh create mode 100644 scripts/fel-boot.cmd.template diff --git a/config/linux-sunxi-next.config b/config/linux-sunxi-next.config index 3a533040c9..5b5b7993d0 100644 --- a/config/linux-sunxi-next.config +++ b/config/linux-sunxi-next.config @@ -1885,7 +1885,7 @@ CONFIG_DWMAC_GENERIC=y # CONFIG_DWMAC_ROCKCHIP is not set # CONFIG_DWMAC_SOCFPGA is not set # CONFIG_DWMAC_STI is not set -CONFIG_DWMAC_SUNXI=m +CONFIG_DWMAC_SUNXI=y CONFIG_NET_VENDOR_SYNOPSYS=y CONFIG_SYNOPSYS_DWC_ETH_QOS=m # CONFIG_NET_VENDOR_VIA is not set @@ -5031,30 +5031,37 @@ CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 # CONFIG_SYSV_FS is not set # CONFIG_UFS_FS is not set CONFIG_NETWORK_FILESYSTEMS=y -CONFIG_NFS_FS=m -CONFIG_NFS_V2=m -CONFIG_NFS_V3=m +CONFIG_NFS_FS=y +CONFIG_NFS_V2=y +CONFIG_NFS_V3=y CONFIG_NFS_V3_ACL=y -CONFIG_NFS_V4=m +CONFIG_NFS_V4=y CONFIG_NFS_SWAP=y -# CONFIG_NFS_V4_1 is not set -# CONFIG_NFS_FSCACHE is not set +CONFIG_NFS_V4_1=y +CONFIG_NFS_V4_2=y +CONFIG_PNFS_FILE_LAYOUT=y +CONFIG_PNFS_BLOCK=m +CONFIG_PNFS_FLEXFILE_LAYOUT=m +CONFIG_NFS_V4_1_IMPLEMENTATION_ID_DOMAIN="kernel.org" +# CONFIG_NFS_V4_1_MIGRATION is not set +CONFIG_ROOT_NFS=y # CONFIG_NFS_USE_LEGACY_DNS is not set CONFIG_NFS_USE_KERNEL_DNS=y -CONFIG_NFSD=m +CONFIG_NFSD=y CONFIG_NFSD_V2_ACL=y CONFIG_NFSD_V3=y CONFIG_NFSD_V3_ACL=y CONFIG_NFSD_V4=y # CONFIG_NFSD_PNFS is not set # CONFIG_NFSD_FAULT_INJECTION is not set -CONFIG_GRACE_PERIOD=m -CONFIG_LOCKD=m +CONFIG_GRACE_PERIOD=y +CONFIG_LOCKD=y CONFIG_LOCKD_V4=y -CONFIG_NFS_ACL_SUPPORT=m +CONFIG_NFS_ACL_SUPPORT=y CONFIG_NFS_COMMON=y -CONFIG_SUNRPC=m -CONFIG_SUNRPC_GSS=m +CONFIG_SUNRPC=y +CONFIG_SUNRPC_GSS=y +CONFIG_SUNRPC_BACKCHANNEL=y CONFIG_SUNRPC_SWAP=y CONFIG_RPCSEC_GSS_KRB5=m # CONFIG_SUNRPC_DEBUG is not set @@ -5543,7 +5550,7 @@ CONFIG_CLZ_TAB=y # CONFIG_DDR is not set CONFIG_MPILIB=m CONFIG_LIBFDT=y -CONFIG_OID_REGISTRY=m +CONFIG_OID_REGISTRY=y CONFIG_FONT_SUPPORT=y # CONFIG_FONTS is not set CONFIG_FONT_8x8=y diff --git a/debootstrap-ng.sh b/debootstrap-ng.sh index fc80ddc4f9..cbbd2149a3 100644 --- a/debootstrap-ng.sh +++ b/debootstrap-ng.sh @@ -225,7 +225,7 @@ EOF # stage: install additional packages display_alert "Installing packages for" "Armbian" "info" - eval 'LC_ALL=C LANG=C chroot $DEST/cache/sdcard /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y $apt_extra --no-install-recommends install $PACKAGE_LIST"' \ + eval 'LC_ALL=C LANG=C chroot $DEST/cache/sdcard /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -y -q $apt_extra --no-install-recommends install $PACKAGE_LIST"' \ ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/debug/debootstrap.log'} \ ${OUTPUT_DIALOG:+' | dialog --backtitle "$backtitle" --progressbox "Installing Armbian system..." 20 80'} \ ${OUTPUT_VERYSILENT:+' >/dev/null 2>/dev/null'} @@ -434,6 +434,12 @@ create_image() # DEBUG: print free space df -h | grep "$DEST/cache/" | tee -a $DEST/debug/debootstrap.log + if [[ $FEL_BOOT == yes ]]; then + FEL_ROOTFS=$DEST/cache/sdcard/ + display_alert "Trying FEL boot" "$BOARD" "info" + source $SRC/lib/fel-load.sh + fi + # stage: write u-boot write_uboot $LOOP diff --git a/fel-load.sh b/fel-load.sh new file mode 100644 index 0000000000..dd295f3923 --- /dev/null +++ b/fel-load.sh @@ -0,0 +1,55 @@ +#!/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 +# + +fel_prepare_host() +{ + # install necessary packages; assume that sunxi-tools is installed manually by user + if [[ $(dpkg-query -W -f='${db:Status-Abbrev}\n' nfs-kernel-server 2>/dev/null) != *ii* ]]; then + display_alert "Installing package" "nfs-kernel-server" "info" + apt-get install -q -y --no-install-recommends nfs-kernel-server + fi + if [[ ! -f /etc/exports.d/armbian.exports ]]; then + display_alert "Creating NFS share for" "rootfs" "info" + mkdir -p /etc/exports.d + echo "$FEL_ROOTFS *(rw,async,no_subtree_check,no_root_squash,fsid=root)" > /etc/exports.d/armbian.exports + exportfs -ra + fi +} + +fel_prepare_script() +{ + cp $SRC/lib/scripts/fel-boot.cmd.template $FEL_ROOTFS/boot/boot.cmd + if [[ -z $FEL_LOCAL_IP ]]; then + FEL_LOCAL_IP=$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p') + fi + 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 +} + +fel_load() +{ + echo > $FEL_ROOTFS/etc/fstab + if [[ -z $FEL_DTB_FILE ]]; then + FEL_DTB_FILE=$(grep CONFIG_DEFAULT_DEVICE_TREE $SOURCES/$BOOTSOURCEDIR/.config | cut -d '"' -f2).dtb + fi + display_alert "Loading files via" "FEL USB" "info" + sunxi-fel -v uboot $SOURCES/$BOOTSOURCEDIR/u-boot-sunxi-with-spl.bin \ + write 0x42000000 $FEL_ROOTFS/boot/zImage \ + write 0x43000000 $FEL_ROOTFS/boot/dtb/$FEL_DTB_FILE \ + write 0x43100000 $FEL_ROOTFS/boot/boot.scr +} + +fel_prepare_host +fel_prepare_script +fel_load +display_alert "Press to finish" "FEL load" "info" +read diff --git a/scripts/fel-boot.cmd.template b/scripts/fel-boot.cmd.template new file mode 100644 index 0000000000..d7ec3f2ba9 --- /dev/null +++ b/scripts/fel-boot.cmd.template @@ -0,0 +1,5 @@ +setenv nfs_ip FEL_LOCAL_IP +setenv nfs_root FEL_ROOTFS +setenv bootargs "console=ttyS0,115200 nfsrootdebug root=/dev/nfs nfsroot=${nfs_ip}:${nfs_root} ip=dhcp rw panic=10 consoleblank=0 enforcing=0 loglevel=7 init=/sbin/init" +setenv fdt_high ffffffff +bootz ${kernel_addr_r} - ${fdt_addr_r}