summaryrefslogtreecommitdiff
path: root/classes/wic-helper.bbclass
blob: abe908e66ac4bc34f0ab7fee3272ab585d166b54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# This is a helper class for creating patitioned images with WIC for sd cards and emmc
BAREBOX_BINARY ??= "barebox.bin"

WICVARS_append = " BAREBOX_BINARY"

do_image_wic[depends] += "\
    dosfstools-native:do_populate_sysroot \
    mtools-native:do_populate_sysroot \
    virtual/kernel:do_deploy \
    virtual/bootloader:do_deploy \
"

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
}

IMAGE_TYPEDEP_emmc = "wic"

do_image_emmc[depends] += " \
    parted-native:do_populate_sysroot \
    mtools-native:do_populate_sysroot \
    dosfstools-native:do_populate_sysroot \
    e2fsprogs-native:do_populate_sysroot \
    virtual/kernel:do_deploy \
    virtual/bootloader:do_deploy \
    virtual/prebootloader:do_deploy \
"