summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2020-11-11 14:22:06 -0600
committerJohn Klug <john.klug@multitech.com>2020-11-11 14:22:06 -0600
commitd75cc859d0009649aa5c97731933b50ba48231ba (patch)
treefbd1fac00b1f4a4b5688352f402335918f7c4807 /classes
downloadmeta-mlinux-atmel-d75cc859d0009649aa5c97731933b50ba48231ba.tar.gz
meta-mlinux-atmel-d75cc859d0009649aa5c97731933b50ba48231ba.tar.bz2
meta-mlinux-atmel-d75cc859d0009649aa5c97731933b50ba48231ba.zip
MultiTech mLinux Atmel distribution OpenEmbedded layer5.3.0a
Diffstat (limited to 'classes')
-rw-r--r--classes/mlinux-image.bbclass109
-rw-r--r--classes/mlinux-mirrors.bbclass14
-rw-r--r--classes/mlinux_metadata_scm.bbclass14
3 files changed, 137 insertions, 0 deletions
diff --git a/classes/mlinux-image.bbclass b/classes/mlinux-image.bbclass
new file mode 100644
index 0000000..dab5e5b
--- /dev/null
+++ b/classes/mlinux-image.bbclass
@@ -0,0 +1,109 @@
+# redefine mkfs.jffs2 command and remove --faketime option so we get non-zero file times
+# having file mod times of zero confuses cron
+IMAGE_CMD_jffs2 = "mkfs.jffs2 --root=${IMAGE_ROOTFS} --output=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.jffs2 ${EXTRA_IMAGECMD}"
+
+# set specified mtadm password in image using MTADM_PASSWORD_HASH
+mlinux_set_root_password () {
+ if [ -e ${IMAGE_ROOTFS}/etc/shadow ]; then
+ sed -i 's%^mtadm:[^:]*:%mtadm:${MTADM_PASSWORD_HASH}:%' ${IMAGE_ROOTFS}/etc/shadow
+ elif [ -e ${IMAGE_ROOTFS}/etc/passwd ]; then
+ sed -i 's%^mtadm:[^:]*:%mtadm:${MTADM_PASSWORD_HASH}:%' ${IMAGE_ROOTFS}/etc/passwd
+ fi
+}
+ROOTFS_POSTPROCESS_COMMAND += "mlinux_set_root_password;"
+
+# set custom product sw version to /etc/issue file
+mlinux_set_product_version () {
+ PREV_DIR=$(pwd)
+ cd "$TOPDIR"
+ PRODUCT_VER=$(git describe)
+ cd "$PREV_DIR"
+ PRODUCT_DATE=$(date +%Y-%m-%dT%H:%M:%S)
+
+ if [ -n "${PRODUCT_VER}" ]; then
+ # set issue
+ if cat ${IMAGE_ROOTFS}/etc/issue | grep "Version: " > /dev/null 2>&1 ; then
+ # replace
+ sed -i "s/^Version: .*$/Version: $PRODUCT_VER/g" ${IMAGE_ROOTFS}/etc/issue
+ sed -i "s/^Date: .*$/Date: $PRODUCT_DATE/g" ${IMAGE_ROOTFS}/etc/issue
+ else
+ # add
+ echo "" >> ${IMAGE_ROOTFS}/etc/issue
+ echo "Version: ${PRODUCT_VER}" >> ${IMAGE_ROOTFS}/etc/issue
+ echo "Date: $(date +%Y-%m-%dT%H:%M:%S)" >> ${IMAGE_ROOTFS}/etc/issue
+ fi
+ fi
+}
+ROOTFS_POSTPROCESS_COMMAND += "mlinux_set_product_version;"
+
+# generate upgrade.bin files -- provides single file for upgrades
+do_firmware() {
+ cd ${DEPLOY_DIR_IMAGE}
+
+ case "${MTBSP}" in
+ mtbsp-at91)
+ rm -f bstrap.bin* uboot.bin* uImage.bin* rootfs.jffs2* model
+
+ cp at91bootstrap_pmecc_padded.bin bstrap.bin
+ cp u-boot-${MACHINE}.bin uboot.bin
+ cp uImage-${MACHINE}.bin uImage.bin
+ cp ${IMAGE_BASENAME}-${MACHINE}.jffs2 rootfs.jffs2
+
+ cat bstrap.bin | md5sum > bstrap.bin.md5
+ cat uboot.bin | md5sum > uboot.bin.md5
+ cat uImage.bin | md5sum > uImage.bin.md5
+ cat rootfs.jffs2 | md5sum > rootfs.jffs2.md5
+
+ case "${MACHINE}" in
+ mtcdt)
+ echo "mtcdt|mtcdtip|mtcdtiphp" >model
+ ;;
+ mtrv1)
+ echo "mtrv1|mths" >model
+ ;;
+ *)
+ echo "${MACHINE}" > model
+ ;;
+ esac
+
+ tar cvf ${IMAGE_BASENAME}-${MACHINE}-upgrade.bin uImage.bin* rootfs.jffs2* model
+ tar cvf ${IMAGE_BASENAME}-${MACHINE}-upgrade-withboot.bin bstrap.bin* uboot.bin* uImage.bin* rootfs.jffs2* model
+ rm -f bstrap.bin* uboot.bin* uImage.bin* rootfs.jffs2* model
+ ;;
+ *)
+ ;;
+ esac
+}
+addtask firmware after do_image_complete before do_build
+
+# make links to images in TFTPBOOT_DIR for ease of development
+do_tftpboot_links() {
+ if [ -n "${TFTPBOOT_DIR}" ]; then
+ case "${MTBSP}" in
+ mtbsp-at91)
+ TFTPBOOT_CLEAN="oe_bootstrap.bin oe_bootstrap_pmecc_padded.bin \
+ oe_u-boot.bin oe_uImage.bin oe_rootfs.jffs2 oe_images oe_upgrade.bin oe_upgrade-withboot.bin"
+
+ install -d ${DEPLOY_DIR_IMAGE}
+
+ for f in ${TFTPBOOT_CLEAN}; do
+ rm -f ${TFTPBOOT_DIR}/$f
+ done
+
+ ln -nfs ${DEPLOY_DIR_IMAGE}/at91bootstrap.bin ${TFTPBOOT_DIR}/oe_bootstrap.bin
+ if [ -f ${DEPLOY_DIR_IMAGE}/at91bootstrap_pmecc_padded.bin ]; then
+ ln -nfs ${DEPLOY_DIR_IMAGE}/at91bootstrap_pmecc_padded.bin ${TFTPBOOT_DIR}/oe_bootstrap_pmecc_padded.bin
+ fi
+ ln -nfs ${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.bin ${TFTPBOOT_DIR}/oe_u-boot.bin
+ ln -nfs ${DEPLOY_DIR_IMAGE}/uImage-${MACHINE}.bin ${TFTPBOOT_DIR}/oe_uImage.bin
+ ln -nfs ${DEPLOY_DIR_IMAGE}/${IMAGE_BASENAME}-${MACHINE}.jffs2 ${TFTPBOOT_DIR}/oe_rootfs.jffs2
+ ln -nfs ${DEPLOY_DIR_IMAGE}/${IMAGE_BASENAME}-${MACHINE}-upgrade.bin ${TFTPBOOT_DIR}/oe_upgrade.bin
+ ln -nfs ${DEPLOY_DIR_IMAGE}/${IMAGE_BASENAME}-${MACHINE}-upgrade-withboot.bin ${TFTPBOOT_DIR}/oe_upgrade-withboot.bin
+ ln -nfs ${DEPLOY_DIR_IMAGE} ${TFTPBOOT_DIR}/oe_images
+ ;;
+ *)
+ ;;
+ esac
+ fi
+}
+addtask tftpboot_links after do_firmware before do_build
diff --git a/classes/mlinux-mirrors.bbclass b/classes/mlinux-mirrors.bbclass
new file mode 100644
index 0000000..5a88695
--- /dev/null
+++ b/classes/mlinux-mirrors.bbclass
@@ -0,0 +1,14 @@
+MIRRORS_append () {
+cvs://.*/.* http://multitech.net/mlinux/sources/
+svn://.*/.* http://multitech.net/mlinux/sources/
+git://.*/.* http://multitech.net/mlinux/sources/
+hg://.*/.* http://multitech.net/mlinux/sources/
+bzr://.*/.* http://multitech.net/mlinux/sources/
+osc://.*/.* http://multitech.net/mlinux/sources/
+p4://.*/.* http://multitech.net/mlinux/sources/
+ftp://.*/.* http://multitech.net/mlinux/sources/
+https?$://.*/.* http://multitech.net/mlinux/sources/
+http?$://.*/.* http://multitech.net/mlinux/sources/
+}
+
+SAVANNAH_GNU_MIRROR = "http://download-mirror.savannah.gnu.org/releases"
diff --git a/classes/mlinux_metadata_scm.bbclass b/classes/mlinux_metadata_scm.bbclass
new file mode 100644
index 0000000..b220344
--- /dev/null
+++ b/classes/mlinux_metadata_scm.bbclass
@@ -0,0 +1,14 @@
+MLINUX_METADATA_REVISION = "${@base_get_metadata_git_revision("${OEROOT}",None)}"
+MLINUX_METADATA_BRANCH = "${@base_get_metadata_git_branch("${OEROOT}",None).strip()}"
+MLINUX_LAYERS = "${@mlinux_layers(bb,d)}"
+
+def mlinux_layers(bb, d):
+ layers = (d.getVar("BBLAYERS", d, 1) or "").split()
+ layer_revs = ""
+
+ for layer in layers:
+ branch = base_get_metadata_git_branch(layer, d).strip()
+ rev = base_get_metadata_git_revision(layer, d)
+ layer_revs += "%-20s = %s:%s\n" % (os.path.basename(layer), branch, rev)
+
+ return layer_revs