 +#wifi_mode=ap
 +# wifi channel, only used in AP mode
 +#wifi_channel=6
-Index: target/linux/brcm2708/image/gen_rpi_sdcard_img.sh
-===================================================================
---- target/linux/brcm2708/image/gen_rpi_sdcard_img.sh	(revision 36720)
-+++ target/linux/brcm2708/image/gen_rpi_sdcard_img.sh	(working copy)
-@@ -12,7 +12,7 @@
- BOOTFSSIZE="$4"
- ROOTFSSIZE="$5"
- 
--head=4
-+head=255
- sect=63
- 
- set `ptgen -o $OUTPUT -h $head -s $sect -l 4096 -t c -p ${BOOTFSSIZE}M -t 83 -p ${ROOTFSSIZE}M`
++
++hdmi_cvt=1024 600 60 5
++hdmi_blanking=1
++

+	umount /dev/mmcblk0p1
+	umount /dev/mmcblk0p4
+	umount /sys/kernel/debug
+}
+
+append sysupgrade_pre_upgrade bcm2708_umount_all
+
Index: target/linux/brcm2708/config-3.3
===================================================================
--- target/linux/brcm2708/config-3.3	(revision 36720)
+++ target/linux/brcm2708/config-3.3	(working copy)
@@ -3,6 +3,7 @@
 # CONFIG_APM_EMULATION is not set
 CONFIG_ARCH_BCM2708=y
 CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
+CONFIG_ARCH_HAS_CPUFREQ=y
 CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
 CONFIG_ARCH_NR_GPIO=0
 CONFIG_ARCH_REQUIRE_GPIOLIB=y
@@ -12,10 +13,12 @@
 # CONFIG_ARCH_USES_GETTIMEOFFSET is not set
 CONFIG_ARM=y
 CONFIG_ARM_AMBA=y
+CONFIG_ARM_BCM2835_CPUFREQ=y
 CONFIG_ARM_CPU_SUSPEND=y
 # CONFIG_ARM_ERRATA_326103 is not set
 # CONFIG_ARM_ERRATA_364296 is not set
 CONFIG_ARM_ERRATA_411920=y
+# CONFIG_ARM_EXYNOS4210_CPUFREQ is not set
 CONFIG_ARM_L1_CACHE_SHIFT=5
 CONFIG_ARM_NR_BANKS=8
 # CONFIG_ARM_SP805_WATCHDOG is not set
@@ -22,11 +25,6 @@
 CONFIG_ARM_THUMB=y
 CONFIG_ARM_UNWIND=y
 CONFIG_AVERAGE=y
-# CONFIG_BACKLIGHT_ADP8860 is not set
-# CONFIG_BACKLIGHT_ADP8870 is not set
-CONFIG_BACKLIGHT_CLASS_DEVICE=m
-CONFIG_BACKLIGHT_GENERIC=m
-CONFIG_BACKLIGHT_LCD_SUPPORT=y
 CONFIG_BCM2708_GPIO=y
 # CONFIG_BCM2708_NOL2CACHE is not set
 CONFIG_BCM2708_VCHIQ=y
@@ -41,8 +39,10 @@
 CONFIG_BLK_DEV_SD=y
 # CONFIG_CACHE_L2X0 is not set
 CONFIG_CLKDEV_LOOKUP=y
+CONFIG_CLKSRC_MMIO=y
 CONFIG_CMDLINE="dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext3 rootwait"
 CONFIG_CMDLINE_FROM_BOOTLOADER=y
+CONFIG_COMPACTION=y
 CONFIG_CONFIGFS_FS=y
 CONFIG_CONSOLE_TRANSLATIONS=y
 CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
@@ -54,12 +54,22 @@
 CONFIG_CPU_COPY_V6=y
 CONFIG_CPU_CP15=y
 CONFIG_CPU_CP15_MMU=y
+CONFIG_CPU_FREQ=y
+# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
+CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
+# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
+# 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=y
+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
+CONFIG_CPU_FREQ_GOV_POWERSAVE=y
+# CONFIG_CPU_FREQ_GOV_USERSPACE is not set
+# CONFIG_CPU_FREQ_STAT is not set
+CONFIG_CPU_FREQ_TABLE=y
 CONFIG_CPU_HAS_ASID=y
 CONFIG_CPU_HAS_PMU=y
 # CONFIG_CPU_ICACHE_DISABLE is not set
-CONFIG_CPU_IDLE=y
-CONFIG_CPU_IDLE_GOV_LADDER=y
-CONFIG_CPU_IDLE_GOV_MENU=y
 CONFIG_CPU_PABRT_V6=y
 CONFIG_CPU_PM=y
 CONFIG_CPU_TLB_V6=y
@@ -86,6 +96,7 @@
 CONFIG_FB_CFB_FILLRECT=y
 CONFIG_FB_CFB_IMAGEBLIT=y
 # CONFIG_FB_WMT_GE_ROPS is not set
+CONFIG_FIQ=y
 CONFIG_FIRMWARE_IN_KERNEL=y
 # CONFIG_FONTS is not set
 CONFIG_FONT_8x16=y
@@ -137,8 +148,12 @@
 CONFIG_HAVE_PERF_EVENTS=y
 CONFIG_HAVE_PROC_CPU=y
 CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
+CONFIG_HAVE_SCHED_CLOCK=y
 CONFIG_HAVE_SPARSE_IRQ=y
 CONFIG_HW_CONSOLE=y
+CONFIG_I2C=m
+# CONFIG_I2C_BCM2708 is not set
+CONFIG_I2C_BOARDINFO=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_INPUT=y
@@ -151,16 +166,6 @@
 CONFIG_KERNEL_GZIP=y
 # CONFIG_KERNEL_XZ is not set
 CONFIG_KTIME_SCALAR=y
-CONFIG_LCD_CLASS_DEVICE=m
-# CONFIG_LCD_AMS369FG06 is not set
-# CONFIG_LCD_L4F00242T03 is not set
-# CONFIG_LCD_LD9040 is not set
-# CONFIG_LCD_LMS283GF05 is not set
-# CONFIG_LCD_LTV350QV is not set
-# CONFIG_LCD_PLATFORM is not set
-# CONFIG_LCD_S6E63M0 is not set
-# CONFIG_LCD_TDO24M is not set
-# CONFIG_LCD_VGG2432A4 is not set
 CONFIG_LEDS_GPIO=y
 # CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set
 # CONFIG_LEDS_TRIGGER_TIMER is not set
@@ -168,12 +173,12 @@
 CONFIG_LOGO_LINUX_CLUT224=y
 # CONFIG_LOGO_LINUX_MONO is not set
 # CONFIG_LOGO_LINUX_VGA16 is not set
-CONFIG_LOG_BUF_SHIFT=17
 CONFIG_MACH_BCM2708=y
 CONFIG_MAC_PARTITION=y
 CONFIG_MAGIC_SYSRQ=y
 CONFIG_MAX_RAW_DEVS=256
 # CONFIG_MFD_T7L66XB is not set
+CONFIG_MIGRATION=y
 CONFIG_MMC=y
 # CONFIG_MMC_BCM2708 is not set
 CONFIG_MMC_BLOCK=y
@@ -199,6 +204,7 @@
 CONFIG_PM=y
 CONFIG_PM_CLK=y
 # CONFIG_PM_DEBUG is not set
+CONFIG_PM_RUNTIME=y
 CONFIG_PM_SLEEP=y
 CONFIG_POWER_SUPPLY=y
 # CONFIG_PREEMPT_RCU is not set
@@ -212,6 +218,8 @@
 # CONFIG_SERIAL_AMBA_PL010 is not set
 CONFIG_SERIAL_AMBA_PL011=y
 CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
+# CONFIG_SLAB is not set
+CONFIG_SLUB=y
 # CONFIG_SQUASHFS is not set
 # CONFIG_STAGING is not set
 # CONFIG_STRIP_ASM_SYMS is not set
@@ -219,6 +227,8 @@
 CONFIG_SUSPEND_FREEZER=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
 # CONFIG_TEXTSEARCH is not set
+CONFIG_THERMAL=y
+CONFIG_THERMAL_BCM2835=y
 CONFIG_TMPFS_POSIX_ACL=y
 CONFIG_UEVENT_HELPER_PATH=""
 # CONFIG_UID16 is not set
Index: target/linux/brcm2708/image/Makefile
===================================================================
--- target/linux/brcm2708/image/Makefile	(revision 36720)
+++ target/linux/brcm2708/image/Makefile	(working copy)
@@ -20,27 +20,22 @@
 
 	mkdosfs $(KDIR)/boot.img -C $(FAT32_BLOCKS)
 	# Raspberry Pi has no bootloader, instead the GPU loads and starts the kernel
-	mcopy -i $(KDIR)/boot.img $(BUILD_DIR)/brcm2708-gpu-fw-boot/arm128_start.elf ::
-	mcopy -i $(KDIR)/boot.img $(BUILD_DIR)/brcm2708-gpu-fw-boot/arm192_start.elf ::
-	mcopy -i $(KDIR)/boot.img $(BUILD_DIR)/brcm2708-gpu-fw-boot/arm224_start.elf ::
 	mcopy -i $(KDIR)/boot.img $(BUILD_DIR)/brcm2708-gpu-fw-boot/bootcode.bin ::
-	mcopy -i $(KDIR)/boot.img $(BUILD_DIR)/brcm2708-gpu-fw-boot/COPYING.linux ::
-	mcopy -i $(KDIR)/boot.img $(BUILD_DIR)/brcm2708-gpu-fw-boot/LICENCE.broadcom ::
-	mcopy -i $(KDIR)/boot.img $(BUILD_DIR)/brcm2708-gpu-fw-boot/loader.bin ::
-	mcopy -i $(KDIR)/boot.img $(BUILD_DIR)/brcm2708-gpu-fw-boot/arm$(2)_start.elf ::start.elf  #Copy file for memory/gpu division
+	mcopy -i $(KDIR)/boot.img $(BUILD_DIR)/brcm2708-gpu-fw-boot/start.elf ::
+	mcopy -i $(KDIR)/boot.img $(BUILD_DIR)/brcm2708-gpu-fw-boot/start_cd.elf ::
+	mcopy -i $(KDIR)/boot.img $(BUILD_DIR)/brcm2708-gpu-fw-boot/fixup.dat ::
+	mcopy -i $(KDIR)/boot.img $(BUILD_DIR)/brcm2708-gpu-fw-boot/fixup_cd.dat ::
+	mcopy -i $(KDIR)/boot.img config.txt ::
 	mcopy -i $(KDIR)/boot.img cmdline.txt ::
 	mcopy -i $(KDIR)/boot.img $(KDIR)/Image ::kernel.img  # Copy OpenWrt built kernel
-	./gen_rpi_sdcard_img.sh $(BIN_DIR)/$(IMG_PREFIX)-sdcard-vfat-$(1)_$(2).img $(KDIR)/boot.img $(KDIR)/root.$(1) \
+	./gen_rpi_sdcard_img.sh $(BIN_DIR)/$(IMG_PREFIX)-sdcard-vfat-$(1).img $(KDIR)/boot.img $(KDIR)/root.$(1) \
 		$(CONFIG_BRCM2708_SD_BOOT_PARTSIZE) $(CONFIG_TARGET_ROOTFS_PARTSIZE)
 endef
 
 define Image/Build
 	$(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).img
-	$(CP) $(KDIR)/Image $(BIN_DIR)/$(IMG_PREFIX)-Image
 
-	$(call Image/Build/RaspberryPi,$(1),128)
-	$(call Image/Build/RaspberryPi,$(1),192)
-	$(call Image/Build/RaspberryPi,$(1),224)
+	$(call Image/Build/RaspberryPi,$(1))
 endef
 
 $(eval $(call BuildImage))
Index: target/linux/brcm2708/image/cmdline.txt
===================================================================
--- target/linux/brcm2708/image/cmdline.txt	(revision 36720)
+++ target/linux/brcm2708/image/cmdline.txt	(working copy)
@@ -1 +1 @@
-dwc_otg.lpm_enable=0 rpitestmode=1 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
+dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
Index: target/linux/brcm2708/image/config.txt
===================================================================
--- target/linux/brcm2708/image/config.txt	(revision 0)
+++ target/linux/brcm2708/image/config.txt	(working copy)
@@ -0,0 +1,19 @@
+gpu_mem=32
+arm_freq=800
+arm_freq_min=700
+sdram_freq=400
+core_freq=250
+
+##

+	  mount -t ext4 -o remount,rw,noatime /dev/mmcblk0p2 /mnt && \
+	  cp -af "$CONF_TAR" /mnt/ && \
+	  umount /mnt
 }
 
 platform_do_upgrade() {
 	sync
-	get_image "$1" | dd of=/dev/mmcblk0 bs=2M conv=fsync
+	# If not saving the configuration, wipe the config partition
+	[ $SAVE_CONFIG -eq 0 -a -b /dev/mmcblk0p4 ] && {
+		# Should do mkfs.ext4 here but isn't on ramdisk
+		  dd if=/dev/zero of=/dev/mmcblk0p4 bs=1M count=1 conv=fsync
+	}
+	dd if=/dev/zero of=/dev/mmcblk0 bs=4M count=10 conv=fsync
+	get_image "$@" | dd of=/dev/mmcblk0 bs=4M conv=fsync
 	sleep 1
 }
 
-platform_copy_config() {
-	mkdir -p /boot
-	[ -f /boot/kernel.img ] || mount -t vfat -o rw,noatime /dev/mmcblk0p1 /boot
-	cp -af "$CONF_TAR" /boot/
-	sync
-	umount /boot
+bcm2708_umount_all() {
+	cd /tmp
+	echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
