提交 18d64639 编写于 作者: O openharmony_ci 提交者: Gitee

!24 jffs2镜像打包工具改为用户自行安装

Merge pull request !24 from JING/master
......@@ -165,13 +165,13 @@ endif
$(ROOTFSDIR): prepare $(APPS)
$(HIDE)$(MAKE) clean -C apps
$(HIDE)$(shell $(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)
ifneq ($(VERSION),)
$(HIDE)$(shell $(LITEOSTOPDIR)/tools/scripts/make_rootfs/releaseinfo.sh "$(VERSION)" $(ROOTFS_DIR))
$(HIDE)$(LITEOSTOPDIR)/tools/scripts/make_rootfs/releaseinfo.sh "$(VERSION)" $(ROOTFS_DIR)
endif
$(ROOTFS): $(ROOTFSDIR)
$(HIDE)$(shell $(LITEOSTOPDIR)/tools/scripts/make_rootfs/rootfsimg.sh $(ROOTFS_DIR) $(FSTYPE))
$(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))
$(HIDE)mv $(ROOTFS_DIR) $(LITEOS_TARGET_DIR)rootfs
......
......@@ -34,26 +34,42 @@ system=$(uname -s)
ROOTFS_DIR=$1
FSTYPE=$2
ROOTFS_IMG=${ROOTFS_DIR}".img"
JFFS2_TOOL=$(dirname $(readlink -f "$0"))/../../fsimage/mkfs.jffs2
WIN_JFFS2_TOOL=$(dirname $(readlink -f "$0"))/../../fsimage/win-x86/mkfs.jffs2.exe
JFFS2_TOOL=mkfs.jffs2
WIN_JFFS2_TOOL=mkfs.jffs2.exe
VFAT_TOOL=mkfs.vfat
MCOPY_TOOL=mcopy
if [ "${ROOTFS_DIR}" = "*rootfs" ]; then
chmod -R 755 ${ROOTFS_DIR}
tool_check() {
local ret='0'
command -v "$1" >/dev/null 2>&1 || { local ret='1'; }
if [ "$ret" -ne 0 ]; then
echo "$1 tool is not exit, please install it" >&2
fi
return 0
}
chmod -R 755 ${ROOTFS_DIR}
if [ -f "${ROOTFS_DIR}/bin/init" ]; then
chmod 700 ${ROOTFS_DIR}/bin/init 2> /dev/null
fi
if [ -f "${ROOTFS_DIR}/bin/shell" ]; then
chmod 700 ${ROOTFS_DIR}/bin/shell 2> /dev/null
fi
if [ "${FSTYPE}" = "jffs2" ]; then
if [ "${system}" != "Linux" ] ; then
tool_check ${WIN_JFFS2_TOOL}
${WIN_JFFS2_TOOL} -q -o ${ROOTFS_IMG} -d ${ROOTFS_DIR} --pagesize=4096
else
chmod +x ${JFFS2_TOOL}
tool_check ${JFFS2_TOOL}
${JFFS2_TOOL} -q -o ${ROOTFS_IMG} -d ${ROOTFS_DIR} --pagesize=4096
fi
elif [ "${FSTYPE}" = "vfat" ]; then
if [ "${system}" != "Linux" ] ; then
echo "Unsupported fs type!"
echo "Unsupported fs type!" >&2
else
tool_check ${VFAT_TOOL}
tool_check ${MCOPY_TOOL}
BLK_SIZE=512
CLT_SIZE=2048
FAT_TAB_NUM=2
......@@ -73,9 +89,9 @@ elif [ "${FSTYPE}" = "vfat" ]; then
IMG_CNT=$(( (${IMG_SIZE} + ${BLK_SIZE} - 1) / ${BLK_SIZE} ))
echo mtools_skip_check=1 >> ~/.mtoolsrc
dd if=/dev/zero of=${ROOTFS_IMG} count=${IMG_CNT} bs=${BLK_SIZE}
mkfs.vfat ${ROOTFS_IMG} -s ${CLT_CNT} -f ${FAT_TAB_NUM} -S ${BLK_SIZE} > /dev/null
mcopy -i ${ROOTFS_IMG} ${ROOTFS_DIR}/* -/ ::/
${VFAT_TOOL} ${ROOTFS_IMG} -s ${CLT_CNT} -f ${FAT_TAB_NUM} -S ${BLK_SIZE} > /dev/null
${MCOPY_TOOL} -i ${ROOTFS_IMG} ${ROOTFS_DIR}/* -/ ::/
fi
else
echo "Unsupported fs type!"
echo "Unsupported fs type!" >&2
fi
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册