Browse Source

imx6: extend cubox support to hummingboard, add support for building full images

Signed-off-by: Felix Fietkau <[email protected]>
Felix Fietkau 7 years ago
parent
commit
ded905ce43

+ 1 - 1
target/linux/imx6/Makefile

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 ARCH:=arm
 BOARD:=imx6
 BOARDNAME:=Freescale i.MX 6
-FEATURES:=audio display fpu gpio pcie rtc usb usbgadget squashfs targz nand ubifs
+FEATURES:=audio display fpu gpio pcie rtc usb usbgadget squashfs targz nand ubifs boot-part rootfs-part
 CPU_TYPE:=cortex-a9
 CPU_SUBTYPE:=neon
 MAINTAINER:=Luka Perkov <[email protected]>

+ 41 - 4
target/linux/imx6/image/Makefile

@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/image.mk
 # Images
 #################################################
 
-DEVICE_VARS += MKUBIFS_OPTS
+DEVICE_VARS += MKUBIFS_OPTS UBOOT BOOT_SCRIPT
 
 define Build/boot-overlay
 	rm -rf [email protected]
@@ -58,6 +58,38 @@ define Build/boot-scr
 	$(BIN_DIR)/boot.scr
 endef
 
+define Build/imx6-sdcard
+	rm -rf [email protected]
+	mkdir -p [email protected]
+
+	$(CP) $(STAGING_DIR_IMAGE)/$(UBOOT)-u-boot.img [email protected]/u-boot.img
+	$(CP) $(IMAGE_KERNEL) [email protected]/uImage
+
+	$(foreach dts,$(DEVICE_DTS), \
+		$(CP) \
+			$(DTS_DIR)/$(dts).dtb \
+			[email protected]/;
+	)
+
+	mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
+		-n '$(DEVICE_ID) OpenWrt bootscript' \
+		-d $(BOOT_SCRIPT) \
+		[email protected]/boot.scr
+
+	cp $@ [email protected]
+
+	$(SCRIPT_DIR)/gen_image_generic.sh $@ \
+		$(CONFIG_TARGET_KERNEL_PARTSIZE) \
+		[email protected] \
+		$(CONFIG_TARGET_ROOTFS_PARTSIZE) \
+		[email protected] \
+		1024
+
+	dd if=$(STAGING_DIR_IMAGE)/$(UBOOT)-SPL of=$@ bs=1024 seek=1 conv=notrunc
+
+	rm -rf [email protected] [email protected]
+endef
+
 #################################################
 # Devices
 #################################################
@@ -72,7 +104,6 @@ define Device/Default
   KERNEL_NAME := zImage
   KERNEL_PREFIX := $$(IMAGE_PREFIX)
   KERNEL := kernel-bin | uImage none
-  IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2)
   IMAGES :=
 endef
 
@@ -103,6 +134,7 @@ define Device/ventana
 	kobs-ng
   KERNEL += | boot-overlay
   IMAGES := nand.ubi bootfs.tar.gz
+  IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2)
   UBINIZE_PARTS = boot=$$(KDIR_KERNEL_IMAGE).boot.ubifs=15
   IMAGE/nand.ubi := append-ubi
   IMAGE/bootfs.tar.gz := bootfs.tar.gz | install-dtb
@@ -131,11 +163,16 @@ endef
 TARGET_DEVICES += wandboard
 
 define Device/cubox-i
-  KERNEL := kernel-bin | install-dtb | boot-scr
+  KERNEL := kernel-bin | install-dtb
+  UBOOT := mx6cuboxi
+  BOOT_SCRIPT = bootscript-cubox
   DEVICE_NAME := cubox
   DEVICE_TITLE := SolidRun CuBox-i
   DEVICE_PACKAGES := u-boot-mx6cuboxi kmod-drm-imx kmod-drm-imx-hdmi kmod-usb-hid
-  DEVICE_DTS := imx6q-cubox-i imx6dl-cubox-i
+  DEVICE_DTS := imx6q-cubox-i imx6dl-cubox-i imx6q-hummingboard imx6dl-hummingboard
+  IMAGES := combined.bin
+  FILESYSTEMS := squashfs
+  IMAGE/combined.bin := append-rootfs | pad-extra 128k | imx6-sdcard
 endef
 TARGET_DEVICES += cubox-i
 

+ 12 - 7
target/linux/imx6/image/bootscript-cubox

@@ -4,10 +4,15 @@ echo "CuBox OpenWrt Boot script"
 setenv console console=ttymxc0,115200 video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24,bpp=32
 
 # Find correct dtb
-if test ${board_name} = CUBOXI && test ${board_rev} = MX6DL; then
-	setenv fdt_name imx6dl.dtb;
-elif test ${board_name} = CUBOXI && test ${board_rev} = MX6Q; then
-	setenv fdt_name imx6q-cubox-i.dtb;
+if test ${board_rev} = MX6DL; then
+	setenv fdt_soc_type imx6dl;
+elif test ${board_rev} = MX6Q; then
+	setenv fdt_soc_type imx6q;
+fi
+if test ${board_name} = CUBOXI; then
+	setenv fdt_name ${fdt_soc_type}-cubox-i.dtb;
+elif test ${board_name} = HUMMINGBOARD; then
+	setenv fdt_name ${fdt_soc_type}-hummingboard.dtb;
 fi
 
 # Set correct devtype and partition
@@ -19,8 +24,8 @@ elif mmc dev 1; then
 fi
 
 # Boot from the SD card is supported at the moment
-setenv bootargs "${console} root=/dev/mmcblk1p1 rw rootwait"
+setenv bootargs "${console} root=/dev/mmcblk1p2 rw rootwait"
 mmc dev ${mmcdev}
-load ${devtype} ${mmcdev}:${devplist} ${kernel_addr_r} /boot/openwrt-imx6-cubox-i-uImage
-load ${devtype} ${mmcdev}:${devplist} ${fdt_addr_r} /boot/openwrt-imx6-${fdt_name}
+load ${devtype} ${mmcdev}:${devplist} ${kernel_addr_r} /uImage
+load ${devtype} ${mmcdev}:${devplist} ${fdt_addr_r} /${fdt_name}
 bootz ${kernel_addr_r} - ${fdt_addr_r}