diff --git a/board/common/mkimage.sh b/board/common/mkimage.sh index 3b8723c13c..2b8a9def24 100755 --- a/board/common/mkimage.sh +++ b/board/common/mkimage.sh @@ -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 </dev/null diff --git a/board/common/overlay/etc/init.d/S21passwd b/board/common/overlay/etc/init.d/S21passwd index 03a1d7d6b6..542aaecc1d 100755 --- a/board/common/overlay/etc/init.d/S21passwd +++ b/board/common/overlay/etc/init.d/S21passwd @@ -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) diff --git a/board/common/postscript.sh b/board/common/postscript.sh index c4c4cf5b7e..ec3d4446ed 100755 --- a/board/common/postscript.sh +++ b/board/common/postscript.sh @@ -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 + diff --git a/board/odroidc1/os.conf b/board/odroidc1/os.conf new file mode 100644 index 0000000000..dc77b07e6d --- /dev/null +++ b/board/odroidc1/os.conf @@ -0,0 +1,2 @@ +os_tty_login="ttyS0" + diff --git a/board/odroidc1/overlay/etc/os.conf b/board/odroidc1/overlay/etc/os.conf deleted file mode 100644 index d3ce9dfd6c..0000000000 --- a/board/odroidc1/overlay/etc/os.conf +++ /dev/null @@ -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="" diff --git a/board/odroidc2/os.conf b/board/odroidc2/os.conf new file mode 100644 index 0000000000..dc77b07e6d --- /dev/null +++ b/board/odroidc2/os.conf @@ -0,0 +1,2 @@ +os_tty_login="ttyS0" + diff --git a/board/odroidc2/overlay/etc/os.conf b/board/odroidc2/overlay/etc/os.conf deleted file mode 100644 index d3ce9dfd6c..0000000000 --- a/board/odroidc2/overlay/etc/os.conf +++ /dev/null @@ -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="" diff --git a/board/pine64/boot0.bin b/board/pine64/boot0.bin new file mode 100644 index 0000000000..3ad8341f86 Binary files /dev/null and b/board/pine64/boot0.bin differ diff --git a/board/pine64/dtb/sun50i-a64-pine64-pinebook.dtb b/board/pine64/dtb/sun50i-a64-pine64-pinebook.dtb new file mode 100644 index 0000000000..2c76956406 Binary files /dev/null and b/board/pine64/dtb/sun50i-a64-pine64-pinebook.dtb differ diff --git a/board/pine64/dtb/sun50i-a64-pine64-plus.dtb b/board/pine64/dtb/sun50i-a64-pine64-plus.dtb new file mode 100644 index 0000000000..2f254085ad Binary files /dev/null and b/board/pine64/dtb/sun50i-a64-pine64-plus.dtb differ diff --git a/board/pine64/initrd.img b/board/pine64/initrd.img new file mode 100644 index 0000000000..e6a3c288cf Binary files /dev/null and b/board/pine64/initrd.img differ diff --git a/board/pine64/mkimage.sh b/board/pine64/mkimage.sh new file mode 100755 index 0000000000..69c5685d88 --- /dev/null +++ b/board/pine64/mkimage.sh @@ -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 + diff --git a/board/pine64/os.conf b/board/pine64/os.conf new file mode 100644 index 0000000000..dc77b07e6d --- /dev/null +++ b/board/pine64/os.conf @@ -0,0 +1,2 @@ +os_tty_login="ttyS0" + diff --git a/board/pine64/overlay-initramfs/remove_initramfs b/board/pine64/overlay-initramfs/remove_initramfs new file mode 100755 index 0000000000..d2b2798061 --- /dev/null +++ b/board/pine64/overlay-initramfs/remove_initramfs @@ -0,0 +1,4 @@ +#!/bin/sh + +sed -i 's/initrd_filename=/#initrd_filename=/' /boot/uEnv.txt + diff --git a/board/pine64/overlay/etc/board b/board/pine64/overlay/etc/board new file mode 100644 index 0000000000..bb4695af73 --- /dev/null +++ b/board/pine64/overlay/etc/board @@ -0,0 +1 @@ +pine64 diff --git a/board/pine64/overlay/etc/init.d/boardsn b/board/pine64/overlay/etc/init.d/boardsn new file mode 100755 index 0000000000..34ca56a576 --- /dev/null +++ b/board/pine64/overlay/etc/init.d/boardsn @@ -0,0 +1,5 @@ +#!/bin/bash + +sn=$(cat /sys/class/net/eth0/address 2>/dev/null | tr -d ':') +echo ${sn: -8} + diff --git a/board/pine64/overlay/etc/modules b/board/pine64/overlay/etc/modules new file mode 100644 index 0000000000..f4a495750d --- /dev/null +++ b/board/pine64/overlay/etc/modules @@ -0,0 +1,5 @@ +8723bs +8723cs +8723bs_vq0 +hci_uart + diff --git a/board/pine64/overlay/usr/libexec/fw-prepare-boot b/board/pine64/overlay/usr/libexec/fw-prepare-boot new file mode 100755 index 0000000000..0f8c0fad79 --- /dev/null +++ b/board/pine64/overlay/usr/libexec/fw-prepare-boot @@ -0,0 +1,4 @@ +#!/bin/bash + +sed 's/#initrd_filename=.*/initrd_filename=initrd.img/' uEnv.txt + diff --git a/board/pine64/postscript.sh b/board/pine64/postscript.sh new file mode 100755 index 0000000000..3b6e69ee97 --- /dev/null +++ b/board/pine64/postscript.sh @@ -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 + diff --git a/board/pine64/u-boot-with-dtb.bin b/board/pine64/u-boot-with-dtb.bin new file mode 100644 index 0000000000..d125f5100d Binary files /dev/null and b/board/pine64/u-boot-with-dtb.bin differ diff --git a/board/pine64/uEnv.txt b/board/pine64/uEnv.txt new file mode 100644 index 0000000000..6907671bd0 --- /dev/null +++ b/board/pine64/uEnv.txt @@ -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 diff --git a/configs/pine64_defconfig b/configs/pine64_defconfig new file mode 100644 index 0000000000..da837fa249 --- /dev/null +++ b/configs/pine64_defconfig @@ -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