This commit is contained in:
zador-blood-stained
2016-08-09 18:26:22 +03:00
parent 21888cbb84
commit ba08617152
10 changed files with 8 additions and 1821 deletions

View File

@@ -107,7 +107,8 @@ 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 \
write_uboot_platform family_tweaks install_boot_script UBOOT_FILES LOCALVERSION UBOOT_COMPILER KERNEL_COMPILER UBOOT_TARGET
write_uboot_platform family_tweaks install_boot_script UBOOT_FILES LOCALVERSION UBOOT_COMPILER KERNEL_COMPILER UBOOT_TARGET \
MODULES MODULES_NEXT
read BOARD BRANCH RELEASE BUILD_DESKTOP <<< $line
n=$[$n+1]

View File

@@ -372,10 +372,11 @@ write_uboot()
{
local loop=$1
display_alert "Writing bootloader" "$loop" "info"
dpkg -x ${DEST}/debs/${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb /tmp/
mkdir -p /tmp/u-boot/
dpkg -x ${DEST}/debs/${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb /tmp/u-boot/
write_uboot_platform "/tmp/usr/lib/${CHOSEN_UBOOT}_${REVISION}_${ARCH}" "$loop"
[[ $? -ne 0 ]] && exit_with_error "U-boot failed to install" "@host"
rm -r /tmp/usr
rm -r /tmp/u-boot/
sync
}

View File

@@ -1,372 +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 tool chain https://github.com/igorpecovnik/lib
#
#
# Functions:
# custom_debootstrap
# shrinking_raw_image
# closing_image
# install_packet
# umount_image
custom_debootstrap (){
#---------------------------------------------------------------------------------------------------------------------------------
# Create clean and fresh Debian and Ubuntu image template if it does not exists
#---------------------------------------------------------------------------------------------------------------------------------
# needed if process failed in the middle
umount_image
# create needed directories and mount image to next free loop device
rm -rf $CACHEDIR/sdcard/
mkdir -p $CACHEDIR/rootfs $CACHEDIR/sdcard
cd $CACHEDIR
# We need to re-calculate from human to machine
BOOTSTART=$(($OFFSET*2048))
ROOTSTART=$(($BOOTSTART+($BOOTSIZE*2048)))
BOOTEND=$(($ROOTSTART-1))
# Create image file
if [ "$OUTPUT_DIALOG" = "yes" ]; then
(dd if=/dev/zero bs=1M status=none count=$SDSIZE | pv -n -s $(( $SDSIZE * 1024 * 1024 )) | dd status=none of=$CACHEDIR/tmprootfs.raw) 2>&1 \
| dialog --backtitle "$backtitle" --title "Creating blank image ($SDSIZE), please wait ..." --gauge "" 5 70
else
dd if=/dev/zero bs=1M status=none count=$SDSIZE | pv -p -b -r -s $(( $SDSIZE * 1024 * 1024 )) | dd status=none of=$CACHEDIR/tmprootfs.raw
fi
# Find first available free device
LOOP=$(losetup -f)
if [[ "$LOOP" != "/dev/loop0" && "$LOOP" != "/dev/loop1" ]]; then
display_alert "You run out of loop devices" "pleese reboot" "error"
exit
fi
# Mount image as block device
losetup $LOOP $CACHEDIR/tmprootfs.raw
sync
# Create partitions and file-system
parted -s $LOOP -- mklabel msdos
if [ "$BOOTSIZE" -eq "0" ]; then
parted -s $LOOP -- mkpart primary ext4 $ROOTSTART"s" -1s
partprobe $LOOP
# older mkfs.ext4 desn't know about 64bit and metadata_csum options
local codename=$(lsb_release -sc)
if [[ "$codename" == "sid" ]]; then
mkfs.ext4 -O ^64bit,^metadata_csum,uninit_bg -q $LOOP"p1"
else
mkfs.ext4 -q $LOOP"p1"
fi
mount $LOOP"p1" $CACHEDIR/sdcard/
else
parted -s $LOOP -- mkpart primary fat16 $BOOTSTART"s" $BOOTEND"s"
parted -s $LOOP -- mkpart primary ext4 $ROOTSTART"s" -1s
partprobe $LOOP
mkfs.vfat -n "$IMAGEVOLUME" $LOOP"p1" >/dev/null 2>&1
mkfs.ext4 -q $LOOP"p2"
mount $LOOP"p2" $CACHEDIR/sdcard/
mkdir -p $CACHEDIR/sdcard/boot
mount $LOOP"p1" $CACHEDIR/sdcard/boot
fi
# rootfs cache file name
[[ $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}-$ARCH.$packages_hash.tgz"
# Uncompress from cache
if [ -f "$cache_fname" ]; then
filemtime=`stat -c %Y $cache_fname`
currtime=`date +%s`
diff=$(( (currtime - filemtime) / 86400 ))
display_alert "Extracting $RELEASE from cache" "$diff days old" "info"
pv -p -b -r -c -N "$(basename $cache_fname)" "$cache_fname" | pigz -dc | tar xp -C $CACHEDIR/sdcard/
rm $CACHEDIR/sdcard/etc/resolv.conf
echo "nameserver 8.8.8.8" > $CACHEDIR/sdcard/etc/resolv.conf
if [ "$diff" -gt "3" ]; then
chroot $CACHEDIR/sdcard /bin/bash -c "apt-get update" | dialog --backtitle "$backtitle" --title "Force package update ..." --progressbox $TTY_Y $TTY_X
fi
fi
# If we don't have a filesystem cached, let's make em
if [ ! -f "$cache_fname" ]; then
# debootstrap base system
[[ -n $PACKAGE_LIST_EXCLUDE ]] && local package_exclude="--exclude="${PACKAGE_LIST_EXCLUDE// /,}
[[ $DISTRIBUTION == "Debian" ]] && local redir="http://httpredir.debian.org/debian/"
debootstrap --include=openssh-server $package_exclude --arch=$ARCH --foreign $RELEASE $CACHEDIR/sdcard/ $redir | dialog --backtitle "$backtitle" --title "Debootstrap $DISTRIBUTION $RELEASE base system to image template ..." --progressbox $TTY_Y $TTY_X
# we need emulator for second stage
cp /usr/bin/$QEMU_BINARY $CACHEDIR/sdcard/usr/bin/
# and keys
d=$CACHEDIR/sdcard/usr/share/keyrings/
test -d "$d" || mkdir -p "$d" && cp /usr/share/keyrings/debian-archive-keyring.gpg "$d"
# enable arm binary format so that the cross-architecture chroot environment will work
test -e /proc/sys/fs/binfmt_misc/qemu-arm || update-binfmts --enable qemu-arm
# debootstrap second stage
chroot $CACHEDIR/sdcard /bin/bash -c "/debootstrap/debootstrap --second-stage" | dialog --backtitle "$backtitle" --title "Installing $DISTRIBUTION $RELEASE base system to image template ..." --progressbox $TTY_Y $TTY_X
# mount proc, sys and dev
mount -t proc chproc $CACHEDIR/sdcard/proc
mount -t sysfs chsys $CACHEDIR/sdcard/sys
mount -t devtmpfs chdev $CACHEDIR/sdcard/dev || mount --bind /dev $CACHEDIR/sdcard/dev
mount -t devpts chpts $CACHEDIR/sdcard/dev/pts
# choose proper apt list
cp $SRC/lib/config/apt/sources.list.$RELEASE $CACHEDIR/sdcard/etc/apt/sources.list
# add armbian key
echo "deb http://apt.armbian.com $RELEASE main" > $CACHEDIR/sdcard/etc/apt/sources.list.d/armbian.list
cp $SRC/lib/bin/armbian.key $CACHEDIR/sdcard
chroot $CACHEDIR/sdcard /bin/bash -c "cat armbian.key | apt-key add -"
rm $CACHEDIR/sdcard/armbian.key
# update and upgrade
LC_ALL=C LANGUAGE=C LANG=C chroot $CACHEDIR/sdcard /bin/bash -c "apt-get -y update" | dialog --progressbox "Updating package databases ..." $TTY_Y $TTY_X
# generate locales and install packets
display_alert "Install locales" "$DEST_LANG" "info"
LC_ALL=C LANGUAGE=C LANG=C chroot $CACHEDIR/sdcard /bin/bash -c "apt-get -y -qq install locales"
if [ -f $CACHEDIR/sdcard/etc/locale.gen ]; then sed -i "s/^# $DEST_LANG/$DEST_LANG/" $CACHEDIR/sdcard/etc/locale.gen; fi
LC_ALL=C LANGUAGE=C LANG=C chroot $CACHEDIR/sdcard /bin/bash -c "locale-gen $DEST_LANG"
LC_ALL=C LANGUAGE=C LANG=C chroot $CACHEDIR/sdcard /bin/bash -c "export CHARMAP=$CONSOLE_CHAR FONTFACE=8x16 LANG=$DEST_LANG LANGUAGE=$DEST_LANG DEBIAN_FRONTEND=noninteractive"
LC_ALL=C LANGUAGE=C LANG=C chroot $CACHEDIR/sdcard /bin/bash -c "update-locale LANG=$DEST_LANG LANGUAGE=$DEST_LANG LC_MESSAGES=POSIX"
install_packet "$PACKAGE_LIST" "Installing Armbian on the top of $DISTRIBUTION $RELEASE base system ..."
chroot $CACHEDIR/sdcard /bin/bash -c "apt-get clean"
chroot $CACHEDIR/sdcard /bin/bash -c "sync"
chroot $CACHEDIR/sdcard /bin/bash -c "unset DEBIAN_FRONTEND"
sync
sleep 3
# unmount proc, sys and dev from chroot
umount -l $CACHEDIR/sdcard/dev/pts
umount -l $CACHEDIR/sdcard/dev
umount -l $CACHEDIR/sdcard/proc
umount -l $CACHEDIR/sdcard/sys
# kill process inside
KILLPROC=$(ps -uax | pgrep ntpd | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi
KILLPROC=$(ps -uax | pgrep dbus-daemon | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi
KILLPROC=$(ps -uax | pgrep bluetoothd | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi
KILLPROC=$(ps -uax | pgrep acpid | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi
KILLPROC=$(ps -uax | pgrep python | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi
display_alert "Closing debootstrap process and preparing cache." "" "info"
tar cp --directory=$CACHEDIR/sdcard/ --exclude='./dev/*' --exclude='./proc/*' --exclude='./run/*' --exclude='./tmp/*' \
--exclude='./mnt/*' --exclude='./sys/*' . | pv -p -b -r -s $(du -sb $CACHEDIR/sdcard/ | cut -f1) -N "$(basename $cache_fname)" | pigz > $cache_fname
fi
#
# mount proc, sys and dev
mount -t proc chproc $CACHEDIR/sdcard/proc
mount -t sysfs chsys $CACHEDIR/sdcard/sys
mount -t devtmpfs chdev $CACHEDIR/sdcard/dev || mount --bind /dev $CACHEDIR/sdcard/dev
mount -t devpts chpts $CACHEDIR/sdcard/dev/pts
# create proper fstab
if [[ $BOOTSIZE -eq 0 ]]; then
local device="/dev/mmcblk0p1 / ext4 defaults,noatime,nodiratime,data=writeback,commit=600,errors=remount-ro"
else
local device="/dev/mmcblk0p2 / ext4 defaults,noatime,nodiratime,data=writeback,commit=600,errors=remount-ro"
echo "/dev/mmcblk0p1 /boot vfat defaults 0 0" >> $CACHEDIR/sdcard/etc/fstab
fi
echo "$device 0 0" >> $CACHEDIR/sdcard/etc/fstab
}
shrinking_raw_image (){ # Parameter: RAW image with full path
#---------------------------------------------------------------------------------------------------------------------------------
# Shrink partition and image to real size with a place for 128Mb swap space
#---------------------------------------------------------------------------------------------------------------------------------
RAWIMAGE=$1
display_alert "Shrink image last partition to" "minimum" "info"
# partition prepare
LOOP=$(losetup -f)
losetup $LOOP $RAWIMAGE
PARTSTART=$(parted $LOOP unit s print -sm | tail -1 | cut -d: -f2 | sed 's/s//')
PARTEND=$(parted $LOOP unit s print -sm | head -3 | tail -1 | cut -d: -f3 | sed 's/s//') # end of first partition
PARTSTARTBLOCKS=$(($PARTSTART*512))
echo "PARTSTART $PARTSTART PARTEND $PARTEND PARTSTARTBLOCKS $PARTSTARTBLOCKS" >> $DEST/debug/output.log
sleep 1; losetup -d $LOOP
# convert from EXT4 to EXT2
sleep 1; losetup -o $PARTSTARTBLOCKS $LOOP $RAWIMAGE
sleep 1; fsck -n $LOOP >/dev/null 2>&1
sleep 1; tune2fs -O ^has_journal $LOOP >/dev/null 2>&1
sleep 1; e2fsck -fy $LOOP >/dev/null 2>&1
resize2fs $LOOP -M >/dev/null 2>&1
BLOCKSIZE=$(LANGUAGE=english tune2fs -l $LOOP | grep "Block count" | awk '{ print $(NF)}')
RESERVEDBLOCKSIZE=$(LANGUAGE=english tune2fs -l $LOOP | grep "Reserved block count" | awk '{ print $(NF)}')
BLOCKSIZE=$(($PARTSTART+$BLOCKSIZE+50000)) # fixed reserve to be enough for swap file creation
echo "BLOCKSIZE $BLOCKSIZE RESERVEDBLOCKSIZE $RESERVEDBLOCKSIZE" >> $DEST/debug/output.log
resize2fs $LOOP $BLOCKSIZE >/dev/null 2>&1
tune2fs -O has_journal $LOOP >/dev/null 2>&1
tune2fs -o journal_data_writeback $LOOP >/dev/null 2>&1
losetup -d $LOOP
# mount once again and create new partition
sleep 1; losetup $LOOP $RAWIMAGE
PARTITIONS=$(parted -m $LOOP 'print' | tail -1 | awk -F':' '{ print $1 }')
parted $LOOP rm $PARTITIONS >/dev/null 2>&1
NEWSIZE=$((($BLOCKSIZE)*4096/1024))
STARTFROM=$(($PARTEND+1)) # if we have two partitions, start of second one is where first one ends +1
[[ $PARTITIONS == 1 ]] && STARTFROM=$PARTSTART
((echo n; echo p; echo ; echo $STARTFROM; echo "+"$NEWSIZE"K"; echo w;) | fdisk $LOOP)>/dev/null
sleep 1
# truncate the image
TRUNCATE=$(parted -m $LOOP 'unit s print' | tail -1 | awk -F':' '{ print $3 }' | sed 's/.$//')
TRUNCATE=$((($TRUNCATE+1)*512))
truncate -s $TRUNCATE $RAWIMAGE >/dev/null 2>&1
losetup -d $LOOP
echo "NEWSIZE $NEWSIZE STARTFROM $STARTFROM TRUNCATE $TRUNCATE" >> $DEST/debug/install.log
}
closing_image (){
#--------------------------------------------------------------------------------------------------------------------------------
# Closing image and clean-up
#--------------------------------------------------------------------------------------------------------------------------------
# if we have a special fat boot partition, alter rootfs=
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
fi
# convert to uboot compatible script
[[ -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
customize_image
chroot $CACHEDIR/sdcard /bin/bash -c "sync"
sync
sleep 3
# unmount proc, sys and dev from chroot
umount -l $CACHEDIR/sdcard/dev/pts
umount -l $CACHEDIR/sdcard/dev
umount -l $CACHEDIR/sdcard/proc
umount -l $CACHEDIR/sdcard/sys
umount -l $CACHEDIR/sdcard/tmp >/dev/null 2>&1
# let's create nice file name
VER="${VER/-$LINUXFAMILY/}"
VERSION=$VERSION" "$VER
VERSION="${VERSION// /_}"
VERSION="${VERSION//$BRANCH/}"
VERSION="${VERSION//__/_}"
if [ "$BUILD_DESKTOP" = "yes" ]; then
VERSION=$VERSION"_desktop"
fi
# kill process inside
KILLPROC=$(ps -uax | pgrep ntpd | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi
KILLPROC=$(ps -uax | pgrep dbus-daemon | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi
KILLPROC=$(ps -uax | pgrep bluetoothd | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi
KILLPROC=$(ps -uax | pgrep acpid | tail -1); if [ -n "$KILLPROC" ]; then kill -9 $KILLPROC; fi
# same info outside the image
cp $CACHEDIR/sdcard/etc/armbian.txt $CACHEDIR/
sleep 2
rm -f $CACHEDIR/sdcard/usr/bin/$QEMU_BINARY
sleep 2
umount -l $CACHEDIR/sdcard/boot > /dev/null 2>&1 || /bin/true
umount -l $CACHEDIR/sdcard/
sleep 2
losetup -d $LOOP
rm -rf $CACHEDIR/sdcard/
# write bootloader
LOOP=$(losetup -f)
losetup $LOOP $CACHEDIR/tmprootfs.raw
write_uboot $LOOP
sleep 3
losetup -d $LOOP
sync
sleep 2
mv $CACHEDIR/tmprootfs.raw $CACHEDIR/$VERSION.raw
sync
sleep 2
# let's shrint it
shrinking_raw_image "$CACHEDIR/$VERSION.raw" "15"
sleep 2
cd $CACHEDIR/
cp $SRC/lib/bin/imagewriter.exe .
# sign with PGP
if [[ $GPG_PASS != "" ]] ; then
echo $GPG_PASS | gpg --passphrase-fd 0 --armor --detach-sign --batch --yes $VERSION.raw
echo $GPG_PASS | gpg --passphrase-fd 0 --armor --detach-sign --batch --yes imagewriter.exe
echo $GPG_PASS | gpg --passphrase-fd 0 --armor --detach-sign --batch --yes armbian.txt
fi
display_alert "Signing and compressing" "Please wait!" "info"
mkdir -p $DEST/images
if [[ $COMPRESS_OUTPUTIMAGE != yes ]]; then
rm -f *.asc imagewriter.* armbian.txt
mv *.raw $DEST/images/
else
if [[ $SEVENZIP == yes ]]; then
FILENAME=$DEST/images/$VERSION.7z
7za a -t7z -bd -m0=lzma2 -mx=9 -mfb=64 -md=32m -ms=on $FILENAME $VERSION.raw* armbian.txt imagewriter.* >/dev/null 2>&1
else
FILENAME=$DEST/images/$VERSION.zip
zip -FSq $FILENAME $VERSION.raw* armbian.txt imagewriter.*
fi
rm -f $VERSION.raw *.asc armbian.txt
FILESIZE=$(ls -l --b=M $FILENAME | cut -d " " -f5)
display_alert "Done building" "$FILENAME [$FILESIZE]" "info"
fi
}
install_packet ()
{
#--------------------------------------------------------------------------------------------------------------------------------
# Install packets inside chroot
#--------------------------------------------------------------------------------------------------------------------------------
i=0
j=1
declare -a PACKETS=($1)
skupaj=${#PACKETS[@]}
while [[ $i -lt $skupaj ]]; do
procent=$(echo "scale=2;($j/$skupaj)*100"|bc)
procent=${procent%.*}
x=${PACKETS[$i]}
chroot $CACHEDIR/sdcard /bin/bash -c "DEBIAN_FRONTEND=noninteractive apt-get -qq -y install $x --no-install-recommends" >> $DEST/debug/debootstrap.log 2>&1
if [ $? -ne 0 ]; then display_alert "Installation of package failed" "$INSTALL" "err"; exit 1; fi
printf '%.0f\n' $procent | dialog --backtitle "$backtitle" --title "$2" --gauge "\n\n$x" 9 70
i=$[$i+1]
j=$[$j+1]
done
}
umount_image (){
umount -l $CACHEDIR/sdcard/dev/pts >/dev/null 2>&1
umount -l $CACHEDIR/sdcard/dev >/dev/null 2>&1
umount -l $CACHEDIR/sdcard/proc >/dev/null 2>&1
umount -l $CACHEDIR/sdcard/sys >/dev/null 2>&1
umount -l $CACHEDIR/sdcard/tmp >/dev/null 2>&1
umount -l $CACHEDIR/sdcard >/dev/null 2>&1
x=$(losetup -a | awk '{ print $1 }' | rev | cut -c 2- | rev | tac)
for y in $x; do
losetup -d $y
done
}

View File

@@ -1,113 +0,0 @@
Enable Hardware Features
========================
Some boards require some manual configuration to turn on/off certain features
In some cases, the procedure is "less than obvious", so we document some basic examples here.
# Generic howto for Allwinner devices
## Legacy or Vanilla kernel ?
Many Armbian images come in two flavours : Legacy (using an older kernel version) and Vanilla (up-to-date kernel). Depending on kernel version, the procedure to enable/disable features is not the same :
* Legacy kernel : FEX
* Vanilla kernel : DT (Device Tree)
## What flavour am I using ?
Best way to know is by checking your kernel version :
```
root@bananapipro:~# uname -a
Linux bananapipro 4.5.2-sunxi #11 SMP Thu Apr 28 21:53:25 CEST 2016 armv7l GNU/Linux
```
In this example the kernel version is 4.5.2 so you can use DT to tweak some settings. If you get a kernel version 3.X then you'll be certainly using FEX like on an Orange Pi Plus 2E :
```
root@orangepiplus2e:~# uname -a
Linux orangepiplus2e 3.4.112-sun8i #10 SMP PREEMPT Wed Jun 1 19:43:08 CEST 2016 armv7l GNU/Linux
```
## FEX
### Which file should I edit
Armbian embed a lot of BIN files, but a symlink point to the one in use :
```
root@orangepiplus2e:~# ls -la /boot/script.bin
lrwxrwxrwx 1 root root 22 Jun 1 20:30 /boot/script.bin -> bin/orangepiplus2e.bin
```
### Updating a FEX
You may need to use `sudo` with all the following commands.
The whole process won't overwrite any of your files. If you're paranoid, you can make a proper backup of your BIN file :
```
cp /boot/script.bin /boot/bin/script.bin.backup
```
Then you can decompile your BIN into a FEX :
```
bin2fex /boot/script.bin /tmp/custom.fex
```
Finally you can edit your FEX file with your favorite text editor and compile it back to a BIN :
```
fex2bin /tmp/custom.fex /boot/bin/custom.bin
```
The last step is to change the symlink to use your custom BIN :
```
ln -sf /boot/bin/custom.bin /boot/script.bin
```
## Device Tree
### Which file should I edit
I use the following command and try to guess which file to use in `/boot/dtb/` :
```
cat /proc/device-tree/model
```
# H3 based Orange Pi, legacy kernel
## Enable serial /dev/ttyS3 on pins 8 and 10 of the 40 pin header
Update the FEX configuration (which is compiled into a .bin) located at /boot/script.bin
Decompile .bin to .fex
```
cd /boot
bin2fex script.bin > custom.fex
rm script.bin # only removes symbolic link
```
Edit .fex file
```
[uart3]
uart_used = 1 ; Change from 0 to 1
uart_port = 3
uart_type = 2 ; In this case we have a 2 pin UART
uart_tx = port:PA13<3><1><default><default>
uart_rx = port:PA14<3><1><default><default>
```
Compile .fex to .bin
```
fex2bin custom.fex > script.bin
```
Reboot
Notice that /dev/ttyS3 appears. That is your new UART device.
****

View File

@@ -1,72 +0,0 @@
# FEL/NFS boot explanation
### 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, 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
### Requirements
- Allwinner device that supports FEL mode. Check [wiki](https://linux-sunxi.org/FEL) to find out how to enter FEL mode with your device
- USB connection between build host and board OTG port (VM USB passthrough or USB over IP may work too)
- 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)
- DHCP server in local network
- UART console connected to target board
### Build script options
- KERNEL_ONLY=no
- EXTENDED_DEBOOTSTRAP=yes
- ROOTFS_TYPE=fel
Example:
```
./compile.sh KERNEL_ONLY=no BOARD=cubietruck BRANCH=next PROGRESS_DISPLAY=plain USE_MAINLINE_GOOGLE_MIRROR=yes RELEASE=jessie BUILD_DESKTOP=no EXTENDED_DEBOOTSTRAP=yes ROOTFS_TYPE=fel
```
### Shutdown and reboot
Once you start FEL boot, you will see this prompt:
```
[ o.k. ] Press any key to boot again, <q> to finish [ FEL ]
```
Pressing `q` deletes current rootfs and finishes build process, so you need to shut down or reboot your board to avoid possible problems unmounting/deleting temporary rootfs. All changes to root filesystem will persist until you exit FEL mode.
To reboot again into testing system, switch your board into FEL mode and press any key other than `q`.
Because kernel and .bin/.dtb file are loaded from rootfs each time, it's possible to update kernel or its configuration (via `apt-get`, `dtc`, `fex2bin`/`bin2fex`) from within running system.
### Advanced configuration
If you don't have DHCP server in your local network or if you need to alter kernel command line, use `lib/scripts/fel-boot.cmd.template` as a template and save modified script as `userpatches/fel-boot.cmd`. Check [this](https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/plain/Documentation/filesystems/nfs/nfsroot.txt) for configuring static IP for NFS root
Set `FEL_DTB_FILE` to relative path to .dtb or .bin file if it can't be obtained from u-boot config (mainline kernel) or boot/script.bin (legacy kernel)
You may need to set these additional options (it's a good idea to put them in `userpatches/lib.config`:
Set `FEL_NET_IFNAME` to name of your network interface if you have more than one non-loopback interface with assigned IPv4 address on your build host
Set `FEL_LOCAL_IP` to IP address that can be used to reach NFS server on your build host if it can't be obtained from ifconfig (i.e. port forwarding to VM guest)
Set `FEL_AUTO=yes` to skip prompt before trying FEL load
### Customization
You can even create `userpatches/fel-hooks.sh` and define there 2 functions: `fel_post_prepare` and `fel_pre_load`. All normal build variables like $BOARD, $BRANCH and so on can be used in these functions to define specific actions.
`fel_post_prepare` is executed once after setting up u-boot script and NFS share, you can use it to add extra stuff to boot.scr (like `gpio set` or `setenv machid`) based on device name.
`fel_pre_load` is executed before calling sunxi-fel, you can use it to implement logic to select one of multiple connected boards; to pass additional arguments to `sunxi-fel` you can use `FEL_EXTRA_ARGS` variable.
An example is provided as `scripts/fel-hooks.sh.example`.

View File

@@ -1,233 +0,0 @@
# How to contribute to the code?
1. [Fork](http://help.github.com/forking/) the project
2. Make one or more well commented and clean commits to the repository.
3. Perform a [pull request](http://help.github.com/pull-requests/) in github's web interface.
If it is a new feature request, don't start the coding first. Remember to [open an issue](https://guides.github.com/features/issues/) to discuss the new feature.
If you are struggling, check [this detailed step by step guide on contributing](https://www.exchangecore.com/blog/contributing-concrete5-github/).
# How to build Armbian image or custom kernel?
You will need to setup development environment within [Ubuntu 14.04 LTS x64 server image](http://releases.ubuntu.com/14.04/) and cca. 20G of free space.
Login as root and run:
apt-get -y -qq install git
git clone --depth 1 https://github.com/igorpecovnik/lib
cp lib/compile.sh .
nano compile.sh # alter if necessary
Run the script
./compile.sh
# Build options clarification
- **KERNEL_ONLY** (yes|no):
- set to "yes" to compile only kernel, u-boot and other packages for installing on existing Armbian system
- set to "no" to build complete OS image for writing to SD card
- **KERNEL_CONFIGURE** (yes|no):
- set to "yes" to configure kernel (add or remove modules or features). Kernel configuration menu will be brought up before compilation
- set to "no" to compile kernel without changing default or custom provided configuration
- **CLEAN_LEVEL** (comma-separated list): defines what should be cleaned. Default value is `"make,debs"` - clean sources and remove all packages. Changing this option can be useful when rebuilding images or building more than one image
- "make" = execute `make clean` for selected kernel and u-boot sources,
- "images" = delete `output/images` (complete OS images),
- "debs" = delete packages in `output/debs` for current branch and device family,
- "alldebs" = delete all packages in `output/debs`,
- "cache" = delete `output/cache` (rootfs cache),
- "sources" = delete `sources` (all downloaded sources)
- **KERNEL\_KEEP\_CONFIG** (yes|no):
- set to "yes" to use kernel config file from previous compilation for the same branch, device family and version
- set to "no" to use default or user-provided config file
- **BUILD_DESKTOP** (yes|no):
- set to "yes" to build image with minimal desktop environment
- set to "no" to build image with console interface only
- **EXTERNAL** (yes|no):
- set to "yes" to compile and install some extra applications and drivers (only for **default** kernel branch):
- [USB redirector](http://www.incentivespro.com)
- Realtek RT8192 wireless driver
- Mediatek MT7601U wireless - driver
- Sunxi display control
- hostapd from sources
- **DEBUG_MODE** (yes|no)
- set to "yes" will prompt you right before the compilation starts to make changes to the source code. Separate for u-boot and kernel. It will also create a patch out of this. If you want that this patch is included in the normal run, you need to copy it to appropriate directory
- set to "no" compilation will run uninterrupted
- **FORCE_CHECKOUT** (yes|no):
- set to "yes" to force overwrite any changed or manually patched kernel, u-boot and other sources
- set to "no" to keep all changes to sources
- **BUILD_ALL** (yes|no): cycle through all available board and kernel configurations and make images for all combinations
### Hidden options to minimize user input for build automation:
- **BOARD** (string): you can set name of board manually to skip dialog prompt
- **BRANCH** (default|next|dev): you can set kernel and u-boot branch manually to skip dialog prompt; some options may not be available for all devices
- **RELEASE** (wheezy|jessie|trusty|xenial): you can set OS release manually to skip dialog prompt; use this option with `KERNEL_ONLY=yes` to create board support package
### Hidden options for advanced users (default values are marked **bold**):
- **USE_CCACHE** (**yes**|no): use a C compiler cache to speed up the build process
- **PROGRESS_DISPLAY** (none|plain|**dialog**): way to display output of verbose processes - compilation, packaging, debootstrap
- **PROGRESS_LOG_TO_FILE** (yes|**no**): duplicate output, affected by previous option, to log files `output/debug/*.log`
- **USE_MAINLINE_GOOGLE_MIRROR** (yes|**no**): use `googlesource.com` mirror for downloading mainline kernel sources, may be faster than `git.kernel.org` depending on your location
- **EXTENDED_DEBOOTSTRAP** (**yes**|no): use new debootstrap and image creation process
- **FORCE_USE_RAMDISK** (yes|no): overrides autodetect for using tmpfs in new debootstrap and image creation process. Takes effect only if `EXTENDED_DEBOOTSTRAP` is set to "yes"
- **FIXED_IMAGE_SIZE** (integer): create image file of this size (in megabytes) instead of minimal. Takes effect only if `EXTENDED_DEBOOTSTRAP` is set to "yes"
- **COMPRESS_OUTPUTIMAGE** (yes|**no**): create compressed archive with image file and GPG signature for redistribution
- **SEVENZIP** (yes|**no**): create .7z archive with extreme compression ratio instead of .zip
- **ROOTFS_TYPE** (**ext4**|f2fs|btrfs|nfs|fel): create image with different root filesystems instead of default ext4. Requires setting FIXED_IMAGE_SIZE to actual size of your SD card for F2FS and BTRFS. Takes effect only if `EXTENDED_DEBOOTSTRAP` is set to "yes"
### Supplying options via command line parameters
Instead of editing compile.sh to set options, you can set them by supplying command line parameters to compile.sh
Example:
./compile.sh BRANCH=next BOARD=cubietruck KERNEL_ONLY=yes PROGRESS_DISPLAY=plain RELEASE=jessie
Note: Option `BUILD_ALL` cannot be set to "yes" via command line parameter.
## User provided patches
You can add your own patches outside build script. Place your patches inside appropriate directory, for kernel or u-boot. There are no limitations except all patches must have file name extension `.patch`. User patches directory structure mirrors directory structure of `lib/patch`. Look for the hint at the beginning of patching process to select proper directory for patches. Example:
[ o.k. ] Started patching process for [ kernel sunxi-dev 4.4.0-rc6 ]
[ o.k. ] Looking for user patches in [ userpatches/kernel/sunxi-dev ]
Patch with same file name in `userpatches` directory tree substitutes one in `lib/patch`. To _replace_ a patch provided by Armbian maintainers, copy it from `lib/patch` to corresponding directory in `userpatches` and edit it to your needs. To _disable_ a patch, create empty file in corresponding directory in `userpatches`.
## User provided kernel config
If file `userpatches/linux-$KERNELFAMILY-$KERNELBRANCH.config` exists, it will be used instead of default one from `lib/config`. Look for the hint at the beginning of kernel compilation process to select proper config file name. Example:
[ o.k. ] Compiling dev kernel [ @host ]
[ o.k. ] Using kernel config file [ lib/config/linux-sunxi-dev.config ]
## User provided image customization script
You can run additional commands to customize created image. Edit file:
userpatches/customize-image.sh
and place your code here. You may test values of variables noted in the file to use different commands for different configurations. Those commands will be executed in a chroot environment just before closing image.
To add files to image easily, put them in `userpatches/overlay` and access them in `/tmp/overlay` from `customize-image.sh`
## Partitioning of the SD card
In case you define `$FIXED_IMAGE_SIZE` at build time the partition containing the rootfs will be made of this size. Default behaviour when this is not defined and `$ROOTFS_TYPE` is set to _ext4_ is to shrink the partition to minimum size at build time and expand it to the card's maximum capacity at boot time (leaving an unpartitioned spare area of ~5% when the size is 4GB or less to help the SD card's controller with wear leveling and garbage collection on old/slow cards).
You can prevent the partition expansion from within `customize-image.sh` by a `touch /root/.no_rootfs_resize` or configure the resize operation by either a percentage or a sector count using `/root/.rootfs_resize` (`50%` will use only half of the card's size if the image size doesn't exceed this or `3887103s` for example will use sector 3887103 as partition end. Values without either `%` or `s` will be ignored)
# What is behind the build process?
Build process summary:
- creates development environment on the top of X86/AMD64 Ubuntu 14.04 LTS,
- downloads proven sources, applies patches and uses tested configurations,
- cross-compiles universal boot loader (u-boot), kernel and other tools and drivers,
- packs kernel, uboot, dtb and root customizations into debs,
- debootstraps minimalistic Debian Wheezy, Jessie and Ubuntu Trusty into SD card image,
- installs additional packets, applies customizations and shrinks image to its actual size.
Image compiling example with partial cache:
[su_youtube_advanced url="https:\/\/youtu.be\/zeShf12MNLg" controls="yes" showinfo="no" loop="yes" rel="no" modestbranding="yes"]
## Creating compile environment ##
At first run we are downloading all necessary dependencies.
## Using board configuration ##
We need to get some predefined variables about selected board. Which kernel & uboot source to use, modules to load, which is the build number, do we need to have a single partition or dual with boot on fat, which extra drivers to compile out of the kernel tree, ...
**Board configuration example:**
BOOTSIZE="16" # FAT boot partition in MB, 0 for none
BOOTCONFIG="udoo_neo_config" # Which compile config to use
LINUXFAMILY="udoo" # boards share kernel
Note that in this case, all main config options (kernel and uboot source) are covered within FAMILY. Check [configuration.sh](https://github.com/igorpecovnik/lib/blob/master/configuration.sh) for more config options.
This **isn't ment to be user configurable** but you can alter variables if you know what you are doing.
## Downloading sources ##
When we know where are the sources and where they need to be the download / update process starts. This might take from several minutes to several hours.
## Patching ##
In patching process we are appling patches to sources. The process is defined in:
lib/patch/kernel/sun7i-default
lib/patch/kernel/sunxi-dev
...
lib/patch/u-boot/u-boot-default
lib/patch/u-boot/u-boot-neo-default
...
Patch rules for subdirectories are: **KERNEL_FAMILY-BRANCH** for kernel and **U-BOOT-SOURCE-BRANCH** for U-boot.
## Debootstrap ##
Debootstrap creates fresh Debian / Ubuntu root filesystem templates or use cached under:
output/cache/rootfs/$DISTRIBUTION.tgz
To recreate those files you need to remove them manually.
## Kernel install ##
When root filesystem is ready we need to install kernel image with modules, board definitions, firmwares. Along with this we set the CPU frequency min/max, hostname, modules, network interfaces templates. Here is also the place to install headers and fix + native compile them on the way.
## Distribution fixes ##
Each distributin has it's own way of doing things:
- serial console
- different packets
- configuration locations
## Board fixes ##
Each board has their own tricks: **different device names, firmware loaders, configuration (de)compilers, hardware configurators**
## Desktop installation ##
You can build a desktop withing the image. Consider this feature as experimental. Hardware acceleration on Allwinner boards is working within kernel 3.4.x only.
## External applications ##
This place is reserved for custom applications. There is one example of application - USB redirector.
## Closing image ##
There is an option to add some extra commands just before closing an image which is also automaticaly shrink to it's actual size with some small reserve.
## Directory structure ##
It will be something like this:
compile.sh compile execution script
lib/bin/ blobs, firmwares, static compiled, bootsplash
lib/config/ kernel, board, u-boot, hostapd, package list
lib/documentation/ user and developers manual
lib/patch/ collection of kernel and u-boot patches
lib/scripts/ firstrun, arm hardware info, firmware loaders
lib/LICENSE licence description
lib/README.md quick manual
lib/common.sh creates environment, compiles, shrink image
lib/configuration.sh boards presets - kernel source, config, modules, ...
lib/debootstrap.sh basic system template creation
lib/distributions.sh system specific installation and fixes
lib/main.sh user input and script calls
lib/makeboarddeb.sh creates board support package .deb
lib/repo-update.sh creates and updates your local repository
lib/repo-show-sh show packets in your local repository
lib/upgrade.sh script to upgrade older images
sources/ source code for kernel, uboot and other utilities
output/repository repository
output/cache cache for root filesystem and headers compilation
output/debs deb packeges
output/images zip packed RAW image
userpatches/kernel put your kernel patches here
userpatches/u-boot put your u-boot patches here
userpatches/ put your kernel config here
## Additional info ##
- [Allwinner SBC community](https://linux-sunxi.org/)

File diff suppressed because it is too large Load Diff

View File

@@ -1,488 +0,0 @@
# What to download?
Each board is fully supported with up to **four basic system** options:
- Debian Wheezy or Jessie
- Ubuntu Trusty or Xenial
Some boards also have a desktop version Debian Jessie.
# Legacy or Vanilla?
Both kernels are stable and production ready, but you should use them for different purpuses since their basic support differ:
- legacy: video acceleration, NAND support, connecting displays
- vanilla: headless server, light desktop operations
# How to check download authenticity?
All our images are digitally signed and therefore it's possible to check theirs authentication. You need to unzip the download package and issue those commands (Linux):
# download my public key from the database
gpg --keyserver pgp.mit.edu --recv-key 9F0E78D5
gpg --verify Armbian_4.83_Armada_Debian_jessie_3.10.94.raw.asc
# proper respond
gpg: Signature made sob 09 jan 2016 15:01:03 CET using RSA key ID 9F0E78D5
gpg: Good signature from "Igor Pecovnik (Ljubljana, Slovenia) <igor.++++++++++++@gmail.com>"
# wrong repond. Not genuine Armbian image!
gpg: Signature made Sun 03 Jan 2016 11:46:25 AM CET using RSA key ID 9F0E78D5
gpg: BAD signature from "Igor Pecovnik (Ljubljana, Slovenia) <igor.++++++++++++@gmail.com>"
It is safe to ignore WARNING: This key is not certified with a trusted signature!
# How to prepare SD card?
7z and zip archives can be uncompressed with [7-Zip](http://www.7-zip.org/) on Windows, [Keka](http://www.kekaosx.com/en/) on Mac and 7z on Linux (apt-get install p7zip-full). RAW images can be written with [Rufus](https://rufus.akeo.ie/) (Win) or DD in Linux/Mac:
# Linux example: /dev/sdx is your sd card device
dd bs=1M if=filename.raw of=/dev/sdx
# OS X example: /dev/[r]diskx is your sd card device:
diskutil unmountDisk diskx && dd bs=1m if=filename.raw of=/dev/rdiskx && diskutil eject diskx
Image writing takes around 3 minutes on a slow, class 6 SD card.
Important: Make sure you use a **good & reliable** SD card. If you encounter boot troubles or simply as a measure of precaution, check them with [F3](http://oss.digirati.com.br/f3/) or [H2testw](http://www.heise.de/download/h2testw.html).
Also important: SD cards are optimised for sequential reads/writes as it's common in digital cameras. This is what the *speed class* is about. And while you shouldn't buy any card rated less than *class 10* today you should especially take care to choose one that is known to show high random I/O performance since this is way more performance relevant when used with any SBC.
You won't be wrong picking one of these:
[![Samsung EVO 16GB UHS-I](http://www.armbian.com/wp-content/uploads/2016/03/sdcard-samsung-1.png)](http://www.amazon.com/dp/B00IVPU7KE)
[![Transcend Ultimate 16 GB UHS-I](http://www.armbian.com/wp-content/uploads/2016/03/sdcard-transcend-1.png)](http://www.amazon.com/gp/product/B00BLHWYWS)
[![SanDisk Extreme Pro 16 GB UHS-I](http://www.armbian.com/wp-content/uploads/2016/03/sdcard-sandisk-1.png)](http://www.amazon.com/dp/B008HK1YAA)
Detailed informations regarding SD cards performance:
- [SD card performance with Armbian - Thomas Kaiser](http://forum.armbian.com/index.php/topic/954-sd-card-performance/)
- [Raspberry Pi microSD card performance comparison - Jeff Geerling](http://www.jeffgeerling.com/blogs/jeff-geerling/raspberry-pi-microsd-card)
- [The Best microSD Card - Kimber Streams](http://thewirecutter.com/reviews/best-microsd-card/)
# How to boot?
Insert SD card into a slot and power the board. First boot takes around 3 minutes then it reboots and you will need to wait another one minute to login. This delay is because system updates package list and creates 128Mb emergency SWAP on the SD card.
Normal boot (with DHCP) takes up to 35 seconds with a class 6 SD CARD and cheapest board.
# How to login?
Login as **root** on console or via SSH and use password **1234**. You will be prompted to change this password at first login. You will then be asked to create a normal user account that is sudo enabled (beware of default QWERTY keyboard settings at this stage).
Desktop images starts into desktop without asking for password. To change this add some display manager:
apt-get install lightdm
... or edit the contents of file:
/etc/default/nodm
and change the autologin user.
# How to update?
apt-get update
apt-get upgrade
This will not only update distribution packages (Debian/Ubuntu) but also updates Armbian kernel, u-boot and board support package if available. So if you've seen in the list of updated packages the names _u-boot_ or _linux_ the following command is required for changes to take effect:
reboot
# How to switch kernels or upgrade from other systems?
If you are running **legacy kernel** and you want to switch to **vanilla**, **development** or vice versa, you can do it this way:
wget -q -O - http://upgrade.armbian.com | bash
You will be prompted to select and confirm some actions. It's possible to upgrade **from any other distribution**. Note that this procedure upgrades only kernel with hardware definitions (bin, dtb, firmware and headers. Operating system and modifications remain as is.
Check [this for manual way](http://www.armbian.com/kernel/) and more info.
[su_youtube_advanced url="https:\/\/youtu.be\/iPAlPW3sv3I" controls="yes" showinfo="no" loop="yes" rel="no" modestbranding="yes"]
# How to troubleshoot?
**Important: If you came here since you can't get Armbian running on your board please keep in mind that in 95 percent of all cases it's either a faulty/fraud/counterfeit SD card or an insufficient power supply that's causing these sorts of _doesn't work_ issues!**
If you broke the system you can try to get in this way. You have to get to u-boot command prompt, using either a serial adapter or monitor and usb keyboard (USB support in u-boot currently not enabled on all H3 boards).
After switching power on or rebooting, when u-boot loads up, press some key on the keyboard (or send some key presses via terminal) to abort default boot sequence and get to the command prompt:
U-Boot SPL 2015.07-dirty (Oct 01 2015 - 15:05:21)
...
Hit any key to stop autoboot: 0
sunxi#
Enter these commands, replacing root device path if necessary. Select setenv line with ttyS0 for serial, tty1 for keyboard+monitor (these are for booting with mainline kernel, check boot.cmd for your device for commands related to legacy kernel):
setenv bootargs init=/bin/bash root=/dev/mmcblk0p1 rootwait console=ttyS0,115200
# or
setenv bootargs init=/bin/bash root=/dev/mmcblk0p1 rootwait console=tty1
ext4load mmc 0 0x49000000 /boot/dtb/${fdtfile}
ext4load mmc 0 0x46000000 /boot/zImage
env set fdt_high ffffffff
bootz 0x46000000 - 0x49000000
System should eventually boot to bash shell:
root@(none):/#
Now you can try to fix your broken system.
- [Fix a Jessie systemd problem due to upgrade from 3.4 to 4.x](https://github.com/igorpecovnik/lib/issues/111)
# How to unbrick the system?
When something goes terribly wrong and you are not able to boot the system, this is the way to proceed. You need some linux machine, where you can mount the failed SD card. With this procedure you will reinstall the u-boot, kernel and hardware settings. In most cases this should be enought to unbrick the board. It's recommended to issue a filesystem check before mounting:
fsck /dev/sdX -f
Than mount the SD card and download those files (This example is only for Banana R1):
http://apt.armbian.com/pool/main/l/linux-trusty-root-next-lamobo-r1/linux-trusty-root-next-lamobo-r1_4.5_armhf.deb
http://apt.armbian.com/pool/main/l/linux-upstream/linux-image-next-sunxi_4.5_armhf.deb
http://apt.armbian.com/pool/main/l/linux-upstream/linux-firmware-image-next-sunxi_4.5_armhf.deb
http://apt.armbian.com/pool/main/l/linux-upstream/linux-dtb-next-sunxi_4.5_armhf.deb
This is just an example for: **Ubuntu Trusty, Lamobo R1, Vanilla kernel** (next). Alter packages naming according to [this](http://forum.armbian.com/index.php/topic/211-kernel-update-procedure-has-been-changed/).
Mount SD card and extract all those deb files to it's mount point.
dpkg -x DEB_FILE /mnt
Go to /mnt/boot and link (or copy) **vmlinuz-4.x.x-sunxi** kernel file to **zImage**.
Unmount SD card, move it to the board and power on.
# How to add users?
To create a normal user do this:
adduser MyNewUsername
Put user to sudo group:
usermod -aG sudo MyNewUsername
# How to customize keyboard, time zone?
keyboard:
dpkg-reconfigure keyboard-configuration
system language:
# Debian --> https://wiki.debian.org/ChangeLanguage
dpkg-reconfigure locales
# Ubuntu --> https://help.ubuntu.com/community/Locale
update-locale LANG=[options] && dpkg-reconfigure locales
console font, codepage:
dpkg-reconfigure console-setup
time zone:
dpkg-reconfigure tzdata
screen settings on H3 devices:
# Example to set resolution to 1920 x 1080, full colour-range and DVI
h3disp -m 1080p60 -d -c 1
screen resolution on other boards:
nano /boot/boot.cmd
# example:
# change example from
# disp.screen0_output_mode=1920x1080p60
# to
# disp.screen0_output_mode=1280x720p60
mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
screen resolution interactive - only Allwinner boards with A10 and A20 with legacy kernel:
# Example to set console framebuffer resolution to 1280 x 720
a10disp changehdmimodeforce 4
Other modes:
0 480i
1 576i
2 480p
3 576p
4 720p 50Hz
5 720p 60Hz
6 1080i 50 Hz
7 1080i 60 Hz
8 1080p 24 Hz
9 1080p 50 Hz
10 1080p 60 Hz
# How to alter CPU frequency?
Some boards allow to adjust CPU speed.
nano /etc/default/cpufrequtils
Alter **min_speed** or **max_speed** variable.
service cpufrequtils restart
# How to upgrade into simple desktop environment?
apt-get -y install xorg lightdm xfce4 tango-icon-theme gnome-icon-theme
reboot
Check [this site](http://namhuy.net/1085/install-gui-on-debian-7-wheezy.html) for others and be prepared that some desktop image features currently might not work afterwards (eg. 2D/3D/video HW acceleration, so downgrading a _desktop_ image, removing the `libxfce4util-common` package and doing an `apt-get autoremove` later might be the better idea in such cases)
# How to upgrade Debian from Wheezy to Jessie?
dpkg -r ramlog
cp /etc/apt/sources.list{,.bak}
sed -i -e 's/ \(old-stable\|wheezy\)/ jessie/ig' /etc/apt/sources.list
apt-get update
apt-get --download-only dist-upgrade
apt-get dist-upgrade
# How to upgrade from Ubuntu Trusty to 16.04 LTS (Xenial Xerus)?
apt-get install update-manager-core
do-release-upgrade -d
# further to xenial
apt-get dist-upgrade
# How to toggle boot output?
Edit and change [boot parameters](http://redsymbol.net/linux-kernel-boot-parameters/) in /boot/boot.cmd:
- console=ttyS0,115200
+ console=tty1
and convert it to boot.scr with this command:
mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
Reboot.
Serial console on imx6 boards are ttymxc0 (Hummingboard, Cubox-i) or ttymxc1 (Udoo).
# How to toogle verbose boot?
touch /boot/.force-verbose # enable
You need to reboot to conduct changes.
rm /boot/.force-verbose # disable
# How to provide boot logs for inspection?
When computer behaves strange first step is to look into kernel logs. We made a tool that grabs info and paste it to the website.
sudo armbianmonitor -b
reboot
sudo armbianmonitor -u
Copy and past URL of your log to the forum, mail, ...
# How to build a wireless driver ?
Recreate kernel headers scripts (optional)
cd /usr/src/linux-headers-$(uname -r)
make scripts
Go back to root directory and fetch sources (working example, use ARCH=arm64 on 64bit system)
cd
git clone https://github.com/pvaret/rtl8192cu-fixes.git
cd rtl8192cu-fixes
make ARCH=arm
Load driver for test
insmod 8192cu.ko
Check dmesg and the last entry will be:
usbcore: registered new interface driver rtl8192cu
Plug the USB wireless adaptor and issue a command:
iwconfig wlan0
You should see this:
wlan0 unassociated Nickname:"<WIFI@REALTEK>"
Mode:Auto Frequency=2.412 GHz Access Point: Not-Associated
Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=0/100 Signal level=0 dBm Noise level=0 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
Check which wireless stations / routers are in range
iwlist wlan0 scan | grep ESSID
# How to install to eMMC, NAND, SATA & USB?
[su_youtube_advanced url="https:\/\/youtu.be\/6So8MA-qru8" controls="yes" showinfo="no" loop="yes" rel="no" modestbranding="yes"]
Required condition:
NAND:
* kernel 3.4.x and NAND storage
* pre-installed system on NAND (stock Android or other Linux)
eMMC/SATA/USB:
* any kernel
* onboard eMMC storage or permanently attached SATA or USB storage
Start the install script:
nand-sata-install
and follow the guide. You can create up to three scenarios:
* boot from SD, system on SATA / USB
* boot from eMMC / NAND, system on eMMC/NAND
* boot from eMMC / NAND, system on SATA / USB
# How to change network configuration?
There are five predefined configurations, you can find them in those files:
/etc/network/interfaces.default
/etc/network/interfaces.hostapd
/etc/network/interfaces.bonding
/etc/network/interfaces.r1
/etc/network/interfaces.r1switch
By default **/etc/network/interfaces** is symlinked to **/etc/network/interfaces.default**
1. DEFAULT: your network adapters are connected classical way.
2. HOSTAPD: your network adapters are bridged together and bridge is connected to the network. This allows you to have your AP connected directly to your router.
3. BONDING: your network adapters are bonded in fail safe / "notebook" way.
4. Router configuration for Lamobo R1 / Banana R1.
5. Switch configuration for Lamobo R1 / Banana R1.
You can switch configuration with re-linking.
cd /etc/network
ln -sf interfaces.x interfaces
(x = default,hostapd,bonding,r1)
Than check / alter your interfaces:
nano /etc/network/interfaces
# How to set fixed IP?
By default your main network adapter's IP is assigned by your router DHCP server.
iface eth0 inet dhcp
change to - for example:
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
# How to froze your filesystem?
In certain situations, it is desirable to have an virtual read-only root filesystem. This prevents any changes from occurring on the root filesystem that may alter system behavior, and it allows a simple reboot to restore a system to its clean state.
You need an A10, A20 or H3 board with legacy kernel (3.4.x) where we added support for overlayfs. We tested it on Ubuntu Xenial but it should work elsewhere too. Login as root and execute:
apt-get install overlayroot
echo 'overlayroot="tmpfs"' >> /etc/overlayroot.conf
reboot
After your system boots up it will always remain as is. If you want to make any permanent changes, you need to run:
overlayroot-chroot
Changes inside this will be preserved.
# How to run Docker?
Preinstallation requirements:
- Armian 5.1 or newer with Kernel 3.10 or higher
- Debian Jessie (might work elsewhere with some modifications)
- root access
Execute this as root:
echo "deb https://packagecloud.io/Hypriot/Schatzkiste/debian/ wheezy main" > /etc/apt/sources.list.d/hypriot.list
curl https://packagecloud.io/gpg.key | sudo apt-key add -
apt-get update
apt-get -y install --no-install-recommends docker-hypriot
apt-get -y install cgroupfs-mount
reboot
Test example:
docker run -d -p 80:80 hypriot/rpi-busybox-httpd
[More info in this forum topic](http://forum.armbian.com/index.php/topic/490-docker-on-armbian/)
# How to set wireless access point?
There are two different hostap daemons. One is **default** and the other one is for some **Realtek** wifi cards. Both have their own basic configurations and both are patched to gain maximum performances.
Sources: [https://github.com/igorpecovnik/hostapd](https://github.com/igorpecovnik/hostapd "https://github.com/igorpecovnik/hostapd")
Default binary and configuration location:
/usr/sbin/hostapd
/etc/hostapd.conf
Realtek binary and configuration location:
/usr/sbin/hostapd-rt
/etc/hostapd.conf-rt
Since its hard to define when to use which you always try both combinations in case of troubles. To start AP automatically:
1. Edit /etc/init.d/hostapd and add/alter location of your conf file **DAEMON_CONF=/etc/hostapd.conf** and binary **DAEMON_SBIN=/usr/sbin/hostapd**
2. Link **/etc/network/interfaces.hostapd** to **/etc/network/interfaces**
3. Reboot
4. Predefined network name: "BOARD NAME" password: 12345678
5. To change parameters, edit /etc/hostapd.conf BTW: You can get WPAPSK the long blob from wpa_passphrase YOURNAME YOURPASS
# How to connect IR remote?
Required conditions:
- IR hardware
- loaded driver
Get your [remote configuration](http://lirc.sourceforge.net/remotes/) (lircd.conf) or [learn](http://kodi.wiki/view/HOW-TO:Setup_Lirc#Learning_Commands). You are going to need the list of all possible commands which you can map to your IR remote keys:
irrecord --list-namespace
To start with learning process you need to delete old config:
rm /etc/lircd.conf
Than start the process with:
irrecord --driver=default --device=/dev/lirc0 /etc/lircd.conf
And finally start your service when done with learning:
service lirc start
Test your remote:
irw /dev/lircd
****

33
main.sh
View File

@@ -26,8 +26,7 @@ backtitle="Armbian building script, http://www.armbian.com | Author: Igor Pecovn
[[ -z $CONSOLE_CHAR ]] && export CONSOLE_CHAR="UTF-8"
# Load libraries
source $SRC/lib/debootstrap.sh # System specific install (old)
source $SRC/lib/debootstrap-ng.sh # System specific install (extended)
source $SRC/lib/debootstrap-ng.sh # System specific install
source $SRC/lib/distributions.sh # System specific install
source $SRC/lib/desktop.sh # Desktop specific install
source $SRC/lib/common.sh # Functions
@@ -243,41 +242,13 @@ fi
[[ $EXTERNAL_NEW == yes && $(lsb_release -sc) == xenial ]] && chroot_build_packages
if [[ $KERNEL_ONLY != yes ]]; then
if [[ $EXTENDED_DEBOOTSTRAP != no ]]; then
debootstrap_ng
else
# create or use prepared root file-system
custom_debootstrap
mount --bind $DEST/debs/ $CACHEDIR/sdcard/tmp
# install board specific applications
install_distribution_specific
install_common
# install external applications
[[ $EXTERNAL == yes ]] && install_external_applications
# install desktop
if [[ $BUILD_DESKTOP == yes ]]; then
install_desktop
fi
umount $CACHEDIR/sdcard/tmp > /dev/null 2>&1
# closing image
closing_image
fi
debootstrap_ng
else
display_alert "Kernel building done" "@host" "info"
display_alert "Target directory" "$DEST/debs/" "info"
display_alert "File name" "${CHOSEN_KERNEL}_${REVISION}_${ARCH}.deb" "info"
fi
# workaround for bug introduced with desktop build -- please remove when fixed
chmod 777 /tmp
end=`date +%s`
runtime=$(((end-start)/60))
display_alert "Runtime" "$runtime min" "info"

View File

@@ -1,8 +1,7 @@
#!/bin/bash
#
# fel-hooks.sh.example -- this file is an example how
# userpatches/fel-hooks.sh could be implemented. Basics first:
# https://github.com/igorpecovnik/lib/blob/master/documentation/fel-boot.md
# 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