generate_certificate_volume() {
	grep certificates /proc/mtd > /dev/null
	[ $? -eq 0 ] && return

	ls /dev/ubi0 > /dev/null
	[ $? -eq 0 ] || return

	ubinfo /dev/ubi0 -N certificates > /dev/null
	[ $? -eq 0 ] || {
		ubirsvol /dev/ubi0 -N rootfs_data -s 20MiB
		ubimkvol /dev/ubi0 -N certificates -S 20
	}
}

boot_hook_add preinit_main generate_certificate_volume
