summaryrefslogtreecommitdiff
path: root/classes/wrt-image.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'classes/wrt-image.bbclass')
-rw-r--r--classes/wrt-image.bbclass34
1 files changed, 34 insertions, 0 deletions
diff --git a/classes/wrt-image.bbclass b/classes/wrt-image.bbclass
index e69de29bb2..f6ca5bcb19 100644
--- a/classes/wrt-image.bbclass
+++ b/classes/wrt-image.bbclass
@@ -0,0 +1,34 @@
+# we dont need the kernel in the image
+ROOTFS_POSTPROCESS_COMMAND += "rm -f ${IMAGE_ROOTFS}/boot/zImage*"
+
+def wrt_get_kernel_version(d):
+ import bb
+ if not bb.data.inherits_class('native', d):
+ skd = bb.data.getVar('STAGING_KERNEL_DIR', d, 1)
+ return base_read_file(skd+'/kernel-abiversion')
+ return "-no kernel version for native-"
+
+KERNEL_VERSION = "${@wrt_get_kernel_version(d)}"
+
+wrt_create_images() {
+ I=${DEPLOY_DIR}/images
+
+ for type in ${IMAGE_FSTYPES}; do
+ # generic
+ trx -o ${I}/wrt-generic-${type}.trx ${I}/loader.gz \
+ ${I}/wrt-kernel-${KERNEL_VERSION}.lzma -a 0x10000 ${I}/${IMAGE_NAME}.rootfs.${type}
+
+ # WRT54GS
+ addpattern -2 -i ${I}/wrt-generic-${type}.trx -o ${I}/wrt54gs-${type}.trx -g
+
+ # WRT54G
+ sed "1s,^W54S,W54G," ${I}/wrt54gs-${type}.trx > ${I}/wrt54g-${type}.trx
+
+ # motorola
+ motorola-bin ${I}/wrt-generic-${type}.trx ${I}/motorola-${type}.bin
+ done;
+}
+
+IMAGE_POSTPROCESS_COMMAND += "wrt_create_images;"
+
+DEPENDS += "wrt-imagetools" \ No newline at end of file