Merge branch 'thingos' into dev

This commit is contained in:
Calin Crisan 2017-06-02 21:31:06 +03:00
commit 437ead0ca0
23 changed files with 232 additions and 42 deletions

View File

@ -23,6 +23,8 @@ function cleanup {
trap cleanup EXIT
PART_START=${PART_START:-2048} # 2048 sectors = 1MB
BOOT_SRC=$IMG_DIR/boot
BOOT=$IMG_DIR/.boot
BOOT_IMG=$IMG_DIR/boot.img
@ -109,18 +111,19 @@ loop_dev=$(losetup -f)
losetup -f $DISK_IMG
msg "partitioning disk"
root_part_start=$(($PART_START + $BOOT_SIZE * 2048))
set +e
fdisk -u=sectors $loop_dev <<END
o
n
p
1
${PART_START}
+${BOOT_SIZE}M
n
p
2
${root_part_start}
+${ROOT_SIZE}M
t

View File

@ -3,15 +3,17 @@
test -n "$os_version" || source /etc/init.d/base
msg_begin "Detecting disk device"
root_part=$(cat /proc/cmdline | grep -oE 'root=[/a-z0-9]+' | cut -d '=' -f 2)
if [[ "$root_part" =~ ^([/a-z0-9]+)(p[0-9])$ ]]; then # e.g. /dev/mmcblk0p2
root_dev=$(cat /proc/cmdline | grep -oE 'root=[/a-z0-9]+' | cut -d '=' -f 2)
if [[ "$root_dev" =~ ^([/a-z0-9]+)(p[0-9])$ ]]; then # e.g. /dev/mmcblk0p2
disk_dev=${BASH_REMATCH[1]}
boot_dev=${disk_dev}p1
data_dev=${disk_dev}p3
elif [[ "$root_part" =~ ^([/a-z0-9]+)([0-9])$ ]]; then # e.g. /dev/sdc2
elif [[ "$root_dev" =~ ^([/a-z0-9]+)([0-9])$ ]]; then # e.g. /dev/sdc2
disk_dev=${BASH_REMATCH[1]}
boot_dev=${disk_dev}1
data_dev=${disk_dev}3
else
msg_fail "unknown ($root_part)"
msg_fail "unknown ($root_dev)"
exit 1
fi
msg_done "$disk_dev"
@ -21,10 +23,12 @@ test -b $data_dev && exit 0
case "$1" in
start)
msg_begin "Creating data partition"
root_end=$(partx -s -g -o END $root_dev)
data_start=$(($root_end + 1))
echo -e "n
p
3
\n
${data_start}
\n
w" | /sbin/fdisk $disk_dev 2>&1 >/dev/null | grep -v "Device or resource busy" | grep -v '^$'
partx -a $disk_dev &>/dev/null

View File

@ -14,24 +14,25 @@ case "$1" in
echo 'admin::::::::' >> /data/etc/shadow
fi
# set root and admin passwords
password=""
if [ -x /etc/init.d/adminpw ]; then
password=$(/etc/init.d/adminpw)
fi
msg_begin "Setting root password"
# remove shadow backups
rm -f /data/etc/shadow+
rm -f /data/etc/shadow-
echo -en "$password\n$password\n" | passwd &>/dev/null # root
echo -en "$password\n$password\n" | passwd admin &>/dev/null # admin
sed -r -i 's/root:([^:]+):[[:digit:]]+:/root:\1::/' /data/etc/shadow # removes pwd expiration
sed -r -i 's/admin:([^:]+):[[:digit:]]+:/admin:\1::/' /data/etc/shadow # removes pwd expiration
if [ -x /etc/init.d/adminpw ]; then
# set root and admin passwords (admin is just an alias for root)
password=$(/etc/init.d/adminpw)
msg_begin "Setting root password"
echo -en "$password\n$password\n" | passwd &>/dev/null # root
echo -en "$password\n$password\n" | passwd admin &>/dev/null # admin
sed -r -i 's/root:([^:]+):[[:digit:]]+:/root:\1::/' /data/etc/shadow # removes pwd expiration
sed -r -i 's/admin:([^:]+):[[:digit:]]+:/admin:\1::/' /data/etc/shadow # removes pwd expiration
msg_done
fi
sync
msg_done
;;
stop)

View File

@ -28,6 +28,15 @@ ln -s /tmp $TARGET/var/run
ln -s /tmp $TARGET/var/spool
ln -s /tmp $TARGET/var/tmp
# cleanups
$COMMON_DIR/cleanups.sh
test -x $BOARD_DIR/cleanups.sh && test -x $BOARD_DIR/cleanups.sh || true
# board-specific os.conf
if [ -r $BOARD_DIR/os.conf ]; then
for line in $(cat $BOARD_DIR/os.conf); do
key=$(echo $line | cut -d '=' -f 1)
sed -i -r "s/$key=.*/$line/" /$TARGET/etc/os.conf
done
fi

2
board/odroidc1/os.conf Normal file
View File

@ -0,0 +1,2 @@
os_tty_login="ttyS0"

View File

@ -1,11 +0,0 @@
os_debug="false"
os_prereleases="false"
os_tty_login="ttyS0"
os_eth="eth0"
os_wlan="wlan0"
os_ppp="ppp0"
os_networkless="false"
os_firmware_method="github"
os_firmware_repo="ccrisan/motioneyeos"
os_firmware_username=""
os_firmware_password=""

2
board/odroidc2/os.conf Normal file
View File

@ -0,0 +1,2 @@
os_tty_login="ttyS0"

View File

@ -1,11 +0,0 @@
os_debug="false"
os_prereleases="false"
os_tty_login="ttyS0"
os_eth="eth0"
os_wlan="wlan0"
os_ppp="ppp0"
os_networkless="false"
os_firmware_method="github"
os_firmware_repo="ccrisan/motioneyeos"
os_firmware_username=""
os_firmware_password=""

BIN
board/pine64/boot0.bin Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
board/pine64/initrd.img Normal file

Binary file not shown.

16
board/pine64/mkimage.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash -e
BOARD_DIR=$(dirname $0)
COMMON_DIR=$BOARD_DIR/../common
export BOARD=$(basename $BOARD_DIR)
export IMG_DIR=$BOARD_DIR/../../output/$BOARD/images/
export UBOOT_BIN=$BOARD_DIR/u-boot-with-dtb.bin
export UBOOT_SEEK=38192
export PART_START=40960
BOOT0=$BOARD_DIR/boot0.bin
source $COMMON_DIR/mkimage.sh
dd conv=notrunc if=$BOOT0 of=$DISK_IMG bs=1k seek=8 count=32 oflag=direct

2
board/pine64/os.conf Normal file
View File

@ -0,0 +1,2 @@
os_tty_login="ttyS0"

View File

@ -0,0 +1,4 @@
#!/bin/sh
sed -i 's/initrd_filename=/#initrd_filename=/' /boot/uEnv.txt

View File

@ -0,0 +1 @@
pine64

View File

@ -0,0 +1,5 @@
#!/bin/bash
sn=$(cat /sys/class/net/eth0/address 2>/dev/null | tr -d ':')
echo ${sn: -8}

View File

@ -0,0 +1,5 @@
8723bs
8723cs
8723bs_vq0
hci_uart

View File

@ -0,0 +1,4 @@
#!/bin/bash
sed 's/#initrd_filename=.*/initrd_filename=initrd.img/' uEnv.txt

10
board/pine64/postscript.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# boot directory
mkdir -p $BOOT_DIR/pine64
cp $IMG_DIR/Image $BOOT_DIR/kernel.img
cp $BOARD_DIR/uEnv.txt $BOOT_DIR
cp $BOARD_DIR/dtb/* $BOOT_DIR/pine64
cp $BOARD_DIR/initrd.img $BOOT_DIR

Binary file not shown.

63
board/pine64/uEnv.txt Normal file
View File

@ -0,0 +1,63 @@
console=ttyS0,115200n8
selinux=permissive
enforcing=0
optargs=no_console_suspend panic=10 quiet loglevel=1 ipv6.disable=1
kernel_filename=kernel.img
#initrd_filename=ramdisk.img
#recovery_initrd_filename=ramdisk-recovery.img
hardware=sun50iw1p1
# INFO:
# To enable one of below options,
# uncomment them by removing # in front of name
# To use android recovery:
# Create empty file recovery.txt in root of this partition
# To enable LCD or HDMI, if not changed it will use default (experimental)
disp_screen0=hdmi
# disp_screen1=lcd or hdmi
# disp_mode=screen0 or screen1 or dualhead or xinerama or clone
# USB OTG port mode (experimental)
# otg_mode=device or host or otg
otg_mode=host
# Configure contiguous memory allocation
# This maybe required to be enlarged for 4K displays
cma=384M
# To change HDMI display mode:
# hdmi_mode=480i
# hdmi_mode=576i
# hdmi_mode=480p
# hdmi_mode=576p
# hdmi_mode=720p50
hdmi_mode=720p60
# hdmi_mode=1080i50
# hdmi_mode=1080i60
# hdmi_mode=1080p24
# hdmi_mode=1080p50
# hdmi_mode=1080p60
# hdmi_mode=2160p30
# hdmi_mode=2160p25
# hdmi_mode=2160p24
# To enable DVI compatibilty:
disp_dvi_compat=on
# To enable CSI camera, if not enabled it will use default:
# camera_type=s5k4ec
# camera_type=ov5640
# Configure ethernet speed
eth0_speed=auto
# eth0_speed=1000
# eth0_speed=100
# eth0_speed=10
# Disable HDMI CEC
hdmi_cec=0
# Enable experimental HDMI CEC driver
# hdmi_cec=2

81
configs/pine64_defconfig Normal file
View File

@ -0,0 +1,81 @@
BR2_aarch64=y
BR2_DL_DIR="$(TOPDIR)/.download"
BR2_CCACHE=y
BR2_CCACHE_DIR="$(TOPDIR)/.buildroot-ccache-pine64"
BR2_OPTIMIZE_2=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TARGET_OPTIMIZATION="-pipe"
BR2_ROOTFS_SKELETON_CUSTOM=y
BR2_ROOTFS_SKELETON_CUSTOM_PATH="board/common/skeleton"
BR2_ROOTFS_OVERLAY="board/common/overlay board/pine64/overlay"
BR2_ROOTFS_POST_BUILD_SCRIPT="board/common/postscript.sh"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="https://github.com/longsleep/linux-pine64/archive/a08f5219d240ae0edf93d090ff1fda0a82a6cb3a.tar.gz"
BR2_LINUX_KERNEL_DEFCONFIG="sun50iw1p1smp_linux"
BR2_PACKAGE_BUSYBOX_CONFIG="board/common/busybox.config"
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
BR2_PACKAGE_ALSA_UTILS=y
BR2_PACKAGE_ALSA_UTILS_APLAY=y
BR2_PACKAGE_GZIP=y
BR2_PACKAGE_JQ=y
BR2_PACKAGE_E2FSPROGS=y
# BR2_PACKAGE_E2FSPROGS_BADBLOCKS is not set
# BR2_PACKAGE_E2FSPROGS_CHATTR is not set
# BR2_PACKAGE_E2FSPROGS_DUMPE2FS is not set
# BR2_PACKAGE_E2FSPROGS_E2FREEFRAG is not set
# BR2_PACKAGE_E2FSPROGS_E2LABEL is not set
# BR2_PACKAGE_E2FSPROGS_E2UNDO is not set
# BR2_PACKAGE_E2FSPROGS_FILEFRAG is not set
# BR2_PACKAGE_E2FSPROGS_LOGSAVE is not set
# BR2_PACKAGE_E2FSPROGS_LSATTR is not set
# BR2_PACKAGE_E2FSPROGS_MKLOSTFOUND is not set
# BR2_PACKAGE_E2FSPROGS_TUNE2FS is not set
# BR2_PACKAGE_E2FSPROGS_UUIDGEN is not set
BR2_PACKAGE_NTFS_3G=y
BR2_PACKAGE_B43_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_7010=y
BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_9170=y
BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_9271=y
BR2_PACKAGE_LINUX_FIRMWARE_BRCM_BCM43XX=y
BR2_PACKAGE_LINUX_FIRMWARE_BRCM_BCM43XXX=y
BR2_PACKAGE_LINUX_FIRMWARE_MWIFIEX_USB8797=y
BR2_PACKAGE_LINUX_FIRMWARE_MWIFIEX_USB8897=y
BR2_PACKAGE_LINUX_FIRMWARE_MEDIATEK_MT7601U=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT61=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_81XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX=y
BR2_PACKAGE_USB_MODESWITCH_DATA=y
BR2_PACKAGE_CA_CERTIFICATES=y
BR2_PACKAGE_NETTLE=y
BR2_PACKAGE_LIBFUSE=y
BR2_PACKAGE_LIBCURL=y
BR2_PACKAGE_CURL=y
BR2_PACKAGE_LIBCAP=y
BR2_PACKAGE_PCRE=y
BR2_PACKAGE_AUTOSSH=y
BR2_PACKAGE_CRDA=y
BR2_PACKAGE_DHCP=y
BR2_PACKAGE_DHCP_CLIENT=y
BR2_PACKAGE_IPTABLES=y
BR2_PACKAGE_IW=y
BR2_PACKAGE_NETCAT=y
BR2_PACKAGE_NET_TOOLS=y
BR2_PACKAGE_NTP=y
BR2_PACKAGE_NTP_NTPDATE=y
BR2_PACKAGE_OPENSSH=y
BR2_PACKAGE_PPPD=y
BR2_PACKAGE_WIRELESS_TOOLS=y
BR2_PACKAGE_WPA_SUPPLICANT=y
BR2_PACKAGE_WPA_SUPPLICANT_EAP=y
BR2_PACKAGE_WPA_SUPPLICANT_CLI=y
BR2_PACKAGE_BASH=y
BR2_PACKAGE_LOGROTATE=y
BR2_PACKAGE_TAR=y
BR2_PACKAGE_UTIL_LINUX_BINARIES=y
BR2_PACKAGE_UTIL_LINUX_PARTX=y
BR2_PACKAGE_NANO=y