summaryrefslogtreecommitdiffstats
path: root/target/linux/x86/image
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/x86/image')
-rw-r--r--target/linux/x86/image/Config.in44
-rw-r--r--target/linux/x86/image/Makefile125
-rwxr-xr-xtarget/linux/x86/image/gen_image_generic.sh (renamed from target/linux/x86/image/gen_image_x86.sh)21
-rw-r--r--target/linux/x86/image/grub-early.cfg1
-rw-r--r--target/linux/x86/image/grub-iso.cfg10
-rw-r--r--target/linux/x86/image/grub.cfg13
-rw-r--r--target/linux/x86/image/menu.lst15
-rwxr-xr-xtarget/linux/x86/image/mkimg_bifferboard.py50
-rwxr-xr-xtarget/linux/x86/image/mkimg_sitecom.pl11
9 files changed, 200 insertions, 90 deletions
diff --git a/target/linux/x86/image/Config.in b/target/linux/x86/image/Config.in
index 9a1317bb6..d7b5e90d1 100644
--- a/target/linux/x86/image/Config.in
+++ b/target/linux/x86/image/Config.in
@@ -1,13 +1,13 @@
config X86_ETHERBOOT_IMAGES
bool "Build Etherboot image"
- depends TARGET_x86 && TARGET_x86_thincan_DBE61
+ depends on TARGET_x86 && TARGET_x86_thincan_DBE61
default y
help
Builds network bootable image for ThinCan DBE61 (Etherboot BIOS)
config X86_ETHERBOOT_BOOTOPTS
string "Extra kernel boot options"
- depends X86_ETHERBOOT_IMAGES
+ depends on X86_ETHERBOOT_IMAGES
default "ip=dhcp nbdport=2000 " if TARGET_ROOTFS_SQUASHFS
default "ip=dhcp root=/dev/nfs nfsroot=192.168.0.1:/srv/dbe61"
help
@@ -15,26 +15,26 @@ config X86_ETHERBOOT_BOOTOPTS
config X86_GRUB_IMAGES
bool "Build GRUB images (Linux x86 or x86_64 host only)"
- depends TARGET_x86 && !TARGET_x86_olpc
- depends TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_ISO || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
- select PACKAGE_grub
+ depends on TARGET_x86 && !(TARGET_x86_olpc || TARGET_x86_rdc)
+ depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_ISO || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
+ select PACKAGE_grub2
default y
config X86_GRUB_CONSOLE
bool "Use Console Terminal (in addition to Serial)"
- depends X86_GRUB_IMAGES
+ depends on X86_GRUB_IMAGES
default n if (TARGET_x86_generic_Soekris45xx || TARGET_x86_generic_Soekris48xx || TARGET_x86_net5501 || TARGET_x86_geos || TARGET_x86_alix2)
default y
config X86_GRUB_SERIAL
string "Serial port device"
- depends X86_GRUB_IMAGES
+ depends on X86_GRUB_IMAGES
default "hvc0" if TARGET_x86_xen_domu
default "ttyS0" if ! TARGET_x86_xen_domu
config X86_GRUB_BAUDRATE
int "Serial port baud rate"
- depends X86_GRUB_IMAGES
+ depends on X86_GRUB_IMAGES
default 19200 if TARGET_x86_generic_Soekris45xx || TARGET_x86_generic_Soekris48xx || TARGET_x86_net5501
default 38400 if TARGET_x86_alix2
default 115200 if TARGET_x86_geos || TARGET_x86_kvm_guest
@@ -42,57 +42,57 @@ config X86_GRUB_BAUDRATE
config X86_GRUB_BOOTOPTS
string "Extra kernel boot options"
- depends X86_GRUB_IMAGES
+ depends on X86_GRUB_IMAGES
default "xencons=hvc" if TARGET_x86_xen_domu
help
If you don't know, just leave it blank.
config X86_GRUB_TIMEOUT
string "Seconds to wait before booting the default entry"
- depends X86_GRUB_IMAGES
+ depends on X86_GRUB_IMAGES
default "5"
help
If you don't know, 5 seconds is a reasonable default.
config X86_VDI_IMAGES
bool "Build VirtualBox image files (VDI)"
- depends X86_GRUB_IMAGES
- depends TARGET_x86
- depends TARGET_ROOTFS_EXT4FS
+ depends on X86_GRUB_IMAGES
+ depends on TARGET_x86
+ depends on TARGET_ROOTFS_EXT4FS
select PACKAGE_kmod-pcnet32
config X86_VMDK_IMAGES
bool "Build VMware image files (VMDK)"
- depends X86_GRUB_IMAGES
- depends TARGET_x86
- depends TARGET_ROOTFS_EXT4FS
+ depends on X86_GRUB_IMAGES
+ depends on TARGET_x86
+ depends on TARGET_ROOTFS_EXT4FS
select PACKAGE_kmod-e1000
config OLPC_BOOTSCRIPT_IMAGES
bool "Build images with bootscript"
- depends TARGET_x86_olpc
- depends TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_ISO || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
+ depends on TARGET_x86_olpc
+ depends on TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_ISO || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
default TARGET_x86_olpc
config TARGET_IMAGES_PAD
bool "Pad images to filesystem size (for JFFS2)"
- depends OLPC_BOOTSCRIPT_IMAGES || X86_GRUB_IMAGES
+ depends on OLPC_BOOTSCRIPT_IMAGES || X86_GRUB_IMAGES
config TARGET_IMAGES_GZIP
bool "GZip images"
- depends TARGET_IMAGES_PAD || TARGET_ROOTFS_EXT4FS
+ depends on TARGET_IMAGES_PAD || TARGET_ROOTFS_EXT4FS
default y
config TARGET_KERNEL_PARTSIZE
int "Kernel partition size (in MB)"
- depends OLPC_BOOTSCRIPT_IMAGES || X86_GRUB_IMAGES
+ depends on OLPC_BOOTSCRIPT_IMAGES || X86_GRUB_IMAGES
default 4
config TARGET_ROOTFS_PARTNAME
string "Root partition on target device"
- depends OLPC_BOOTSCRIPT_IMAGES || X86_GRUB_IMAGES
+ depends on OLPC_BOOTSCRIPT_IMAGES || X86_GRUB_IMAGES
default "/dev/vda2" if TARGET_x86_kvm_guest
default "/dev/xvda2" if TARGET_x86_xen_domu
default "/dev/sda2" if ! (TARGET_x86_kvm_guest || TARGET_x86_xen_domu)
diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile
index 26e34ff6d..62d4c7305 100644
--- a/target/linux/x86/image/Makefile
+++ b/target/linux/x86/image/Makefile
@@ -9,11 +9,20 @@ include $(INCLUDE_DIR)/image.mk
export PATH=$(TARGET_PATH):/sbin
+GRUB2_MODULES = biosdisk boot chain configfile ext2 linux ls part_msdos reboot serial vga
+GRUB2_MODULES_ISO = biosdisk boot chain configfile iso9660 linux ls part_msdos reboot serial vga
GRUB_TERMINALS =
GRUB_SERIAL_CONFIG =
GRUB_TERMINAL_CONFIG =
GRUB_CONSOLE_CMDLINE =
+USE_ATKBD = generic kvm_guest
+
+ifneq ($(strip $(foreach subtarget,$(USE_ATKBD),$(CONFIG_TARGET_x86_$(subtarget)))),)
+ GRUB2_MODULES += at_keyboard
+ GRUB2_MODULES_ISO += at_keyboard
+endif
+
ifneq ($(CONFIG_X86_GRUB_CONSOLE),)
GRUB_CONSOLE_CMDLINE += console=tty0
GRUB_TERMINALS += console
@@ -26,7 +35,7 @@ ifneq ($(CONFIG_X86_GRUB_SERIAL),)
endif
ifneq ($(GRUB_TERMINALS),)
- GRUB_TERMINAL_CONFIG := terminal --timeout=2 $(GRUB_TERMINALS)
+ GRUB_TERMINAL_CONFIG := terminal_input $(GRUB_TERMINALS); terminal_output $(GRUB_TERMINALS)
endif
ROOTPART:=$(call qstrip,$(CONFIG_TARGET_ROOTFS_PARTNAME))
@@ -40,7 +49,7 @@ ifneq ($(CONFIG_X86_GRUB_IMAGES),)
define Image/cmdline/ext4
root=$(ROOTPART) rootfstype=ext4 rootwait
endef
-
+
define Image/cmdline/jffs2-64k
block2mtd.block2mtd=$(ROOTPART),65536,rootfs root=/dev/mtdblock0 rootfstype=jffs2 rootwait
endef
@@ -53,38 +62,36 @@ ifneq ($(CONFIG_X86_GRUB_IMAGES),)
block2mtd.block2mtd=$(ROOTPART),65536,rootfs root=/dev/mtdblock0 rootfstype=squashfs rootwait
endef
- define Image/Build/grub
+ define Image/Build/grub2
# left here because the image builder doesnt need these
- $(INSTALL_DIR) $(KDIR)/root.grub/boot/grub
- $(CP) \
- $(KDIR)/stage1 \
- $(KDIR)/stage2 \
- $(KDIR)/e2fs_stage1_5 \
- $(KDIR)/root.grub/boot/grub/
+ $(INSTALL_DIR) $(KDIR)/root.grub/boot/grub $(KDIR)/grub2
$(CP) $(KDIR)/bzImage $(KDIR)/root.grub/boot/vmlinuz
+ grub-mkimage \
+ -d $(STAGING_DIR_HOST)/lib/grub/i386-pc \
+ -o $(KDIR)/grub2/core.img \
+ -O i386-pc \
+ -c ./grub-early.cfg \
+ $(GRUB2_MODULES)
+ $(CP) $(STAGING_DIR_HOST)/lib/grub/i386-pc/*.img $(KDIR)/grub2/
+ echo '(hd0) $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).img' > $(KDIR)/grub2/device.map
sed \
-e 's#@SERIAL_CONFIG@#$(strip $(GRUB_SERIAL_CONFIG))#g' \
-e 's#@TERMINAL_CONFIG@#$(strip $(GRUB_TERMINAL_CONFIG))#g' \
-e 's#@CMDLINE@#$(strip $(call Image/cmdline/$(1)) $(BOOTOPTS) $(GRUB_CONSOLE_CMDLINE))#g' \
-e 's#@TIMEOUT@#$(GRUB_TIMEOUT)#g' \
- ./menu.lst > $(KDIR)/root.grub/boot/grub/menu.lst
- PADDING="$(CONFIG_TARGET_IMAGES_PAD)" PATH="$(TARGET_PATH)" ./gen_image_x86.sh \
+ ./grub.cfg > $(KDIR)/root.grub/boot/grub/grub.cfg
+ PADDING="$(CONFIG_TARGET_IMAGES_PAD)" PATH="$(TARGET_PATH)" ./gen_image_generic.sh \
$(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).img \
$(CONFIG_TARGET_KERNEL_PARTSIZE) $(KDIR)/root.grub \
- $(CONFIG_TARGET_ROOTFS_PARTSIZE) $(KDIR)/root.$(1)
+ $(CONFIG_TARGET_ROOTFS_PARTSIZE) $(KDIR)/root.$(1) \
+ 256
+ grub-bios-setup \
+ --device-map="$(KDIR)/grub2/device.map" \
+ -d "$(KDIR)/grub2" \
+ -r "hd0,msdos1" \
+ "$(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).img"
$(call Image/Build/grub/$(1))
endef
-
- define Image/Prepare/grub
- # for the image builder
- $(CP) \
- $(STAGING_DIR)/usr/lib/grub/i386-openwrt/stage1 \
- $(STAGING_DIR)/usr/lib/grub/i386-openwrt/stage2 \
- $(STAGING_DIR)/usr/lib/grub/i386-openwrt/stage2_eltorito \
- $(STAGING_DIR)/usr/lib/grub/i386-openwrt/e2fs_stage1_5 \
- $(KDIR)/
- endef
-
endif
ROOTDELAY=10
@@ -125,21 +132,29 @@ define Image/Build/squashfs
$(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
endef
-define Image/Build/iso
- $(INSTALL_DIR) $(KDIR)/root.grub/boot/grub
- $(CP) \
- $(KDIR)/stage2_eltorito \
- $(KDIR)/root.grub/boot/grub/
+define Image/Build/iso
+ $(INSTALL_DIR) $(KDIR)/root.grub/boot/grub $(KDIR)/grub2
+ $(CP) $(KDIR)/bzImage $(KDIR)/root.grub/boot/vmlinuz
+ grub-mkimage \
+ -d $(STAGING_DIR_HOST)/lib/grub/i386-pc \
+ -o $(KDIR)/grub2/eltorito.img \
+ -O i386-pc \
+ -c ./grub-early.cfg \
+ $(GRUB2_MODULES_ISO)
+ cat \
+ $(STAGING_DIR_HOST)/lib/grub/i386-pc/cdboot.img \
+ $(KDIR)/grub2/eltorito.img \
+ > $(KDIR)/root.grub/boot/grub/eltorito.img
sed \
-e 's#@SERIAL_CONFIG@#$(strip $(GRUB_SERIAL_CONFIG))#g' \
-e 's#@TERMINAL_CONFIG@#$(strip $(GRUB_TERMINAL_CONFIG))#g' \
- -e 's#@CMDLINE@#$(strip $(call Image/cmdline/$(1)) $(BOOTOPTS) $(GRUB_CONSOLE_CMDLINE))#g' \
- -e 's#(hd0,0)#(cd)#g' \
- ./menu.lst > $(KDIR)/root.grub/boot/grub/menu.lst
- $(CP) $(KDIR)/bzImage $(KDIR)/root.grub/boot/vmlinuz
- mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table \
- -o $(KDIR)/root.iso $(KDIR)/root.grub
-endef
+ -e 's#@CMDLINE@#root=/dev/sr0 rootfstype=iso9660 rootwait $(strip $(call Image/cmdline/$(1)) $(BOOTOPTS) $(GRUB_CONSOLE_CMDLINE))#g' \
+ -e 's#@TIMEOUT@#$(GRUB_TIMEOUT)#g' \
+ ./grub-iso.cfg > $(KDIR)/root.grub/boot/grub/grub.cfg
+ $(CP) $(KDIR)/bzImage $(KDIR)/root.grub/boot/vmlinuz
+ mkisofs -R -b boot/grub/eltorito.img -no-emul-boot -boot-info-table \
+ -o $(KDIR)/root.iso $(KDIR)/root.grub $(TARGET_DIR)
+endef
ifneq ($(CONFIG_X86_VDI_IMAGES),)
define Image/Build/vdi
@@ -200,23 +215,57 @@ define Image/BuildKernel
endif
endef
+define Image/Build/Profile/ar525w
+ cp $(KDIR)/bzImage $(KDIR)/bzImage.tmp
+ $(SCRIPT_DIR)/pad_image $(1) $(KDIR)/bzImage.tmp $(KDIR)/root.$(1) 32
+ $(STAGING_DIR_HOST)/bin/airlink -b 1 $(KDIR)/bzImage.tmp $(KDIR)/root.$(1) \
+ $(BIN_DIR)/$(IMG_PREFIX)-$(1)-ar525w.img
+ $(STAGING_DIR_HOST)/bin/airlink -e -b 1 $(KDIR)/bzImage.tmp $(KDIR)/root.$(1) \
+ $(BIN_DIR)/$(IMG_PREFIX)-$(1)-ar525w-web.img
+endef
+
+define Image/Build/Profile/sitecom
+ cp $(KDIR)/bzImage $(KDIR)/bzImage.tmp
+ #32k config data + 20 bytes header + 2 bytes checksum after kernel image
+ $(SCRIPT_DIR)/pad_image $(1) $(KDIR)/bzImage.tmp $(KDIR)/root.$(1) 32790
+ $(TOPDIR)/target/linux/rdc/image/mkimg_sitecom.pl $(KDIR)/bzImage.tmp > $(KDIR)/tmp.img
+ cat $(KDIR)/root.$(1) >> $(KDIR)/tmp.img
+ cp $(KDIR)/tmp.img $(BIN_DIR)/$(IMG_PREFIX)-$(1)-sitecom.img
+ rm $(KDIR)/tmp.img $(KDIR)/bzImage.tmp
+endef
+
+define Image/Build/Profile/bifferboard
+ $(TOPDIR)/target/linux/rdc/image/mkimg_bifferboard.py $(KDIR)/bzImage $(KDIR)/root.$(1) \
+ $(BIN_DIR)/$(IMG_PREFIX)-$(1)-bifferboard.img
+endef
+
define Image/Prepare
$(CP) $(LINUX_DIR)/arch/x86/boot/bzImage $(KDIR)/bzImage
$(call Image/Prepare/bootscript)
- $(call Image/Prepare/grub)
+ $(call Image/Prepare/grub2)
+endef
+
+define Image/Build/Initramfs
+ $(CP) $(KDIR)/bzImage $(BIN_DIR)/$(IMG_PREFIX)-ramfs.bzImage
endef
define Image/Build
$(call Image/Build/$(1))
$(call Image/Build/bootscript,$(1))
ifneq ($(1),iso)
- $(call Image/Build/grub,$(1))
+ $(call Image/Build/grub2,$(1))
$(call Image/Build/vdi,$(1))
$(call Image/Build/vmdk,$(1))
- endif
$(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-rootfs-$(1).img
+ else
+ $(CP) $(KDIR)/root.iso $(BIN_DIR)/$(IMG_PREFIX).iso
+ endif
$(CP) $(KDIR)/bzImage $(BIN_DIR)/$(IMG_PREFIX)-vmlinuz
$(call Image/Build/gzip/$(1))
+ $(call Image/Build/Profile/$(PROFILE),$(1))
+ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
+ $(call Image/Build/Initramfs)
+endif
endef
$(eval $(call BuildImage))
diff --git a/target/linux/x86/image/gen_image_x86.sh b/target/linux/x86/image/gen_image_generic.sh
index e1d1b92dd..9d11efbb0 100755
--- a/target/linux/x86/image/gen_image_x86.sh
+++ b/target/linux/x86/image/gen_image_generic.sh
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
-# Copyright (C) 2006-2010 OpenWrt.org
-set -x
-[ $# == 5 ] || {
- echo "SYNTAX: $0 <file> <kernel size> <kernel directory> <rootfs size> <rootfs image>"
+# Copyright (C) 2006-2012 OpenWrt.org
+set -x
+[ $# == 5 -o $# == 6 ] || {
+ echo "SYNTAX: $0 <file> <kernel size> <kernel directory> <rootfs size> <rootfs image> [<align>]"
exit 1
}
@@ -11,6 +11,7 @@ KERNELSIZE="$2"
KERNELDIR="$3"
ROOTFSSIZE="$4"
ROOTFSIMAGE="$5"
+ALIGN="$6"
rm -f "$OUTPUT"
@@ -19,7 +20,7 @@ sect=63
cyl=$(( ($KERNELSIZE + $ROOTFSSIZE) * 1024 * 1024 / ($head * $sect * 512)))
# create partition table
-set `ptgen -o "$OUTPUT" -h $head -s $sect -p ${KERNELSIZE}m -p ${ROOTFSSIZE}m`
+set `ptgen -o "$OUTPUT" -h $head -s $sect -p ${KERNELSIZE}m -p ${ROOTFSSIZE}m ${ALIGN:+-l $ALIGN}`
KERNELOFFSET="$(($1 / 512))"
KERNELSIZE="$(($2 / 512))"
@@ -36,13 +37,3 @@ dd if="$ROOTFSIMAGE" of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc
genext2fs -d "$KERNELDIR" -b "$BLOCKS" "$OUTPUT.kernel"
dd if="$OUTPUT.kernel" of="$OUTPUT" bs=512 seek="$KERNELOFFSET" conv=notrunc
rm -f "$OUTPUT.kernel"
-
-which chpax >/dev/null && chpax -zp $(which grub)
-grub --batch --no-curses --no-floppy --device-map=/dev/null <<EOF
-device (hd0) $OUTPUT
-geometry (hd0) $cyl $head $sect
-root (hd0,0)
-setup (hd0)
-quit
-EOF
-
diff --git a/target/linux/x86/image/grub-early.cfg b/target/linux/x86/image/grub-early.cfg
new file mode 100644
index 000000000..4a5b5a609
--- /dev/null
+++ b/target/linux/x86/image/grub-early.cfg
@@ -0,0 +1 @@
+configfile (hd0,msdos1)/boot/grub/grub.cfg
diff --git a/target/linux/x86/image/grub-iso.cfg b/target/linux/x86/image/grub-iso.cfg
new file mode 100644
index 000000000..3d47a95a4
--- /dev/null
+++ b/target/linux/x86/image/grub-iso.cfg
@@ -0,0 +1,10 @@
+@SERIAL_CONFIG@
+@TERMINAL_CONFIG@
+
+set default="0"
+set timeout="@TIMEOUT@"
+set root='(cd)'
+
+menuentry "OpenWrt" {
+ linux /boot/vmlinuz @CMDLINE@ noinitrd
+}
diff --git a/target/linux/x86/image/grub.cfg b/target/linux/x86/image/grub.cfg
new file mode 100644
index 000000000..33b9d0b1a
--- /dev/null
+++ b/target/linux/x86/image/grub.cfg
@@ -0,0 +1,13 @@
+@SERIAL_CONFIG@
+@TERMINAL_CONFIG@
+
+set default="0"
+set timeout="@TIMEOUT@"
+set root='(hd0,msdos1)'
+
+menuentry "OpenWrt" {
+ linux /boot/vmlinuz @CMDLINE@ noinitrd
+}
+menuentry "OpenWrt (failsafe)" {
+ linux /boot/vmlinuz failsafe=true @CMDLINE@ noinitrd
+}
diff --git a/target/linux/x86/image/menu.lst b/target/linux/x86/image/menu.lst
deleted file mode 100644
index 5af1e955b..000000000
--- a/target/linux/x86/image/menu.lst
+++ /dev/null
@@ -1,15 +0,0 @@
-@SERIAL_CONFIG@
-@TERMINAL_CONFIG@
-
-default 0
-timeout @TIMEOUT@
-
-title OpenWrt
-root (hd0,0)
-kernel /boot/vmlinuz @CMDLINE@ noinitrd reboot=bios
-boot
-
-title OpenWrt (failsafe)
-root (hd0,0)
-kernel /boot/vmlinuz failsafe=true @CMDLINE@ noinitrd reboot=bios
-boot
diff --git a/target/linux/x86/image/mkimg_bifferboard.py b/target/linux/x86/image/mkimg_bifferboard.py
new file mode 100755
index 000000000..5444abebd
--- /dev/null
+++ b/target/linux/x86/image/mkimg_bifferboard.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+
+"""
+ Create firmware for 4/8MB Bifferboards, suitable for uploading using
+ either bb_upload8.py or bb_eth_upload8.py
+"""
+
+import struct, sys
+
+# Increase the kmax value if the script gives errors about the kernel being
+# too large. You need to set the Biffboot kmax value to the same value you
+# use here.
+kmax = 0x10
+
+# No need to change this for 4MB devices, it's only used to tell you if
+# the firmware is too large!
+flash_size = 0x800000
+
+# This is always the same, for 1MB, 4MB and 8MB devices
+config_extent = 0x6000
+
+kernel_extent = kmax * 0x10000
+
+if __name__ == "__main__":
+
+ if len(sys.argv) != 4:
+ print "usage: mkimg_bifferboard.py <kernel> <rootfs> <output file>"
+ sys.exit(-1)
+
+ bzimage = sys.argv[1]
+ rootfs = sys.argv[2]
+ target = sys.argv[3]
+
+ # Kernel first
+ fw = file(bzimage).read()
+ if len(fw) > (kernel_extent - config_extent):
+ raise IOError("Kernel too large")
+
+ # Pad up to end of kernel partition
+ while len(fw) < (kernel_extent - config_extent):
+ fw += "\xff"
+
+ fw += file(rootfs).read()
+
+ # Check length of total
+ if len(fw) > (flash_size - 0x10000 - config_extent):
+ raise IOError("Rootfs too large")
+
+ file(target,"wb").write(fw)
+ print "Firmware written to '%s'" % target
diff --git a/target/linux/x86/image/mkimg_sitecom.pl b/target/linux/x86/image/mkimg_sitecom.pl
new file mode 100755
index 000000000..cfd5e652f
--- /dev/null
+++ b/target/linux/x86/image/mkimg_sitecom.pl
@@ -0,0 +1,11 @@
+#!/usr/bin/perl
+
+open (bzimg, @ARGV[0]);
+while (<bzimg>) { $i .= $_; }
+$i .= pack "v", -(unpack "%v*", $i);
+print "CSYS";
+print pack("V", length($i));
+print pack("V", 0);
+print "WRRM";
+print pack("V", length($i));
+print $i;