[Feature]add MT2731_MP2_MR2_SVN388 baseline version
Change-Id: Ief04314834b31e27effab435d3ca8ba33b499059
diff --git a/meta/meta-mediatek/classes/kernel-uboot-extension.bbclass b/meta/meta-mediatek/classes/kernel-uboot-extension.bbclass
new file mode 100644
index 0000000..fc93a28
--- /dev/null
+++ b/meta/meta-mediatek/classes/kernel-uboot-extension.bbclass
@@ -0,0 +1,49 @@
+uboot_prep_kimage() {
+
+ linux_comp=${KERNEL_COMPRESS}
+
+ # uncompressed elf vmlinux
+ vmlinux_path="vmlinux"
+
+ if test "${linux_comp}" = "lz4"; then
+ linux_suffix=".lz4"
+ elif test "${linux_comp}" = "gzip"; then
+ linux_suffix=".gz"
+ else
+ # Use 32-Bit kernel's compression method since
+ # it's is a kind of self-extracting executable.
+ if test -f "arch/arm/boot/compressed/vmlinux"; then
+ vmlinux_path="arch/arm/boot/compressed/vmlinux"
+ fi
+ linux_suffix=""
+ fi
+
+ ${OBJCOPY} -O binary -R .note -R .comment -S "${vmlinux_path}" linux.bin
+
+ if test "${linux_comp}" = "lz4"; then
+ lz4 -l -c1 linux.bin > linux.bin${linux_suffix}
+ # append uncompressed filesize info
+ dec_size=0
+ fsize=$(stat -c "%s" "linux.bin")
+ dec_size=$(expr $dec_size + $fsize)
+ printf "%08x\n" $dec_size |
+ sed 's/\(..\)/\1 /g' | {
+ read ch0 ch1 ch2 ch3;
+ for ch in $ch3 $ch2 $ch1 $ch0; do
+ printf `printf '%s%03o' '\\' 0x$ch` >> linux.bin${linux_suffix};
+ done;
+ }
+ elif test "${linux_comp}" = "gzip"; then
+ gzip -9 linux.bin
+ else
+ echo "For none case or another compressing"
+ fi
+
+ if ! test "${linux_comp}" = "none"; then
+ mv -f "linux.bin${linux_suffix}" linux.bin
+ else
+ echo "No kerenl compression"
+ fi
+
+ echo "${linux_comp}"
+}