Merge branch 'chip/next' into chip/stable

This commit is contained in:
Alex Kaplan 2016-01-11 15:26:53 -08:00
commit 0a816dca92
2 changed files with 40 additions and 16 deletions

View File

@ -6,7 +6,7 @@ source $SCRIPTDIR/common.sh
############################################################## ##############################################################
# main # main
############################################################## ##############################################################
while getopts "flu:" opt; do while getopts "flpu:" opt; do
case $opt in case $opt in
f) f)
echo "fastboot enabled" echo "fastboot enabled"
@ -19,6 +19,9 @@ while getopts "flu:" opt; do
u) u)
BUILDROOT_OUTPUT_DIR="${OPTARG}" BUILDROOT_OUTPUT_DIR="${OPTARG}"
;; ;;
p)
POCKET_CHIP=true
;;
\?) \?)
echo "Invalid option: -$OPTARG" >&2 echo "Invalid option: -$OPTARG" >&2
exit 1 exit 1
@ -50,7 +53,7 @@ SPL="$BUILDROOT_OUTPUT_DIR/images/sunxi-spl.bin"
SPL_MEM_ADDR=0x43000000 SPL_MEM_ADDR=0x43000000
UBOOT="$BUILDROOT_OUTPUT_DIR/images/u-boot-dtb.bin" UBOOT="$BUILDROOT_OUTPUT_DIR/images/u-boot-dtb.bin"
PADDED_UBOOT="$TMPDIR/padded-uboot" PADDED_UBOOT="$TMPDIR/padded-uboot"
PADDED_UBOOT_SIZE=0xc0000 PADDED_UBOOT_SIZE=0x400000
UBOOT_MEM_ADDR=0x4a000000 UBOOT_MEM_ADDR=0x4a000000
UBI="$BUILDROOT_OUTPUT_DIR/images/rootfs.ubi" UBI="$BUILDROOT_OUTPUT_DIR/images/rootfs.ubi"
SPARSE_UBI="${TMPDIR}/rootfs.ubi.sparse" SPARSE_UBI="${TMPDIR}/rootfs.ubi.sparse"
@ -73,7 +76,7 @@ prepare_images() {
echo "PADDED_SPL_SIZE=$PADDED_SPL_SIZE" echo "PADDED_SPL_SIZE=$PADDED_SPL_SIZE"
# Align the u-boot image on a page boundary # Align the u-boot image on a page boundary
dd if="$UBOOT" of="$PADDED_UBOOT" bs=16k conv=sync dd if="$UBOOT" of="$PADDED_UBOOT" bs=4M conv=sync
UBOOT_SIZE=`filesize "$PADDED_UBOOT" | xargs printf "0x%08x"` UBOOT_SIZE=`filesize "$PADDED_UBOOT" | xargs printf "0x%08x"`
echo "UBOOT_SIZE=${UBOOT_SIZE}" echo "UBOOT_SIZE=${UBOOT_SIZE}"
echo "PADDED_UBOOT_SIZE=${PADDED_UBOOT_SIZE}" echo "PADDED_UBOOT_SIZE=${PADDED_UBOOT_SIZE}"
@ -94,7 +97,7 @@ prepare_uboot_script() {
echo "nand write $UBOOT_MEM_ADDR 0x800000 $PADDED_UBOOT_SIZE" >> "${UBOOT_SCRIPT_SRC}" echo "nand write $UBOOT_MEM_ADDR 0x800000 $PADDED_UBOOT_SIZE" >> "${UBOOT_SCRIPT_SRC}"
echo "setenv bootargs root=ubi0:rootfs rootfstype=ubifs rw earlyprintk ubi.mtd=4" >> "${UBOOT_SCRIPT_SRC}" echo "setenv bootargs root=ubi0:rootfs rootfstype=ubifs rw earlyprintk ubi.mtd=4" >> "${UBOOT_SCRIPT_SRC}"
echo "setenv bootcmd 'if test -n \${fel_booted} && test -n \${scriptaddr}; then echo '(FEL boot)'; source \${scriptaddr}; fi; mtdparts; ubi part UBI; ubifsmount ubi0:rootfs; ubifsload \$fdt_addr_r /boot/sun5i-r8-chip.dtb; ubifsload \$kernel_addr_r /boot/zImage; bootz \$kernel_addr_r - \$fdt_addr_r'" >> "${UBOOT_SCRIPT_SRC}" echo "setenv bootcmd 'gpio set PB2; if test -n \${fel_booted} && test -n \${scriptaddr}; then echo '(FEL boot)'; source \${scriptaddr}; fi; mtdparts; ubi part UBI; ubifsmount ubi0:rootfs; ubifsload \$fdt_addr_r /boot/sun5i-r8-chip.dtb; ubifsload \$kernel_addr_r /boot/zImage; bootz \$kernel_addr_r - \$fdt_addr_r'" >> "${UBOOT_SCRIPT_SRC}"
echo "setenv fel_booted 0" >> "${UBOOT_SCRIPT_SRC}" echo "setenv fel_booted 0" >> "${UBOOT_SCRIPT_SRC}"
echo "echo Enabling Splash" >> "${UBOOT_SCRIPT_SRC}" echo "echo Enabling Splash" >> "${UBOOT_SCRIPT_SRC}"
@ -103,7 +106,11 @@ prepare_uboot_script() {
echo "setenv splashpos m,m" >> "${UBOOT_SCRIPT_SRC}" echo "setenv splashpos m,m" >> "${UBOOT_SCRIPT_SRC}"
echo "echo Configuring Video Mode" echo "echo Configuring Video Mode"
echo "setenv video-mode sunxi:640x480-24@60,monitor=composite-ntsc,overscan_x=40,overscan_y=20" >> "${UBOOT_SCRIPT_SRC}" if [[ "${POCKET_CHIP}" == "true" ]]; then
echo "setenv video-mode" >> "${UBOOT_SCRIPT_SRC}"
else
echo "setenv video-mode sunxi:640x480-24@60,monitor=composite-ntsc,overscan_x=40,overscan_y=20" >> "${UBOOT_SCRIPT_SRC}"
fi
echo "saveenv" >> "${UBOOT_SCRIPT_SRC}" echo "saveenv" >> "${UBOOT_SCRIPT_SRC}"

View File

@ -54,7 +54,7 @@ function cache_download {
} }
while getopts "ufdb:w:B:" opt; do while getopts "ufdpb:w:B:" opt; do
case $opt in case $opt in
u) u)
echo "updating cache" echo "updating cache"
@ -82,6 +82,12 @@ while getopts "ufdb:w:B:" opt; do
echo "debian selected" echo "debian selected"
WHAT="debian" WHAT="debian"
;; ;;
p)
echo "PocketC.H.I.P selected"
WHAT="pocketchip"
BUILD=123
FLASH_SCRIPT=./chip-fel-flash.sh -p
;;
\?) \?)
echo "Invalid option: -$OPTARG" >&2 echo "Invalid option: -$OPTARG" >&2
exit 1 exit 1
@ -95,6 +101,8 @@ FW_IMAGE_DIR="${FW_DIR}/images"
BASE_URL="http://opensource.nextthing.co/chip" BASE_URL="http://opensource.nextthing.co/chip"
S3_URL="${BASE_URL}/${WHAT}/${BRANCH}/latest" S3_URL="${BASE_URL}/${WHAT}/${BRANCH}/latest"
if [[ -z "$BUILD" ]]; then if [[ -z "$BUILD" ]]; then
ROOTFS_URL="$(wget -q -O- ${S3_URL})" || (echo "ERROR: cannot reach ${S3_URL}" && exit 1) ROOTFS_URL="$(wget -q -O- ${S3_URL})" || (echo "ERROR: cannot reach ${S3_URL}" && exit 1)
if [[ -z "${ROOTFS_URL}" ]]; then if [[ -z "${ROOTFS_URL}" ]]; then
@ -105,16 +113,25 @@ else
ROOTFS_URL="${S3_URL%latest}$BUILD" ROOTFS_URL="${S3_URL%latest}$BUILD"
fi fi
if [[ "${WHAT}" == "buildroot" ]]; then case "${WHAT}" in
BR_BUILD="$(wget -q -O- ${ROOTFS_URL}/build)" "buildroot")
BUILD=${BR_BUILD} BR_BUILD="$(wget -q -O- ${ROOTFS_URL}/build)"
ROOTFS_URL="${ROOTFS_URL}/images" BUILD=${BR_BUILD}
BR_URL="${ROOTFS_URL}" ROOTFS_URL="${ROOTFS_URL}/images"
else BR_URL="${ROOTFS_URL}"
BR_BUILD="$(wget -q -O- ${ROOTFS_URL}/br_build)" ;;
BR_URL="${BASE_URL}/buildroot/${BRANCH%-gui}/${BR_BUILD}/images" "debian")
BUILD="$(wget -q -O- ${ROOTFS_URL}/build)" BR_BUILD="$(wget -q -O- ${ROOTFS_URL}/br_build)"
fi BR_URL="${BASE_URL}/buildroot/${BRANCH%-gui}/${BR_BUILD}/images"
BUILD="$(wget -q -O- ${ROOTFS_URL}/build)"
;;
"pocketchip")
BR_BUILD=123
BUILD=123
ROOTFS_URL="http://opensource.nextthing.co/pocketchip"
BR_URL="$ROOTFS_URL"
;;
esac
echo "ROOTFS_URL=${ROOTFS_URL}" echo "ROOTFS_URL=${ROOTFS_URL}"
echo "BUILD=${BUILD}" echo "BUILD=${BUILD}"