summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorDaniel Schultz <d.schultz@phytec.de>2017-06-09 16:07:35 +0200
committerStefan Müller-Klieser <s.mueller-klieser@phytec.de>2017-06-21 15:22:07 +0200
commitb5303dfdcee11d132448b4c716a57dc01c172c96 (patch)
treefabf3bfe0263aa0fd67e69bbb84448fe929540bc /classes
parent3d03935b348957f753db71f3ae4a6714ca655321 (diff)
downloadmeta-phytec-b5303dfdcee11d132448b4c716a57dc01c172c96.tar.bz2
meta-phytec-b5303dfdcee11d132448b4c716a57dc01c172c96.zip
classes: wic-helper: updates
Changes: - description - change python rename function to bash append - Add EMMC creator: This function creates an EMMC image and writes the MLO at 0x0, 0x20000, 0x40000 and 0x60000 to support RAW boot for AM335x SoCs. Signed-off-by: Daniel Schultz <d.schultz@phytec.de> Signed-off-by: Stefan Müller-Klieser <s.mueller-klieser@phytec.de>
Diffstat (limited to 'classes')
-rw-r--r--classes/wic-am335x-helper.bbclass11
-rw-r--r--classes/wic-helper.bbclass48
2 files changed, 44 insertions, 15 deletions
diff --git a/classes/wic-am335x-helper.bbclass b/classes/wic-am335x-helper.bbclass
new file mode 100644
index 0000000..1fd48a1
--- /dev/null
+++ b/classes/wic-am335x-helper.bbclass
@@ -0,0 +1,11 @@
+IMAGE_CMD_emmc_append () {
+ if [ -e ${EMMCIMG} ]; then
+ # copy the MLO to address 0x0 and keep the partition table
+ dd if=${DEPLOY_DIR_IMAGE}/${BAREBOX_IPL_BIN_SYMLINK} of=${EMMCIMG} bs=446 count=1 conv=notrunc
+ dd if=${DEPLOY_DIR_IMAGE}/${BAREBOX_IPL_BIN_SYMLINK} of=${EMMCIMG} skip=1 seek=1 conv=notrunc
+ # copy the MLO to address 0x20000, 0x40000, 0x60000
+ dd if=${DEPLOY_DIR_IMAGE}/${BAREBOX_IPL_BIN_SYMLINK} of=${EMMCIMG} seek=768 bs=512 conv=notrunc
+ dd if=${DEPLOY_DIR_IMAGE}/${BAREBOX_IPL_BIN_SYMLINK} of=${EMMCIMG} seek=512 bs=512 conv=notrunc
+ dd if=${DEPLOY_DIR_IMAGE}/${BAREBOX_IPL_BIN_SYMLINK} of=${EMMCIMG} seek=256 bs=512 conv=notrunc
+ fi
+}
diff --git a/classes/wic-helper.bbclass b/classes/wic-helper.bbclass
index 4b415e9..8ffe483 100644
--- a/classes/wic-helper.bbclass
+++ b/classes/wic-helper.bbclass
@@ -1,7 +1,4 @@
-# (C) Copyright 2017 Phytec Messtechnik GmbH
-# Daniel Schultz <d.schultz@phytec.de>
-#
-#This file is a global helper class for the WIC tool to create Phytec BSPs.
+# This is a helper class for creating patitioned images with WIC for sd cards and emmc
def parse_dtbs(d):
kdt=d.getVar('KERNEL_DEVICETREE', True)
@@ -13,6 +10,7 @@ def parse_dtbs(d):
dtbs += " zImage-"+DTB
dtbcount += 1
return dtbs
+
IMAGE_DEPENDS_wic_append = " \
dosfstools-native \
mtools-native \
@@ -20,15 +18,35 @@ IMAGE_DEPENDS_wic_append = " \
virtual/bootloader:do_deploy \
"
-python do_rename_wic () {
- deploy_dir = d.getVar('IMGDEPLOYDIR', True)
- link_name = d.getVar('IMAGE_LINK_NAME', True)
- old = os.path.join(deploy_dir, link_name + ".wic")
- new = os.path.join(deploy_dir, link_name + ".sdcard")
- if os.path.exists(old):
- os.rename(old, new)
- bb.note("renamed %s to %s" % (old, new))
- else:
- bb.error("failed to rename %s, because it doesn't exist" % (old))
+IMAGE_CMD_wic_append () {
+ mv "$out${IMAGE_NAME_SUFFIX}.wic" "$out${IMAGE_NAME_SUFFIX}.sdcard"
+ ln -fs "${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.sdcard" "${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.sdcard"
+}
+
+IMAGE_CMD_emmc () {
+ if [ -e ${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.sdcard ]; then
+ SDIMG=${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.sdcard
+ else
+ if [ -e ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.sdcard ]; then
+ SDIMG=`readlink -f ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.sdcard`
+ else
+ SDIMG=${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.wic
+ fi
+ fi
+ EMMCIMG=${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.emmc
+ cp ${SDIMG} ${EMMCIMG}
+
+ ln -sf ${EMMCIMG} ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.emmc
}
-addtask do_rename_wic after do_image_wic before do_image_complete
+
+IMAGE_TYPEDEP_emmc = "wic"
+
+IMAGE_DEPENDS_emmc = " \
+ parted-native \
+ mtools-native \
+ dosfstools-native \
+ e2fsprogs-native \
+ virtual/kernel:do_deploy \
+ virtual/bootloader:do_deploy \
+ virtual/prebootloader:do_deploy \
+"