1# 2# Copyright (c) 2022 FuZhou Lockzhiner Electronic Co., Ltd. All rights reserved. 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14# 15 16# error out on errors 17set -e 18 19ELF_FILE="$1" 20OUT_DIR="$2" 21 22SDK_DIR=$(pwd)/../ 23TOOLS_DIR=${SDK_DIR}/../tools/package 24 25PART_SYSTEM_BLOCKS=$(cat ../liteos_m/link.h | grep "#define PART_SYSTEM_BLOCKS" | awk -F' ' '{print $3}') 26PART_LOADER_BLOCKS=$(cat ../liteos_m/link.h | grep "#define PART_LOADER_BLOCKS" | awk -F' ' '{print $3}') 27PART_LITEOS_BLOCKS=$(cat ../liteos_m/link.h | grep "#define PART_LITEOS_BLOCKS" | awk -F' ' '{print $3}') 28PART_ROOTFS_BLOCKS=$(cat ../liteos_m/link.h | grep "#define PART_ROOTFS_BLOCKS" | awk -F' ' '{print $3}') 29PART_USERFS_BLOCKS=$(cat ../liteos_m/link.h | grep "#define PART_USERFS_BLOCKS" | awk -F' ' '{print $3}') 30 31#LDSCRIPT=board.ld 32#CFLAGS="SDK_DIR=${SDK_DIR} LDSCRIPT=${LDSCRIPT}" 33 34function main() 35{ 36 # make ld script 37 # make ${CFLAGS} -f build/link.mk 38 # make liteos 39 make ELFFILE=${ELF_FILE} OUTDIR=${OUT_DIR} all 40 # make images 41 ${TOOLS_DIR}/mkimage.sh ${PART_SYSTEM_BLOCKS} ${PART_LOADER_BLOCKS} ${PART_LITEOS_BLOCKS} ${PART_ROOTFS_BLOCKS} ${PART_USERFS_BLOCKS} 42} 43 44main "$@"