summaryrefslogtreecommitdiffstats
path: root/meta/classes/wrt-image.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/wrt-image.bbclass')
-rw-r--r--meta/classes/wrt-image.bbclass33
1 files changed, 33 insertions, 0 deletions
diff --git a/meta/classes/wrt-image.bbclass b/meta/classes/wrt-image.bbclass
new file mode 100644
index 0000000000..ba1163a719
--- /dev/null
+++ b/meta/classes/wrt-image.bbclass
@@ -0,0 +1,33 @@
1# we dont need the kernel in the image
2ROOTFS_POSTPROCESS_COMMAND += "rm -f ${IMAGE_ROOTFS}/boot/zImage*"
3
4def wrt_get_kernel_version(d):
5 import bb
6 if bb.data.inherits_class('image_ipk', d):
7 skd = bb.data.getVar('STAGING_KERNEL_DIR', d, 1)
8 return base_read_file(skd+'/kernel-abiversion')
9 return "-no kernel version for available-"
10
11wrt_create_images() {
12 I=${DEPLOY_DIR}/images
13 KERNEL_VERSION="${@wrt_get_kernel_version(d)}"
14
15 for type in ${IMAGE_FSTYPES}; do
16 # generic
17 trx -o ${I}/wrt-generic-${type}.trx ${I}/loader.gz \
18 ${I}/wrt-kernel-${KERNEL_VERSION}.lzma -a 0x10000 ${I}/${IMAGE_NAME}.rootfs.${type}
19
20 # WRT54GS
21 addpattern -2 -i ${I}/wrt-generic-${type}.trx -o ${I}/wrt54gs-${type}.trx -g
22
23 # WRT54G
24 sed "1s,^W54S,W54G," ${I}/wrt54gs-${type}.trx > ${I}/wrt54g-${type}.trx
25
26 # motorola
27 motorola-bin ${I}/wrt-generic-${type}.trx ${I}/motorola-${type}.bin
28 done;
29}
30
31IMAGE_POSTPROCESS_COMMAND += "wrt_create_images;"
32
33DEPENDS_prepend = "${@["wrt-imagetools-native ", ""][(bb.data.getVar('PACKAGES', d, 1) == '')]}" \ No newline at end of file