From 157dfa4532a755fa136409f4d882bac64bfcf26a Mon Sep 17 00:00:00 2001 From: pilipala195 Date: Thu, 25 Mar 2021 11:11:15 +0800 Subject: [PATCH 1/2] Refactoring the packaging process, copy bin and lib to out path --- Makefile | 8 ++------ tools/scripts/make_rootfs/releaseinfo.sh | 7 ++++++- tools/scripts/make_rootfs/rootfsdir.sh | 8 ++++++++ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 27dda5e6..b7569152 100755 --- a/Makefile +++ b/Makefile @@ -182,18 +182,14 @@ endif $(ROOTFSDIR): prepare $(APPS) $(HIDE)$(MAKE) clean -C apps - $(HIDE)$(LITEOSTOPDIR)/tools/scripts/make_rootfs/rootfsdir.sh $(OUT)/bin $(OUT)/musl $(ROOTFS_DIR) + $(HIDE)$(LITEOSTOPDIR)/tools/scripts/make_rootfs/rootfsdir.sh $(OUT)/bin $(OUT)/musl $(ROOTFS_DIR) $(LITEOS_TARGET_DIR) ifneq ($(VERSION),) - $(HIDE)$(LITEOSTOPDIR)/tools/scripts/make_rootfs/releaseinfo.sh "$(VERSION)" $(ROOTFS_DIR) + $(HIDE)$(LITEOSTOPDIR)/tools/scripts/make_rootfs/releaseinfo.sh "$(VERSION)" $(ROOTFS_DIR) $(LITEOS_TARGET_DIR) endif $(ROOTFS): $(ROOTFSDIR) $(HIDE)$(LITEOSTOPDIR)/tools/scripts/make_rootfs/rootfsimg.sh $(ROOTFS_DIR) $(FSTYPE) $(HIDE)cd $(ROOTFS_DIR)/.. && zip -r $(ROOTFS_ZIP) $(ROOTFS) -ifneq ($(OUT), $(LITEOS_TARGET_DIR)) - rm -rf $(LITEOS_TARGET_DIR)rootfs - $(HIDE)mv $(ROOTFS_DIR) $(LITEOS_TARGET_DIR)rootfs -endif clean: $(HIDE)for dir in $(LITEOS_SUBDIRS); \ diff --git a/tools/scripts/make_rootfs/releaseinfo.sh b/tools/scripts/make_rootfs/releaseinfo.sh index 65c0cdd8..f15bb75d 100755 --- a/tools/scripts/make_rootfs/releaseinfo.sh +++ b/tools/scripts/make_rootfs/releaseinfo.sh @@ -30,13 +30,18 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. set -e -if [ $# -ne 2 ];then +if [ $# -ne 3 ];then exit 1 fi VERSION=$1 ROOTFS_DIR=$2 +OUT_DIR=$3 RELEASE_TIME=$(date "+%Y-%m-%d %H:%M:%S") echo VERSION=\"${VERSION}\" > ${ROOTFS_DIR}/etc/os-release echo RELEASE_TIME=\"${RELEASE_TIME}\" >> ${ROOTFS_DIR}/etc/os-release +if [ ! -d ${OUT_DIR}etc ]; then + mkdir -p ${OUT_DIR}etc +fi +cp ${ROOTFS_DIR}/etc/os-release ${OUT_DIR}etc diff --git a/tools/scripts/make_rootfs/rootfsdir.sh b/tools/scripts/make_rootfs/rootfsdir.sh index ff7266cb..89c7d6cf 100755 --- a/tools/scripts/make_rootfs/rootfsdir.sh +++ b/tools/scripts/make_rootfs/rootfsdir.sh @@ -33,10 +33,18 @@ set -e BIN_DIR=$1 LIB_DIR=$2 ROOTFS_DIR=$3 +OUT_DIR=$4 mkdir -p ${ROOTFS_DIR}/bin ${ROOTFS_DIR}/lib ${ROOTFS_DIR}/usr/bin ${ROOTFS_DIR}/usr/lib ${ROOTFS_DIR}/etc \ ${ROOTFS_DIR}/app ${ROOTFS_DIR}/data ${ROOTFS_DIR}/proc ${ROOTFS_DIR}/dev ${ROOTFS_DIR}/data/system ${ROOTFS_DIR}/data/system/param \ ${ROOTFS_DIR}/system ${ROOTFS_DIR}/system/internal ${ROOTFS_DIR}/system/external if [ -d "${BIN_DIR}" ] && [ "$(ls -A "${BIN_DIR}")" != "" ]; then cp -f ${BIN_DIR}/* ${ROOTFS_DIR}/bin + if [ -e ${OUT_DIR}/bin/shell ]; then + cp -f ${BIN_DIR}/shell ${OUT_DIR}/bin/shell + fi + if [ -e ${OUT_DIR}/bin/tftp ]; then + cp -f ${BIN_DIR}/tftp ${OUT_DIR}/bin/tftp + fi fi cp -f ${LIB_DIR}/* ${ROOTFS_DIR}/lib +cp -f ${LIB_DIR}/* ${OUT_DIR}/libs From c5643b6216c1b5b9c92419015688d442f627cef3 Mon Sep 17 00:00:00 2001 From: gzyang Date: Sat, 27 Mar 2021 14:05:56 +0800 Subject: [PATCH 2/2] wrong path fixed --- tools/scripts/make_rootfs/rootfsdir.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/scripts/make_rootfs/rootfsdir.sh b/tools/scripts/make_rootfs/rootfsdir.sh index 89c7d6cf..db6b1ff4 100755 --- a/tools/scripts/make_rootfs/rootfsdir.sh +++ b/tools/scripts/make_rootfs/rootfsdir.sh @@ -39,10 +39,10 @@ ${ROOTFS_DIR}/app ${ROOTFS_DIR}/data ${ROOTFS_DIR}/proc ${ROOTFS_DIR}/dev ${ROOT ${ROOTFS_DIR}/system ${ROOTFS_DIR}/system/internal ${ROOTFS_DIR}/system/external if [ -d "${BIN_DIR}" ] && [ "$(ls -A "${BIN_DIR}")" != "" ]; then cp -f ${BIN_DIR}/* ${ROOTFS_DIR}/bin - if [ -e ${OUT_DIR}/bin/shell ]; then + if [ -e ${BIN_DIR}/shell ]; then cp -f ${BIN_DIR}/shell ${OUT_DIR}/bin/shell fi - if [ -e ${OUT_DIR}/bin/tftp ]; then + if [ -e ${BIN_DIR}/tftp ]; then cp -f ${BIN_DIR}/tftp ${OUT_DIR}/bin/tftp fi fi