From 4680eaae217292058d5fdc4fb502a09fc3d1800b Mon Sep 17 00:00:00 2001 From: Ding Tao Date: Tue, 4 Dec 2018 05:33:58 +0000 Subject: [PATCH 1/5] ch: swupdate: Add u-boot lib into lib directory This commit will compile u-boot tools, and move the lib.a into rootfs for swupdate use. Signed-off-by: Ding Tao --- Makefile | 20 +++++++++------- lib/ubootenv/Makefile | 14 +++++++++++ lib/ubootenv/install.sh | 52 +++++++++++++++++++++++++++++++++++++++++ scripts/gen_image.sh | 6 ++++- 4 files changed, 82 insertions(+), 10 deletions(-) create mode 100644 lib/ubootenv/Makefile create mode 100755 lib/ubootenv/install.sh diff --git a/Makefile b/Makefile index 7886ff1..aa2b446 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,7 @@ # Define sub directory name of build and download BUILD_DIR_NAME := build DL_DIR_NAME := dl +OUTPUT_DIR_NAME := output # Top directory, build directory and download directory export TOP_DIR := $(shell pwd) @@ -34,6 +35,10 @@ export DL_DIR := $(shell mkdir -p $(TOP_DIR)/$(DL_DIR_NAME) && \ cd $(TOP_DIR)/$(DL_DIR_NAME) && \ pwd) +export OUTPUT_DIR := $(shell mkdir -p $(BUILD_DIR)/$(OUTPUT_DIR_NAME) && \ + cd $(BUILD_DIR)/$(OUTPUT_DIR_NAME) && \ + pwd) + # Clean targets export CLEAN_TARGETS := $(BUILD_DIR) @@ -46,10 +51,7 @@ export DISTCLEAN_TARGETS := $(DOWNLOAD_DIR) ############################################################################## -all: button - -button: - @$(MAKE) -C package/hw_button +all: image .PHONY: help install image clean distclean @@ -62,15 +64,15 @@ help: @echo " clean - Clean build file, but leave download files" @echo " distclean - Clean all build process generated files" -install: - echo - IMAGE_DIR_NAME := image IMAGE_DIR := ${BUILD_DIR}/${IMAGE_DIR_NAME} -image: +image: ubootenv $(TOP_DIR)/scripts/gen_image.sh $(TOP_DIR) $(DL_DIR) $(BUILD_DIR) \ - $(IMAGE_DIR) + $(OUTPUT_DIR) $(IMAGE_DIR) + +ubootenv: + $(MAKE) -C lib/ubootenv clean: -rm -rf $(CLEAN_TARGETS) diff --git a/lib/ubootenv/Makefile b/lib/ubootenv/Makefile new file mode 100644 index 0000000..a00bdfe --- /dev/null +++ b/lib/ubootenv/Makefile @@ -0,0 +1,14 @@ +# Copyright (c) 2018 Hunan ChenHan Information Technology Co., Ltd. +# +# SPDX-License-Identifier: GPL-3.0 +# +# @author Ding Tao +# +# @date 3rd Dec, 2018 +# +# @brief This Makefile is use apt to install openssh + + +all: + ./install.sh $(BUILD_DIR) $(OUTPUT_DIR) + diff --git a/lib/ubootenv/install.sh b/lib/ubootenv/install.sh new file mode 100755 index 0000000..d24c8b9 --- /dev/null +++ b/lib/ubootenv/install.sh @@ -0,0 +1,52 @@ +#!/bin/sh + +# Copyright (c) 2018 Hunan ChenHan Information Technology Co., Ltd. +# +# SPDX-License-Identifier: GPL-3.0 +# +# @author Ding Tao +# +# @date 3rd Dec, 2018 +# +# @brief This shell script will install openssh via apt and modify some +# configurations like allow password login. + +BUILD_DIR=$1 +OUTPUT_DIR=$2 + +# Get the u-boot code +if [ -e ${BUILD_DIR}/u-boot ] +then + rm -rf ${BUILD_DIR}/u-boot +fi +git clone --depth=50 -b u-boot-2018.03-armada-18.09 \ + https://github.com/MarvellEmbeddedProcessors/u-boot-marvell \ + ${BUILD_DIR}/u-boot +if [ $? -ne 0 ] +then + echo "'git clone' exit none zero!" + exit 1 +fi + +export CROSS_COMPILE=aarch64-linux-gnu- +export ARCH=arm64 + +# Cd to source code and compile it +cd ${BUILD_DIR}/u-boot +make mvebu_espressobin-88f3720_defconfig +make env + +# Move shared library to rootfs +if [ ! -e ${BUILD_DIR}/u-boot/tools/env/lib.a ] +then + echo "'make' exit none zero!" + exit 1 +fi + +if [ ! -d ${OUTPUT_DIR}/usr/local/lib ] +then + mkdir -p ${OUTPUT_DIR}/usr/local/lib +fi +cp ${BUILD_DIR}/u-boot/tools/env/lib.a \ + ${OUTPUT_DIR}/usr/local/lib/libubootenv.a + diff --git a/scripts/gen_image.sh b/scripts/gen_image.sh index a040326..e556ce6 100755 --- a/scripts/gen_image.sh +++ b/scripts/gen_image.sh @@ -18,7 +18,8 @@ ISO_NAME=ubuntu-18.04.1-server-arm64.iso TOP_DIR=${1} DL_DIR=${2} BUILD_DIR=${3} -IMAGE_DIR=${4} +OUTPUT_DIR=${4} +IMAGE_DIR=${5} ISO_URL=${DOWNLOAD_URL}/${RELEASE_VERSION}/release/${ISO_NAME} @@ -63,6 +64,9 @@ build_alter() { } build_append() { + # Append output/* files + cp -R ${OUTPUT_DIR}/* ${BUILD_DIR}/rootfs + # Append etc files cp -R ${TOP_DIR}/etc/* ${BUILD_DIR}/rootfs/etc } From d9fab0a014ac4466427d8ebae295ac7e112630e7 Mon Sep 17 00:00:00 2001 From: Ding Tao Date: Tue, 4 Dec 2018 05:35:49 +0000 Subject: [PATCH 2/5] ch: ci: Add gcc for host machine This use to compile the u-boot. Signed-off-by: Ding Tao --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e76bfac..aa7f269 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,10 @@ addons: apt: packages: - make + - binutils-aarch64-linux-gnu + - gcc-aarch64-linux-gnu - qemu-user-static script: - - sudo make image + - sudo make From 831b82bcd95ab9bd872f8aabf08113fbc05450ee Mon Sep 17 00:00:00 2001 From: Ding Tao Date: Tue, 4 Dec 2018 05:46:35 +0000 Subject: [PATCH 3/5] ch: ci: Upgrade gcc 5 to gcc 6 U-boot require gcc-6 to compile it, let's upgrade it to gcc-6. Signed-off-by: Ding Tao --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index aa7f269..8c8d90d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ addons: packages: - make - binutils-aarch64-linux-gnu - - gcc-aarch64-linux-gnu + - gcc-6-aarch64-linux-gnu - qemu-user-static script: From 394ab439e1e1b36077faf4222d361137b80daa7f Mon Sep 17 00:00:00 2001 From: Ding Tao Date: Tue, 4 Dec 2018 06:11:36 +0000 Subject: [PATCH 4/5] ch: ci: Fix no package while running ci E: Package 'gcc-6-aarch64-linux-gnu' has no installation candidate. Signed-off-by: Ding Tao --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 8c8d90d..bc7ee7b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,8 @@ language: c addons: apt: + sources: + - sourceline: 'ppa:ubuntu-toolchain-r/test' packages: - make - binutils-aarch64-linux-gnu From 0516bfc0814181e0f8d45e5ec79fe9e89c1ee9b6 Mon Sep 17 00:00:00 2001 From: Ding Tao Date: Tue, 4 Dec 2018 06:53:27 +0000 Subject: [PATCH 5/5] ch: ci: Change ppa using gcc-arm-emvedded toolchain Replace ppa:ubuntu-toolchain-r/test with ppa:team-gcc-arm-embedded/ppa. Signed-off-by: Ding Tao --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index bc7ee7b..53770ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,11 +7,10 @@ language: c addons: apt: sources: - - sourceline: 'ppa:ubuntu-toolchain-r/test' + - sourceline: 'ppa:team-gcc-arm-embedded/ppa' packages: - make - - binutils-aarch64-linux-gnu - - gcc-6-aarch64-linux-gnu + - gcc-arm-embedded - qemu-user-static script: