summaryrefslogtreecommitdiff
path: root/target/linux
diff options
context:
space:
mode:
authorkaloz <kaloz@3c298f89-4303-0410-b956-a3cf2f4a3e73>2014-01-07 12:23:35 +0000
committerkaloz <kaloz@3c298f89-4303-0410-b956-a3cf2f4a3e73>2014-01-07 12:23:35 +0000
commitf572e9f47af4fd8f21c0a08ba70d7b9cdc52f6f3 (patch)
tree72c2507d12b087fae093eba5588478966a983a50 /target/linux
parent1bfab7ed6b751c5b83c211047543f06acde91978 (diff)
add x86_64 target support
Signed-off-by: Imre Kaloz <kaloz@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@39208 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/x86_64/Makefile23
-rw-r--r--target/linux/x86_64/base-files/etc/inittab4
-rw-r--r--target/linux/x86_64/base-files/lib/preinit/15_essential_fs_x868
-rw-r--r--target/linux/x86_64/base-files/lib/preinit/89_move_config22
-rw-r--r--target/linux/x86_64/base-files/lib/upgrade/platform.sh44
-rw-r--r--target/linux/x86_64/config-default458
-rw-r--r--target/linux/x86_64/image/Makefile210
-rwxr-xr-xtarget/linux/x86_64/image/gen_image_generic.sh39
-rw-r--r--target/linux/x86_64/image/grub-early.cfg1
-rw-r--r--target/linux/x86_64/image/grub-iso.cfg10
-rw-r--r--target/linux/x86_64/image/grub.cfg13
-rw-r--r--target/linux/x86_64/patches/011-tune_lzma_options.patch22
-rw-r--r--target/linux/x86_64/patches/012-export_erase_write.patch23
13 files changed, 877 insertions, 0 deletions
diff --git a/target/linux/x86_64/Makefile b/target/linux/x86_64/Makefile
new file mode 100644
index 0000000000..09913f2689
--- /dev/null
+++ b/target/linux/x86_64/Makefile
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+ARCH:=x86_64
+BOARD:=x86_64
+BOARDNAME:=x86_64
+FEATURES:=ext4 vdi vmdk targz
+MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
+
+LINUX_VERSION:=3.10.24
+
+KERNELNAME:=bzImage
+
+include $(INCLUDE_DIR)/target.mk
+
+DEFAULT_PACKAGES += kmod-e1000
+
+$(eval $(call BuildTarget))
diff --git a/target/linux/x86_64/base-files/etc/inittab b/target/linux/x86_64/base-files/etc/inittab
new file mode 100644
index 0000000000..ca90fd8a2a
--- /dev/null
+++ b/target/linux/x86_64/base-files/etc/inittab
@@ -0,0 +1,4 @@
+::sysinit:/etc/init.d/rcS S boot
+::shutdown:/etc/init.d/rcS K shutdown
+ttyS0::askfirst:/bin/ash --login
+tty1::askfirst:/bin/ash --login
diff --git a/target/linux/x86_64/base-files/lib/preinit/15_essential_fs_x86 b/target/linux/x86_64/base-files/lib/preinit/15_essential_fs_x86
new file mode 100644
index 0000000000..5d5453093f
--- /dev/null
+++ b/target/linux/x86_64/base-files/lib/preinit/15_essential_fs_x86
@@ -0,0 +1,8 @@
+#!/bin/sh
+# Copyright (C) 2006-2010 OpenWrt.org
+# Copyright (C) 2010 Vertical Communications
+
+do_mount_procfs() {
+ mount -o noatime -t proc none /proc
+}
+
diff --git a/target/linux/x86_64/base-files/lib/preinit/89_move_config b/target/linux/x86_64/base-files/lib/preinit/89_move_config
new file mode 100644
index 0000000000..ba337e10ec
--- /dev/null
+++ b/target/linux/x86_64/base-files/lib/preinit/89_move_config
@@ -0,0 +1,22 @@
+#!/bin/sh
+# Copyright (C) 2012 OpenWrt.org
+
+move_config() {
+ local rootfsdev
+ local rootfstype
+
+ rootfstype="$(awk 'BEGIN { RS=" "; FS="="; } ($1 == "rootfstype") { print $2 }' < /proc/cmdline)"
+ case "$rootfstype" in
+ squashfs|jffs2)
+ rootfsdev="$(awk 'BEGIN { RS=" "; FS="="; } ($1 == "block2mtd.block2mtd") { print substr($2,1,index($2, ",")-1) }' < /proc/cmdline)";;
+ ext4)
+ rootfsdev="$(awk 'BEGIN { RS=" "; FS="="; } ($1 == "root") { print $2 }' < /proc/cmdline)";;
+ esac
+
+ mount -t ext4 -o rw,noatime "${rootfsdev%[0-9]}1" /mnt
+ mv -f /mnt/sysupgrade.tgz /
+ umount /mnt
+}
+
+boot_hook_add preinit_main move_config
+
diff --git a/target/linux/x86_64/base-files/lib/upgrade/platform.sh b/target/linux/x86_64/base-files/lib/upgrade/platform.sh
new file mode 100644
index 0000000000..9503d5db88
--- /dev/null
+++ b/target/linux/x86_64/base-files/lib/upgrade/platform.sh
@@ -0,0 +1,44 @@
+x86_get_rootfs() {
+ local rootfsdev
+ local rootfstype
+
+ rootfstype="$(awk 'BEGIN { RS=" "; FS="="; } ($1 == "rootfstype") { print $2 }' < /proc/cmdline)"
+ case "$rootfstype" in
+ squashfs|jffs2)
+ rootfsdev="$(awk 'BEGIN { RS=" "; FS="="; } ($1 == "block2mtd.block2mtd") { print substr($2,1,index($2, ",")-1) }' < /proc/cmdline)";;
+ ext4)
+ rootfsdev="$(awk 'BEGIN { RS=" "; FS="="; } ($1 == "root") { print $2 }' < /proc/cmdline)";;
+ esac
+
+ echo "$rootfstype:$rootfsdev"
+}
+
+platform_check_image() {
+ [ "$ARGC" -gt 1 ] && return 1
+
+ case "$(get_magic_word "$1")" in
+ eb48|eb63) return 0;;
+ *)
+ echo "Invalid image type"
+ return 1
+ ;;
+ esac
+}
+
+platform_copy_config() {
+ local rootfs="$(x86_get_rootfs)"
+ local rootfsdev="${rootfs##*:}"
+
+ mount -t ext4 -o rw,noatime "${rootfsdev%[0-9]}1" /mnt
+ cp -af "$CONF_TAR" /mnt/
+ umount /mnt
+}
+
+platform_do_upgrade() {
+ local rootfs="$(x86_get_rootfs)"
+ local rootfsdev="${rootfs##*:}"
+
+ sync
+ [ -b ${rootfsdev%[0-9]} ] && get_image "$@" | dd of=${rootfsdev%[0-9]} bs=4096 conv=fsync
+ sleep 1
+}
diff --git a/target/linux/x86_64/config-default b/target/linux/x86_64/config-default
new file mode 100644
index 0000000000..ad27973a41
--- /dev/null
+++ b/target/linux/x86_64/config-default
@@ -0,0 +1,458 @@
+# CONFIG_60XX_WDT is not set
+CONFIG_64BIT=y
+CONFIG_ACPI=y
+CONFIG_ACPI_AC=y
+CONFIG_ACPI_BATTERY=y
+CONFIG_ACPI_BLACKLIST_YEAR=0
+CONFIG_ACPI_BUTTON=y
+# CONFIG_ACPI_CMPC is not set
+# CONFIG_ACPI_CONTAINER is not set
+# CONFIG_ACPI_CUSTOM_DSDT is not set
+# CONFIG_ACPI_DEBUG is not set
+# CONFIG_ACPI_DOCK is not set
+# CONFIG_ACPI_EC_DEBUGFS is not set
+CONFIG_ACPI_FAN=y
+# CONFIG_ACPI_INITRD_TABLE_OVERRIDE is not set
+# CONFIG_ACPI_PCI_SLOT is not set
+CONFIG_ACPI_PROCESSOR=y
+# CONFIG_ACPI_PROCESSOR_AGGREGATOR is not set
+# CONFIG_ACPI_PROCFS is not set
+# CONFIG_ACPI_PROCFS_POWER is not set
+CONFIG_ACPI_PROC_EVENT=y
+# CONFIG_ACPI_SBS is not set
+CONFIG_ACPI_THERMAL=y
+# CONFIG_ACPI_WMI is not set
+# CONFIG_ACQUIRE_WDT is not set
+# CONFIG_ADVANTECH_WDT is not set
+# CONFIG_ALIM1535_WDT is not set
+CONFIG_AMD_NB=y
+CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
+CONFIG_ARCH_CLOCKSOURCE_DATA=y
+CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
+CONFIG_ARCH_DISCARD_MEMBLOCK=y
+CONFIG_ARCH_DMA_ADDR_T_64BIT=y
+CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
+CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
+CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
+CONFIG_ARCH_HAS_CPU_AUTOPROBE=y
+CONFIG_ARCH_HAS_CPU_RELAX=y
+CONFIG_ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS=y
+CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx -fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 -fcall-saved-r11"
+CONFIG_ARCH_MAY_HAVE_PC_FDC=y
+# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set
+CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
+# CONFIG_ARCH_RANDOM is not set
+CONFIG_ARCH_SELECT_MEMORY_MODEL=y
+CONFIG_ARCH_SPARSEMEM_DEFAULT=y
+CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
+CONFIG_ARCH_SUPPORTS_MEMORY_FAILURE=y
+CONFIG_ARCH_SUPPORTS_MSI=y
+CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y
+CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
+CONFIG_ARCH_SUPPORTS_UPROBES=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARCH_USES_PG_UNCACHED=y
+CONFIG_ARCH_USE_BUILTIN_BSWAP=y
+CONFIG_ARCH_WANTS_PROT_NUMA_PROT_NONE=y
+CONFIG_ARCH_WANT_FRAME_POINTERS=y
+CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
+# CONFIG_ASUS_LAPTOP is not set
+CONFIG_ATA=y
+# CONFIG_ATA_SFF is not set
+CONFIG_AUDIT_ARCH=y
+CONFIG_BINFMT_MISC=y
+CONFIG_BLK_DEV_SD=y
+CONFIG_BOUNCE=y
+CONFIG_CALGARY_IOMMU=y
+CONFIG_CALGARY_IOMMU_ENABLED_BY_DEFAULT=y
+CONFIG_CLKBLD_I8253=y
+CONFIG_CLKEVT_I8253=y
+CONFIG_CLOCKSOURCE_WATCHDOG=y
+CONFIG_CONSOLE_TRANSLATIONS=y
+# CONFIG_CPU5_WDT is not set
+CONFIG_CPU_FREQ=y
+# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
+CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
+# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
+# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
+# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
+# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set
+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
+# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
+# CONFIG_CPU_FREQ_GOV_USERSPACE is not set
+CONFIG_CPU_FREQ_STAT=y
+CONFIG_CPU_FREQ_STAT_DETAILS=y
+CONFIG_CPU_FREQ_TABLE=y
+CONFIG_CPU_IDLE=y
+CONFIG_CPU_IDLE_GOV_LADDER=y
+CONFIG_CPU_SUP_AMD=y
+CONFIG_CPU_SUP_CENTAUR=y
+CONFIG_CPU_SUP_INTEL=y
+CONFIG_CPU_THERMAL=y
+CONFIG_CRC16=y
+# CONFIG_CRYPTO_AES_X86_64 is not set
+# CONFIG_CRYPTO_BLOWFISH_X86_64 is not set
+# CONFIG_CRYPTO_CAMELLIA_AESNI_AVX2_X86_64 is not set
+# CONFIG_CRYPTO_CAMELLIA_AESNI_AVX_X86_64 is not set
+# CONFIG_CRYPTO_CAMELLIA_X86_64 is not set
+# CONFIG_CRYPTO_CAST5_AVX_X86_64 is not set
+# CONFIG_CRYPTO_CAST6_AVX_X86_64 is not set
+CONFIG_CRYPTO_CRC32C=y
+# CONFIG_CRYPTO_CRC32_PCLMUL is not set
+CONFIG_CRYPTO_HASH=y
+CONFIG_CRYPTO_HASH2=y
+# CONFIG_CRYPTO_SALSA20_X86_64 is not set
+# CONFIG_CRYPTO_SERPENT_AVX2_X86_64 is not set
+# CONFIG_CRYPTO_SERPENT_AVX_X86_64 is not set
+# CONFIG_CRYPTO_SERPENT_SSE2_X86_64 is not set
+# CONFIG_CRYPTO_SHA1_SSSE3 is not set
+# CONFIG_CRYPTO_SHA256_SSSE3 is not set
+# CONFIG_CRYPTO_SHA512_SSSE3 is not set
+# CONFIG_CRYPTO_TWOFISH_AVX_X86_64 is not set
+# CONFIG_CRYPTO_TWOFISH_X86_64 is not set
+# CONFIG_CRYPTO_TWOFISH_X86_64_3WAY is not set
+CONFIG_DCACHE_WORD_ACCESS=y
+# CONFIG_DCDBAS is not set
+# CONFIG_DEBUG_BOOT_PARAMS is not set
+CONFIG_DEBUG_MEMORY_INIT=y
+# CONFIG_DEBUG_NMI_SELFTEST is not set
+# CONFIG_DEBUG_TLBFLUSH is not set
+# CONFIG_DEBUG_VIRTUAL is not set
+CONFIG_DECOMPRESS_BZIP2=y
+CONFIG_DECOMPRESS_GZIP=y
+CONFIG_DEFAULT_IO_DELAY_TYPE=0
+# CONFIG_DELL_RBU is not set
+CONFIG_DIRECT_GBPAGES=y
+# CONFIG_DMI is not set
+CONFIG_DNOTIFY=y
+CONFIG_DUMMY_CONSOLE=y
+CONFIG_EARLY_PRINTK=y
+# CONFIG_EARLY_PRINTK_DBGP is not set
+# CONFIG_EDD is not set
+# CONFIG_EFI is not set
+# CONFIG_EUROTECH_WDT is not set
+CONFIG_EXT4_FS=y
+# CONFIG_F71808E_WDT is not set
+CONFIG_FB=y
+CONFIG_FB_MODE_HELPERS=y
+CONFIG_FB_TILEBLITTING=y
+# CONFIG_FB_VESA is not set
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_FIRMWARE_MEMMAP=y
+CONFIG_FIX_EARLYCON_MEM=y
+# CONFIG_FONTS is not set
+CONFIG_FONT_8x16=y
+CONFIG_FONT_8x8=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
+CONFIG_FS_MBCACHE=y
+CONFIG_GART_IOMMU=y
+CONFIG_GENERIC_BUG=y
+CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_GENERIC_CPU=y
+CONFIG_GENERIC_FIND_FIRST_BIT=y
+CONFIG_GENERIC_IO=y
+CONFIG_GENERIC_IOMAP=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_GENERIC_ISA_DMA=y
+CONFIG_GENERIC_PCI_IOMAP=y
+CONFIG_GENERIC_SMP_IDLE_THREAD=y
+CONFIG_GENERIC_STRNCPY_FROM_USER=y
+CONFIG_GENERIC_STRNLEN_USER=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+# CONFIG_GOOGLE_FIRMWARE is not set
+CONFIG_GPIO_DEVRES=y
+# CONFIG_HANGCHECK_TIMER is not set
+CONFIG_HAS_DMA=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
+CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y
+CONFIG_HAVE_ARCH_JUMP_LABEL=y
+CONFIG_HAVE_ARCH_KGDB=y
+CONFIG_HAVE_ARCH_KMEMCHECK=y
+CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
+CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y
+# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
+CONFIG_HAVE_BPF_JIT=y
+CONFIG_HAVE_CMPXCHG_DOUBLE=y
+CONFIG_HAVE_CMPXCHG_LOCAL=y
+CONFIG_HAVE_CONTEXT_TRACKING=y
+CONFIG_HAVE_C_RECORDMCOUNT=y
+CONFIG_HAVE_DEBUG_KMEMLEAK=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y
+CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
+CONFIG_HAVE_FENTRY=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
+# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
+CONFIG_HAVE_GENERIC_HARDIRQS=y
+CONFIG_HAVE_HW_BREAKPOINT=y
+CONFIG_HAVE_IDE=y
+CONFIG_HAVE_IOREMAP_PROT=y
+CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
+CONFIG_HAVE_KERNEL_BZIP2=y
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_LZO=y
+CONFIG_HAVE_KERNEL_XZ=y
+CONFIG_HAVE_KPROBES_ON_FTRACE=y
+CONFIG_HAVE_KVM=y
+CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_HAVE_MEMBLOCK=y
+CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
+CONFIG_HAVE_MEMORY_PRESENT=y
+CONFIG_HAVE_MIXED_BREAKPOINTS_REGS=y
+CONFIG_HAVE_MMIOTRACE_SUPPORT=y
+CONFIG_HAVE_NET_DSA=y
+CONFIG_HAVE_OPROFILE=y
+CONFIG_HAVE_OPTPROBES=y
+CONFIG_HAVE_PCSPKR_PLATFORM=y
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_HAVE_PERF_EVENTS_NMI=y
+CONFIG_HAVE_PERF_REGS=y
+CONFIG_HAVE_PERF_USER_STACK_DUMP=y
+CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
+CONFIG_HAVE_SETUP_PER_CPU_AREA=y
+CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
+CONFIG_HAVE_TEXT_POKE_SMP=y
+CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
+CONFIG_HAVE_USER_RETURN_NOTIFIER=y
+CONFIG_HID=y
+CONFIG_HID_BATTERY_STRENGTH=y
+# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_HPET=y
+CONFIG_HPET_EMULATE_RTC=y
+CONFIG_HPET_MMAP=y
+CONFIG_HPET_TIMER=y
+# CONFIG_HP_ACCEL is not set
+# CONFIG_HP_WATCHDOG is not set
+CONFIG_HT_IRQ=y
+# CONFIG_HUGETLBFS is not set
+CONFIG_HW_CONSOLE=y
+CONFIG_HW_RANDOM=y
+CONFIG_HW_RANDOM_INTEL=y
+# CONFIG_HYPERVISOR_GUEST is not set
+CONFIG_HZ_PERIODIC=y
+# CONFIG_I7300_IDLE is not set
+CONFIG_I8253_LOCK=y
+# CONFIG_I8K is not set
+# CONFIG_IA32_EMULATION is not set
+# CONFIG_IB700_WDT is not set
+# CONFIG_IBMASR is not set
+# CONFIG_IBM_RTL is not set
+# CONFIG_IE6XX_WDT is not set
+CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_INPUT=y
+CONFIG_INPUT_KEYBOARD=y
+CONFIG_INSTRUCTION_DECODER=y
+# CONFIG_INTEL_IPS is not set
+# CONFIG_INTEL_MENLOW is not set
+# CONFIG_INTEL_POWERCLAMP is not set
+# CONFIG_IOMMU_DEBUG is not set
+CONFIG_IOMMU_HELPER=y
+# CONFIG_IOMMU_STRESS is not set
+CONFIG_IO_DELAY_0X80=y
+# CONFIG_IO_DELAY_0XED is not set
+# CONFIG_IO_DELAY_NONE is not set
+CONFIG_IO_DELAY_TYPE_0X80=0
+CONFIG_IO_DELAY_TYPE_0XED=1
+CONFIG_IO_DELAY_TYPE_NONE=3
+CONFIG_IO_DELAY_TYPE_UDELAY=2
+# CONFIG_IO_DELAY_UDELAY is not set
+CONFIG_IRQ_DOMAIN=y
+CONFIG_IRQ_FORCED_THREADING=y
+CONFIG_IRQ_WORK=y
+CONFIG_ISA_DMA_API=y
+# CONFIG_ISCSI_IBFT_FIND is not set
+# CONFIG_IT8712F_WDT is not set
+# CONFIG_IT87_WDT is not set
+# CONFIG_ITCO_VENDOR_SUPPORT is not set
+CONFIG_ITCO_WDT=y
+CONFIG_JBD2=y
+CONFIG_KALLSYMS=y
+CONFIG_KEXEC=y
+CONFIG_KEYBOARD_ATKBD=y
+CONFIG_LPC_ICH=y
+# CONFIG_MACHZ_WDT is not set
+# CONFIG_MATOM is not set
+# CONFIG_MCORE2 is not set
+# CONFIG_MEMORY_HOTPLUG is not set
+# CONFIG_MEMTEST is not set
+CONFIG_MFD_CORE=y
+# CONFIG_MICROCODE is not set
+# CONFIG_MK8 is not set
+CONFIG_MODULES_USE_ELF_RELA=y
+# CONFIG_MPSC is not set
+# CONFIG_MTD is not set
+CONFIG_MTRR=y
+# CONFIG_MTRR_SANITIZER is not set
+CONFIG_NAMESPACES=y
+CONFIG_NEED_DMA_MAP_STATE=y
+CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
+CONFIG_NEED_PER_CPU_KM=y
+CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
+CONFIG_NEED_SG_DMA_LENGTH=y
+# CONFIG_NET_NS is not set
+CONFIG_NLS=y
+CONFIG_NO_BOOTMEM=y
+CONFIG_NR_CPUS=1
+# CONFIG_NTB is not set
+CONFIG_NVRAM=y
+CONFIG_OPROFILE_NMI_TIMER=y
+# CONFIG_OPTIMIZE_INLINING is not set
+CONFIG_OUTPUT_FORMAT="elf64-x86-64"
+CONFIG_PAGEFLAGS_EXTENDED=y
+# CONFIG_PC87413_WDT is not set
+CONFIG_PCI=y
+CONFIG_PCI_DIRECT=y
+CONFIG_PCI_DOMAINS=y
+# CONFIG_PCI_IOAPIC is not set
+CONFIG_PCI_LABEL=y
+# CONFIG_PCI_MMCONFIG is not set
+CONFIG_PCI_MSI=y
+CONFIG_PCSPKR_PLATFORM=y
+CONFIG_PERF_EVENTS=y
+CONFIG_PHYSICAL_ALIGN=0x1000000
+CONFIG_PHYSICAL_START=0x1000000
+CONFIG_PHYS_ADDR_T_64BIT=y
+CONFIG_PNP=y
+CONFIG_PNPACPI=y
+CONFIG_PNP_DEBUG_MESSAGES=y
+CONFIG_POWER_SUPPLY=y
+# CONFIG_PREEMPT_RCU is not set
+# CONFIG_PROCESSOR_SELECT is not set
+CONFIG_PROC_PAGE_MONITOR=y
+# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set
+# CONFIG_PVPANIC is not set
+# CONFIG_RCU_STALL_COMMON is not set
+CONFIG_RD_BZIP2=y
+CONFIG_RD_GZIP=y
+# CONFIG_RELOCATABLE is not set
+CONFIG_RTC_CLASS=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+# CONFIG_SAMSUNG_Q10 is not set
+CONFIG_SATA_AHCI=y
+# CONFIG_SBC8360_WDT is not set
+# CONFIG_SBC_EPX_C3_WATCHDOG is not set
+# CONFIG_SC1200_WDT is not set
+# CONFIG_SC520_WDT is not set
+# CONFIG_SCHED_HRTICK is not set
+CONFIG_SCSI=y
+CONFIG_SERIAL_8250_PCI=y
+CONFIG_SERIAL_8250_PNP=y
+CONFIG_SERIO=y
+# CONFIG_SERIO_CT82C710 is not set
+CONFIG_SERIO_I8042=y
+CONFIG_SERIO_LIBPS2=y
+CONFIG_SERIO_SERPORT=y
+# CONFIG_SLAB is not set
+CONFIG_SLUB=y
+CONFIG_SLUB_DEBUG=y
+# CONFIG_SLUB_DEBUG_ON is not set
+# CONFIG_SMSC37B787_WDT is not set
+# CONFIG_SMSC_SCH311X_WDT is not set
+CONFIG_SPARSEMEM=y
+CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER=y
+CONFIG_SPARSEMEM_EXTREME=y
+CONFIG_SPARSEMEM_MANUAL=y
+# CONFIG_SPARSEMEM_VMEMMAP is not set
+CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
+CONFIG_SPARSE_IRQ=y
+# CONFIG_SQUASHFS is not set
+CONFIG_STRICT_DEVMEM=y
+CONFIG_SWIOTLB=y
+CONFIG_SYSCTL_EXCEPTION_TRACE=y
+# CONFIG_TELCLOCK is not set
+CONFIG_THERMAL=y
+# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set
+CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y
+# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set
+# CONFIG_THERMAL_EMULATION is not set
+# CONFIG_THERMAL_GOV_FAIR_SHARE is not set
+CONFIG_THERMAL_GOV_STEP_WISE=y
+# CONFIG_THERMAL_GOV_USER_SPACE is not set
+# CONFIG_THINKPAD_ACPI is not set
+CONFIG_TICK_CPU_ACCOUNTING=y
+# CONFIG_TOPSTAR_LAPTOP is not set
+# CONFIG_TOSHIBA_BT_RFKILL is not set
+CONFIG_UIDGID_CONVERTED=y
+CONFIG_USB_ARCH_HAS_XHCI=y
+CONFIG_USB_SUPPORT=y
+# CONFIG_USER_NS is not set
+CONFIG_USER_STACKTRACE_SUPPORT=y
+CONFIG_VGACON_SOFT_SCROLLBACK=y
+CONFIG_VGACON_SOFT_SCROLLBACK_SIZE=64
+CONFIG_VGA_CONSOLE=y
+# CONFIG_VIA_WDT is not set
+# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set
+# CONFIG_VMWARE_VMCI is not set
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_VT=y
+CONFIG_VT_CONSOLE=y
+# CONFIG_VT_HW_CONSOLE_BINDING is not set
+# CONFIG_W83697UG_WDT is not set
+# CONFIG_WAFER_WDT is not set
+CONFIG_WATCHDOG_CORE=y
+CONFIG_X86=y
+CONFIG_X86_64=y
+# CONFIG_X86_ACPI_CPUFREQ is not set
+# CONFIG_X86_CHECK_BIOS_CORRUPTION is not set
+CONFIG_X86_CMOV=y
+CONFIG_X86_CMPXCHG64=y
+# CONFIG_X86_CPUID is not set
+CONFIG_X86_DEBUGCTLMSR=y
+CONFIG_X86_DEV_DMA_OPS=y
+# CONFIG_X86_EXTENDED_PLATFORM is not set
+# CONFIG_X86_INTEL_LPSS is not set
+# CONFIG_X86_INTEL_PSTATE is not set
+CONFIG_X86_INTERNODE_CACHE_SHIFT=6
+CONFIG_X86_IO_APIC=y
+CONFIG_X86_L1_CACHE_SHIFT=6
+CONFIG_X86_LOCAL_APIC=y
+CONFIG_X86_MCE=y
+CONFIG_X86_MCE_AMD=y
+# CONFIG_X86_MCE_INJECT is not set
+CONFIG_X86_MCE_INTEL=y
+CONFIG_X86_MCE_THRESHOLD=y
+CONFIG_X86_MINIMUM_CPU_FAMILY=64
+CONFIG_X86_MPPARSE=y
+# CONFIG_X86_MSR is not set
+# CONFIG_X86_P4_CLOCKMOD is not set
+CONFIG_X86_PAT=y
+# CONFIG_X86_PCC_CPUFREQ is not set
+CONFIG_X86_PLATFORM_DEVICES=y
+CONFIG_X86_PM_TIMER=y
+# CONFIG_X86_PTDUMP is not set
+CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS=y
+CONFIG_X86_RESERVE_LOW=64
+# CONFIG_X86_SMAP is not set
+# CONFIG_X86_SPEEDSTEP_CENTRINO is not set
+# CONFIG_X86_SPEEDSTEP_LIB is not set
+CONFIG_X86_SUPPORTS_MEMORY_FAILURE=y
+CONFIG_X86_THERMAL_VECTOR=y
+CONFIG_X86_TSC=y
+CONFIG_X86_VERBOSE_BOOTUP=y
+# CONFIG_XO15_EBOOK is not set
+CONFIG_XZ_DEC_BCJ=y
+CONFIG_XZ_DEC_X86=y
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZONE_DMA32=y
diff --git a/target/linux/x86_64/image/Makefile b/target/linux/x86_64/image/Makefile
new file mode 100644
index 0000000000..fad6d2d383
--- /dev/null
+++ b/target/linux/x86_64/image/Makefile
@@ -0,0 +1,210 @@
+#
+# Copyright (C) 2006-2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+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_64_$(subtarget)))),)
+ GRUB2_MODULES += at_keyboard
+ GRUB2_MODULES_ISO += at_keyboard
+endif
+
+ifneq ($(CONFIG_GRUB_CONSOLE),)
+ GRUB_CONSOLE_CMDLINE += console=tty0
+ GRUB_TERMINALS += console
+endif
+
+GRUB_SERIAL:=$(call qstrip,$(CONFIG_GRUB_SERIAL))
+
+ifneq ($(GRUB_SERIAL),)
+ GRUB_CONSOLE_CMDLINE += console=$(GRUB_SERIAL),$(CONFIG_GRUB_BAUDRATE)n8
+ GRUB_SERIAL_CONFIG := serial --unit=0 --speed=$(CONFIG_GRUB_BAUDRATE) --word=8 --parity=no --stop=1
+ GRUB_TERMINALS += serial
+endif
+
+ifneq ($(GRUB_TERMINALS),)
+ GRUB_TERMINAL_CONFIG := terminal_input $(GRUB_TERMINALS); terminal_output $(GRUB_TERMINALS)
+endif
+
+ROOTPART:=$(call qstrip,$(CONFIG_TARGET_ROOTFS_PARTNAME))
+
+GRUB_TIMEOUT:=$(call qstrip,$(CONFIG_GRUB_TIMEOUT))
+
+ifneq ($(CONFIG_GRUB_IMAGES),)
+
+ BOOTOPTS:=$(call qstrip,$(CONFIG_GRUB_BOOTOPTS))
+
+ 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
+
+ define Image/cmdline/jffs2-128k
+ block2mtd.block2mtd=$(ROOTPART),131072,rootfs root=/dev/mtdblock0 rootfstype=jffs2 rootwait
+ endef
+
+ define Image/cmdline/squashfs
+ block2mtd.block2mtd=$(ROOTPART),65536,rootfs root=/dev/mtdblock0 rootfstype=squashfs rootwait
+ endef
+
+ define Image/Build/grub2
+ # left here because the image builder doesnt need these
+ $(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' \
+ ./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) \
+ 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
+endif
+
+ROOTDELAY=10
+
+define Image/Build/squashfs
+ $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
+endef
+
+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@#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_VDI_IMAGES),)
+ define Image/Build/vdi
+ # left here because the image builder doesnt need these
+ ifeq ($(1),ext4)
+ rm $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).vdi || true
+ qemu-img convert -f raw -O vdi \
+ $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).img \
+ $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).vdi
+ # XXX: VBoxManage insists on setting perms to 0600
+ chmod 0644 $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).vdi
+ endif
+ endef
+endif
+
+ifneq ($(CONFIG_VMDK_IMAGES),)
+ define Image/Build/vmdk
+ # left here because the image builder doesnt need these
+ ifeq ($(1),ext4)
+ rm $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).vmdk || true
+ qemu-img convert -f raw -O vmdk \
+ $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).img \
+ $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).vmdk
+ endif
+ endef
+endif
+
+define Image/Build/gzip
+ gzip -f9 $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).img
+ gzip -f9 $(BIN_DIR)/$(IMG_PREFIX)-rootfs-$(1).img
+endef
+
+ifneq ($(CONFIG_TARGET_IMAGES_GZIP),)
+ define Image/Build/gzip/ext4
+ $(call Image/Build/gzip,ext4)
+ endef
+ ifneq ($(CONFIG_TARGET_IMAGES_PAD),)
+ define Image/Build/gzip/squashfs
+ $(call Image/Build/gzip,squashfs)
+ endef
+ define Image/Build/gzip/jffs2-64k
+ $(call Image/Build/gzip,jffs2-64k)
+ endef
+ define Image/Build/gzip/jffs2-128k
+ $(call Image/Build/gzip,jffs2-128k)
+ endef
+ endif
+endif
+
+define Image/BuildKernel
+ $(CP) $(KDIR)/bzImage $(BIN_DIR)/$(IMG_PREFIX)-vmlinuz
+endef
+
+define Image/Prepare
+ $(CP) $(LINUX_DIR)/arch/x86/boot/bzImage $(KDIR)/bzImage
+ $(call Image/Prepare/bootscript)
+ $(call Image/Prepare/grub2)
+endef
+
+define Image/Build/Initramfs
+ $(CP) $(KDIR)/bzImage-initramfs $(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/grub2,$(1))
+ $(call Image/Build/vdi,$(1))
+ $(call Image/Build/vmdk,$(1))
+ $(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_64/image/gen_image_generic.sh b/target/linux/x86_64/image/gen_image_generic.sh
new file mode 100755
index 0000000000..9d11efbb05
--- /dev/null
+++ b/target/linux/x86_64/image/gen_image_generic.sh
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+# 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
+}
+
+OUTPUT="$1"
+KERNELSIZE="$2"
+KERNELDIR="$3"
+ROOTFSSIZE="$4"
+ROOTFSIMAGE="$5"
+ALIGN="$6"
+
+rm -f "$OUTPUT"
+
+head=16
+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 ${ALIGN:+-l $ALIGN}`
+
+KERNELOFFSET="$(($1 / 512))"
+KERNELSIZE="$(($2 / 512))"
+ROOTFSOFFSET="$(($3 / 512))"
+ROOTFSSIZE="$(($4 / 512))"
+
+BLOCKS="$((($KERNELSIZE / 2) - 1))"
+
+[ -n "$PADDING" ] && dd if=/dev/zero of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc count="$ROOTFSSIZE"
+dd if="$ROOTFSIMAGE" of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc
+
+[ -n "$NOGRUB" ] && exit 0
+
+genext2fs -d "$KERNELDIR" -b "$BLOCKS" "$OUTPUT.kernel"
+dd if="$OUTPUT.kernel" of="$OUTPUT" bs=512 seek="$KERNELOFFSET" conv=notrunc
+rm -f "$OUTPUT.kernel"
diff --git a/target/linux/x86_64/image/grub-early.cfg b/target/linux/x86_64/image/grub-early.cfg
new file mode 100644
index 0000000000..4a5b5a6092
--- /dev/null
+++ b/target/linux/x86_64/image/grub-early.cfg
@@ -0,0 +1 @@
+configfile (hd0,msdos1)/boot/grub/grub.cfg
diff --git a/target/linux/x86_64/image/grub-iso.cfg b/target/linux/x86_64/image/grub-iso.cfg
new file mode 100644
index 0000000000..3d47a95a4b
--- /dev/null
+++ b/target/linux/x86_64/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_64/image/grub.cfg b/target/linux/x86_64/image/grub.cfg
new file mode 100644
index 0000000000..33b9d0b1aa
--- /dev/null
+++ b/target/linux/x86_64/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_64/patches/011-tune_lzma_options.patch b/target/linux/x86_64/patches/011-tune_lzma_options.patch
new file mode 100644
index 0000000000..1421f7c8fa
--- /dev/null
+++ b/target/linux/x86_64/patches/011-tune_lzma_options.patch
@@ -0,0 +1,22 @@
+--- a/scripts/Makefile.lib
++++ b/scripts/Makefile.lib
+@@ -303,7 +303,7 @@ cmd_bzip2 = (cat $(filter-out FORCE,$^)
+
+ quiet_cmd_lzma = LZMA $@
+ cmd_lzma = (cat $(filter-out FORCE,$^) | \
+- lzma e -d20 -lc1 -lp2 -pb2 -eos -si -so && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
++ lzma e -lc8 -eos -si -so && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
+ (rm -f $@ ; false)
+
+ quiet_cmd_lzo = LZO $@
+--- a/arch/x86/include/asm/boot.h
++++ b/arch/x86/include/asm/boot.h
+@@ -23,7 +23,7 @@
+ #error "Invalid value for CONFIG_PHYSICAL_ALIGN"
+ #endif
+
+-#ifdef CONFIG_KERNEL_BZIP2
++#if defined(CONFIG_KERNEL_BZIP2) || defined(CONFIG_KERNEL_LZMA)
+ #define BOOT_HEAP_SIZE 0x400000
+ #else /* !CONFIG_KERNEL_BZIP2 */
+
diff --git a/target/linux/x86_64/patches/012-export_erase_write.patch b/target/linux/x86_64/patches/012-export_erase_write.patch
new file mode 100644
index 0000000000..d3ec5caf14
--- /dev/null
+++ b/target/linux/x86_64/patches/012-export_erase_write.patch
@@ -0,0 +1,23 @@
+--- a/drivers/mtd/mtdblock.c
++++ b/drivers/mtd/mtdblock.c
+@@ -62,7 +62,7 @@ static void erase_callback(struct erase_
+ wake_up(wait_q);
+ }
+
+-static int erase_write (struct mtd_info *mtd, unsigned long pos,
++int erase_write (struct mtd_info *mtd, unsigned long pos,
+ int len, const char *buf)
+ {
+ struct erase_info erase;
+--- a/include/linux/mtd/mtd.h
++++ b/include/linux/mtd/mtd.h
+@@ -409,6 +409,9 @@ extern void register_mtd_user (struct mt
+ extern int unregister_mtd_user (struct mtd_notifier *old);
+ void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size);
+
++int erase_write (struct mtd_info *mtd, unsigned long pos,
++ int len, const char *buf);
++
+ void mtd_erase_callback(struct erase_info *instr);
+
+ static inline int mtd_is_bitflip(int err) {