[Zrouter-src] ZRouter.org: push to ZRouter share/mk/converters/bz2.mk share/mk...
zrouter-src at zrouter.org
zrouter-src at zrouter.org
Thu Dec 8 22:53:34 UTC 2011
details: http://zrouter.org/hg/zrouter//rev/993d7428dc36
changeset: 251:993d7428dc36
user: ray at terran.dlink.ua
date: Fri Dec 09 00:41:40 2011 +0200
description:
Define a packing magic :)
diffstat:
share/mk/converters/bz2.mk | 10 ++++++++
share/mk/converters/ffs.mk | 12 +++++++++
share/mk/converters/gz.mk | 10 ++++++++
share/mk/converters/iso.mk | 11 +++++++++
share/mk/converters/kbin.mk | 10 ++++++++
share/mk/converters/oldlzma.mk | 10 ++++++++
share/mk/converters/sync.mk | 24 +++++++++++++++++++
share/mk/converters/tar.mk | 13 ++++++++++
share/mk/converters/uboot.mk | 51 ++++++++++++++++++++++++++++++++++++++++++
share/mk/converters/ulzma.mk | 10 ++++++++
share/mk/converters/uzip.mk | 10 ++++++++
share/mk/converters/xz.mk | 10 ++++++++
share/mk/zrouter.packing.mk | 33 +++++++++++++++++++++++++++
13 files changed, 214 insertions(+), 0 deletions(-)
diffs (269 lines):
diff -r fed307809604 -r 993d7428dc36 share/mk/converters/bz2.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/mk/converters/bz2.mk Fri Dec 09 00:41:40 2011 +0200
@@ -0,0 +1,10 @@
+CONVERT_FROM_BZ2:=${NEW_CURRENT_PACKING_FILE_NAME}
+CONVERT_TO_BZ2:=${CURRENT_PACKING_FILE_NAME}
+
+# Let user to override
+CONVERTER_BZ2?=bzip2
+CONVERTER_BZ2_FLAGS?=--stdout
+
+${CONVERT_TO_BZ2}: ${CONVERT_FROM_BZ2}
+ @echo ========== Convert ${CONVERT_FROM_BZ2} to ${CONVERT_TO_BZ2} with ${CONVERTER_BZ2} ============
+ ${CONVERTER_BZ2} ${CONVERTER_BZ2_FLAGS} ${CONVERT_FROM_BZ2} > ${CONVERT_TO_BZ2}
diff -r fed307809604 -r 993d7428dc36 share/mk/converters/ffs.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/mk/converters/ffs.mk Fri Dec 09 00:41:40 2011 +0200
@@ -0,0 +1,12 @@
+CONVERT_FROM_FFS:=${NEW_CURRENT_PACKING_FILE_NAME}
+CONVERT_TO_FFS:=${CURRENT_PACKING_FILE_NAME}
+
+# Let user to override
+CONVERTER_FFS?=makefs
+CONVERTER_FFS_FLAGS?=-t ffs -d 255 -F ${ZROUTER_ROOT}/tools/rootfs.mtree -s \
+ ${ROOTFS_MEDIA_SIZE} -o minfree=0,version=1 ${ROOTFS_ENDIAN_FLAGS}
+
+${CONVERT_TO_FFS}: ${CONVERT_FROM_FFS}
+ @echo -n "========== Convert ${CONVERT_FROM_FFS} to ${CONVERT_TO_FFS}"
+ @echo " with ${CONVERTER_FFS} ============"
+ PATH=${IMAGE_BUILD_PATHS} ${CONVERTER_FFS} ${CONVERTER_FFS_FLAGS} "${CONVERT_TO_FFS}" "${CONVERT_FROM_FFS}"
\ No newline at end of file
diff -r fed307809604 -r 993d7428dc36 share/mk/converters/gz.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/mk/converters/gz.mk Fri Dec 09 00:41:40 2011 +0200
@@ -0,0 +1,10 @@
+CONVERT_FROM_GZ:=${NEW_CURRENT_PACKING_FILE_NAME}
+CONVERT_TO_GZ:=${CURRENT_PACKING_FILE_NAME}
+
+# Let user to override
+CONVERTER_GZ?=gzip
+CONVERTER_GZ_FLAGS?=--stdout
+
+${CONVERT_TO_GZ}: ${CONVERT_FROM_GZ}
+ @echo ========== Convert ${CONVERT_FROM_GZ} to ${CONVERT_TO_GZ} with ${CONVERTER_GZ} ============
+ ${CONVERTER_GZ} ${CONVERTER_GZ_FLAGS} ${CONVERT_FROM_GZ} > ${CONVERT_TO_GZ}
diff -r fed307809604 -r 993d7428dc36 share/mk/converters/iso.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/mk/converters/iso.mk Fri Dec 09 00:41:40 2011 +0200
@@ -0,0 +1,11 @@
+CONVERT_FROM_ISO:=${NEW_CURRENT_PACKING_FILE_NAME}
+CONVERT_TO_ISO:=${CURRENT_PACKING_FILE_NAME}
+
+# Let user to override
+CONVERTER_ISO?=makefs
+CONVERTER_ISO_FLAGS?=-d 255 -t cd9660 -F ${ZROUTER_ROOT}/tools/rootfs.mtree -o "rockridge"
+
+${CONVERT_TO_ISO}: ${CONVERT_FROM_ISO}
+ @echo -n "========== Convert ${CONVERT_FROM_ISO} to ${CONVERT_TO_ISO}"
+ @echo " with ${CONVERTER_ISO} ============"
+ PATH=${IMAGE_BUILD_PATHS} ${CONVERTER_ISO} ${CONVERTER_ISO_FLAGS} "${CONVERT_TO_ISO}" "${CONVERT_FROM_ISO}"
\ No newline at end of file
diff -r fed307809604 -r 993d7428dc36 share/mk/converters/kbin.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/mk/converters/kbin.mk Fri Dec 09 00:41:40 2011 +0200
@@ -0,0 +1,10 @@
+CONVERT_FROM_KBIN:=${NEW_CURRENT_PACKING_FILE_NAME}
+CONVERT_TO_KBIN:=${CURRENT_PACKING_FILE_NAME}
+
+# Let user to override
+CONVERTER_KBIN?=objcopy
+CONVERTER_KBIN_FLAGS?=-O binary
+
+${CONVERT_TO_KBIN}: ${CONVERT_FROM_KBIN}
+ @echo ========== Convert ${CONVERT_FROM_KBIN} to ${CONVERT_TO_KBIN} with ${CONVERTER_KBIN} ============
+ PATH=${IMAGE_BUILD_PATHS} ${CONVERTER_KBIN} ${CONVERTER_KBIN_FLAGS} ${CONVERT_FROM_KBIN} ${CONVERT_TO_KBIN}
diff -r fed307809604 -r 993d7428dc36 share/mk/converters/oldlzma.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/mk/converters/oldlzma.mk Fri Dec 09 00:41:40 2011 +0200
@@ -0,0 +1,10 @@
+CONVERT_FROM_OLDLZMA:=${NEW_CURRENT_PACKING_FILE_NAME}
+CONVERT_TO_OLDLZMA:=${CURRENT_PACKING_FILE_NAME}
+
+# Let user to override
+CONVERTER_OLDLZMA?=oldlzma
+CONVERTER_OLDLZMA_FLAGS?=e
+
+${CONVERT_TO_OLDLZMA}: ${CONVERT_FROM_OLDLZMA} ${ZTOOLS_PATH}/oldlzma
+ @echo ========== Convert ${CONVERT_FROM_OLDLZMA} to ${CONVERT_TO_OLDLZMA} with ${CONVERTER_OLDLZMA} ============
+ PATH=${IMAGE_BUILD_PATHS} ${CONVERTER_OLDLZMA} ${CONVERTER_OLDLZMA_FLAGS} ${CONVERT_FROM_OLDLZMA} ${CONVERT_TO_OLDLZMA}
diff -r fed307809604 -r 993d7428dc36 share/mk/converters/sync.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/mk/converters/sync.mk Fri Dec 09 00:41:40 2011 +0200
@@ -0,0 +1,24 @@
+CONVERT_FROM_SYNC:=${NEW_CURRENT_PACKING_FILE_NAME}
+CONVERT_TO_SYNC:=${CURRENT_PACKING_FILE_NAME}
+
+PACKING_KERNEL_ROUND?=${FLASH_BLOCK_SIZE}
+.if !defined(PACKING_KERNEL_ROUND) || empty(PACKING_KERNEL_ROUND)
+PACKING_KERNEL_ROUND=0x10000
+.endif
+IMAGE_HEADER_EXTRA?=0
+
+
+${CONVERT_TO_SYNC}: ${CONVERT_FROM_SYNC}
+ @echo ========== Round up by ${PACKING_KERNEL_ROUND} ${CONVERT_FROM_SYNC} ============
+ echo "PACKING_KERNEL_ROUND=\"${PACKING_KERNEL_ROUND}\" FLASH_BLOCK_SIZE=\"${FLASH_BLOCK_SIZE}\"" ; \
+ BS_MASK=$$(( ${PACKING_KERNEL_ROUND} - 1 )) ; \
+ echo BS_MASK=$${BS_MASK} ; \
+ BS_MASK_INV=$$(( ~BS_MASK )) ; \
+ echo BS_MASK_INV=$${BS_MASK_INV} ; \
+ CONVERT_SYNC_OLD_SIZE=`stat -f %z "${CONVERT_FROM_SYNC}"` ; \
+ _NEW_SIZE_W_HDR=$$(( CONVERT_SYNC_OLD_SIZE + ${IMAGE_HEADER_EXTRA} )) ; \
+ echo _NEW_SIZE_W_HDR=$${_NEW_SIZE_W_HDR} ; \
+ CONVERT_SYNC_NEW_SIZE=$$(( ((_NEW_SIZE_W_HDR + BS_MASK ) & BS_MASK_INV) - ${IMAGE_HEADER_EXTRA} )); \
+ cp "${CONVERT_FROM_SYNC}" "${CONVERT_TO_SYNC}" ; \
+ echo "Old size $${CONVERT_SYNC_OLD_SIZE} New size $${CONVERT_SYNC_NEW_SIZE}" ; \
+ truncate -s $${CONVERT_SYNC_NEW_SIZE} "${CONVERT_TO_SYNC}"
diff -r fed307809604 -r 993d7428dc36 share/mk/converters/tar.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/mk/converters/tar.mk Fri Dec 09 00:41:40 2011 +0200
@@ -0,0 +1,13 @@
+CONVERT_FROM_TAR:=${NEW_CURRENT_PACKING_FILE_NAME}
+CONVERT_TO_TAR:=${CURRENT_PACKING_FILE_NAME}
+
+# Let user to override
+CONVERTER_TAR?=tar
+CONVERTER_TAR_VERBOSE?=-v
+
+${CONVERT_TO_TAR}: ${CONVERT_FROM_TAR}
+ @echo -n "========== Convert ${CONVERT_FROM_TAR} to ${CONVERT_TO_TAR}"
+ @echo " with ${CONVERTER_TAR} ============"
+ ${CONVERTER_TAR} -c -C `dirname "${CONVERT_FROM_TAR}"` \
+ ${CONVERTER_TAR_VERBOSE} -f "${CONVERT_TO_TAR}" \
+ `basename "${CONVERT_FROM_TAR}"`
diff -r fed307809604 -r 993d7428dc36 share/mk/converters/uboot.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/mk/converters/uboot.mk Fri Dec 09 00:41:40 2011 +0200
@@ -0,0 +1,51 @@
+CONVERT_FROM_UBOOT:=${NEW_CURRENT_PACKING_FILE_NAME}
+CONVERT_TO_UBOOT:=${CURRENT_PACKING_FILE_NAME}
+
+# Let user to override
+CONVERTER_UBOOT?=uboot_mkimage
+.if !defined(UBOOT_KERNEL_COMPRESSION_TYPE) || empty(UBOOT_KERNEL_COMPRESSION_TYPE)
+_SUFFIX:=${CONVERT_FROM_UBOOT:E}
+.if !empty(_SUFFIX)
+.if ${_SUFFIX} == "gz"
+UBOOT_KERNEL_COMPRESSION_TYPE=gzip
+.elif ${_SUFFIX} == "bz2"
+UBOOT_KERNEL_COMPRESSION_TYPE=bzip2
+.elif ${_SUFFIX} == "lzma" || ${_SUFFIX} == "oldlzma" || ${_SUFFIX} == "xz"
+UBOOT_KERNEL_COMPRESSION_TYPE=lzma
+.else
+UBOOT_KERNEL_COMPRESSION_TYPE=none
+.endif
+.else
+UBOOT_KERNEL_COMPRESSION_TYPE=none
+.endif
+.endif
+
+.if !defined(UBOOT_KERNEL_LOAD_ADDRESS) || empty(UBOOT_KERNEL_LOAD_ADDRESS)
+.error "UBOOT_KERNEL_LOAD_ADDRESS must be defined"
+.endif
+
+.if !defined(UBOOT_KERNEL_ENTRY_POINT) || empty(UBOOT_KERNEL_ENTRY_POINT)
+.error "UBOOT_KERNEL_ENTRY_POINT must be defined"
+.endif
+
+.warning "XXX: ${CONVERTER_UBOOT} will use compression type - ${UBOOT_KERNEL_COMPRESSION_TYPE}"
+
+CONVERTER_UBOOT_FLAGS?= \
+ -A ${TARGET} -O linux -T kernel \
+ -C ${UBOOT_KERNEL_COMPRESSION_TYPE} \
+ -a ${UBOOT_KERNEL_LOAD_ADDRESS} \
+ -e ${UBOOT_KERNEL_ENTRY_POINT} \
+ -n 'FreeBSD Kernel Image'
+
+# Failback to /usr/local/bin if not found
+CONVERTER_UBOOT_BUILD_PATHS=${IMAGE_BUILD_PATHS}:/usr/local/bin
+
+.warning ${CONVERT_TO_UBOOT}: ${CONVERT_FROM_UBOOT}
+${CONVERT_TO_UBOOT}: ${CONVERT_FROM_UBOOT}
+ @echo -n "========== Convert ${CONVERT_FROM_UBOOT} to ${CONVERT_TO_UBOOT}"
+ @echo " with ${CONVERTER_UBOOT} ============"
+ PATH=${CONVERTER_UBOOT_BUILD_PATHS} ${CONVERTER_UBOOT} \
+ ${CONVERTER_UBOOT_FLAGS} -d "${CONVERT_FROM_UBOOT}" \
+ "${CONVERT_TO_UBOOT}"
+
+
diff -r fed307809604 -r 993d7428dc36 share/mk/converters/ulzma.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/mk/converters/ulzma.mk Fri Dec 09 00:41:40 2011 +0200
@@ -0,0 +1,10 @@
+CONVERT_FROM_ULZMA:=${NEW_CURRENT_PACKING_FILE_NAME}
+CONVERT_TO_ULZMA:=${CURRENT_PACKING_FILE_NAME}
+
+# Let user to override
+CONVERTER_ULZMA?=mkulzma
+CONVERTER_ULZMA_FLAGS?=${MKULZMA_FLAGS} -s ${MKULZMA_BLOCKSIZE}
+
+${CONVERT_TO_ULZMA}: ${CONVERT_FROM_ULZMA} ${ZTOOLS_PATH}/mkulzma
+ @echo ========== Convert ${CONVERT_FROM_ULZMA} to ${CONVERT_TO_ULZMA} with ${CONVERTER_ULZMA} ============
+ PATH=${IMAGE_BUILD_PATHS} ${CONVERTER_ULZMA} ${CONVERTER_ULZMA_FLAGS} -o ${CONVERT_TO_ULZMA} ${CONVERT_FROM_ULZMA}
diff -r fed307809604 -r 993d7428dc36 share/mk/converters/uzip.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/mk/converters/uzip.mk Fri Dec 09 00:41:40 2011 +0200
@@ -0,0 +1,10 @@
+CONVERT_FROM_UZIP:=${NEW_CURRENT_PACKING_FILE_NAME}
+CONVERT_TO_UZIP:=${CURRENT_PACKING_FILE_NAME}
+
+# Let user to override
+CONVERTER_UZIP?=mkuzip
+CONVERTER_UZIP_FLAGS?=${MKUZIP_FLAGS} -s ${MKUZIP_BLOCKSIZE}
+
+${CONVERT_TO_UZIP}: ${CONVERT_FROM_UZIP} ${ZTOOLS_PATH}/${CONVERTER_UZIP}
+ @echo ========== Convert ${CONVERT_FROM_UZIP} to ${CONVERT_TO_UZIP} with ${CONVERTER_UZIP} ============
+ PATH=${IMAGE_BUILD_PATHS} ${CONVERTER_UZIP} ${CONVERTER_UZIP_FLAGS} -o ${CONVERT_TO_UZIP} ${CONVERT_FROM_UZIP}
diff -r fed307809604 -r 993d7428dc36 share/mk/converters/xz.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/mk/converters/xz.mk Fri Dec 09 00:41:40 2011 +0200
@@ -0,0 +1,10 @@
+CONVERT_FROM_XZ:=${NEW_CURRENT_PACKING_FILE_NAME}
+CONVERT_TO_XZ:=${CURRENT_PACKING_FILE_NAME}
+
+# Let user to override
+CONVERTER_XZ?=xz
+CONVERTER_XZ_FLAGS?=--stdout
+
+${CONVERT_TO_XZ}: ${CONVERT_FROM_XZ}
+ @echo ========== Convert ${CONVERT_FROM_XZ} to ${CONVERT_TO_XZ} with ${CONVERTER_XZ} ============
+ ${CONVERTER_XZ} ${CONVERTER_XZ_FLAGS} ${CONVERT_FROM_XZ} > ${CONVERT_TO_XZ}
diff -r fed307809604 -r 993d7428dc36 share/mk/zrouter.packing.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/mk/zrouter.packing.mk Fri Dec 09 00:41:40 2011 +0200
@@ -0,0 +1,33 @@
+#
+# Packing magic
+# require PACKING_TARGET_LIST on input
+#
+
+.if defined(PACKING_TARGET_LIST) && !empty(PACKING_TARGET_LIST)
+.for CURRENT_PACKING_TARGET in ${PACKING_TARGET_LIST}
+CURRENT_PACKING_FILE:=${CURRENT_PACKING_TARGET}
+_LIST:=${CURRENT_PACKING_FILE:C/\./ /g}
+
+CURRENT_PACKING_FILE_NAME:=${CURRENT_PACKING_FILE}
+
+.for CURRENT_ITEM in ${_LIST}
+# Get filename w/o last suffix
+NEW_CURRENT_PACKING_FILE_NAME:=${CURRENT_PACKING_FILE_NAME:R}
+# Get last suffix
+CURRENT_PACKING_FILE_SUFFIX:=${CURRENT_PACKING_FILE_NAME:E}
+.if !empty(CURRENT_PACKING_FILE_SUFFIX) && ${CURRENT_PACKING_FILE_SUFFIX} != ""
+#.warning From file ${NEW_CURRENT_PACKING_FILE_NAME}, to file ${CURRENT_PACKING_FILE_NAME}, with converter "${CURRENT_PACKING_FILE_SUFFIX}".
+.if exists(${ZROUTER_ROOT}/share/mk/converters/${CURRENT_PACKING_FILE_SUFFIX}.mk)
+.warning Will convert file ${NEW_CURRENT_PACKING_FILE_NAME}, with converter "${CURRENT_PACKING_FILE_SUFFIX}".
+# Invoke converter for that suffix
+.include "${ZROUTER_ROOT}/share/mk/converters/${CURRENT_PACKING_FILE_SUFFIX}.mk"
+.else
+.error "Converter for suffix '${CURRENT_PACKING_FILE_SUFFIX}' undefined"
+.endif
+CURRENT_PACKING_FILE_NAME:=${NEW_CURRENT_PACKING_FILE_NAME}
+.endif
+.endfor # CURRENT_ITEM in ${LIST}
+.endfor # CURRENT_PACKING_TARGET in ${PACKING_TARGET_LIST}
+.else # defined(PACKING_TARGET_LIST) && !empty(PACKING_TARGET_LIST)
+.error "PACKING_TARGET_LIST not defined or empty"
+.endif # defined(PACKING_TARGET_LIST) && !empty(PACKING_TARGET_LIST)
\ No newline at end of file
More information about the Zrouter-src
mailing list