summaryrefslogtreecommitdiff
path: root/classes/mlinux-image.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'classes/mlinux-image.bbclass')
-rw-r--r--classes/mlinux-image.bbclass33
1 files changed, 33 insertions, 0 deletions
diff --git a/classes/mlinux-image.bbclass b/classes/mlinux-image.bbclass
new file mode 100644
index 0000000..8da5e97
--- /dev/null
+++ b/classes/mlinux-image.bbclass
@@ -0,0 +1,33 @@
+# set specified root password in image using ROOT_PASSWORD_HASH
+mlinux_set_root_password () {
+ if [ -e ${IMAGE_ROOTFS}/etc/shadow ]; then
+ sed -i "s%^root:[^:]*:%root:${ROOT_PASSWORD_HASH}:%" ${IMAGE_ROOTFS}/etc/shadow
+ elif [ -e ${IMAGE_ROOTFS}/etc/passwd ]; then
+ sed -i "s%^root:[^:]*:%root:${ROOT_PASSWORD_HASH}:%" ${IMAGE_ROOTFS}/etc/passwd
+ fi
+}
+ROOTFS_POSTPROCESS_COMMAND += "mlinux_set_root_password;"
+
+# make links to images in TFTPBOOT_DIR for ease of development
+do_tftpboot_links() {
+ TFTPBOOT_CLEAN="oe_bootstrap.bin oe_bootstrap_pmecc_padded.bin \
+ oe_u-boot.bin oe_uImage.bin oe_rootfs.jffs2 oe_images"
+
+ if [ -n "${TFTPBOOT_DIR}" ]; then
+ 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} ${TFTPBOOT_DIR}/oe_images
+ fi
+}
+addtask tftpboot_links after do_rootfs before do_build