openwrtv3/target/linux/imx6/image/Makefile

143 lines
3.4 KiB
Makefile
Raw Normal View History

#
# 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
include $(INCLUDE_DIR)/image.mk
#################################################
# Images
#################################################
DEVICE_VARS += MKUBIFS_OPTS
define Build/boot-overlay
rm -rf $@.boot
mkdir -p $@.boot
$(CP) $@ $@.boot/$(IMG_PREFIX)-uImage
ln -sf $(IMG_PREFIX)-uImage $@.boot/uImage
$(foreach dts,$(DEVICE_DTS), \
$(CP) \
$(DTS_DIR)/$(dts).dtb \
$@.boot/$(IMG_PREFIX)-$(dts).dtb; \
ln -sf \
$(IMG_PREFIX)-$(dts).dtb \
$@.boot/$(dts).dtb; \
)
mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
-n '$(DEVICE_ID) OpenWrt bootscript' \
-d ./bootscript-$(DEVICE_NAME) \
$@.boot/6x_bootscript-$(DEVICE_NAME)
$(STAGING_DIR_HOST)/bin/mkfs.ubifs \
--space-fixup --compr=zlib --squash-uids \
$(MKUBIFS_OPTS) -c 8124 \
-o $@.boot.ubifs -d $@.boot
$(TAR) -C $@.boot -cf $@.boot.tar .
endef
define Build/bootfs.tar.gz
rm -rf $@.boot
mkdir -p $@.boot
$(TAR) -C $@.boot -xf $(IMAGE_KERNEL).boot.tar
$(TAR) -C $@.boot \
--numeric-owner --owner=0 --group=0 --transform "s,./,./boot/," \
-czvf $@ .
endef
imx6: Initial support for SolidRun CuBox-i devices based on i.MX6 processors (i1, i2, i2eX, and i4Pro). - Specifications - CuBox i1: - SoC: i.MX6 Solo - Cores: 1 - Memory Size: 512MB - GPU: GC880 - Wifi/Bluetooth: Optional - USB 2.0 ports: 2 - Ethernet: 10/100/1000 Mbps CuBox i2 | i2eX: - SoC: i.MX6 Dual Lite - Cores: 2 - Memory Size: 1GB - GPU: GC2000 - Wifi/Bluetooth: Optional - USB 2.0 ports: 2 - Ethernet: 10/100/1000 Mbps CuBox i4Pro | i4x4: - SoC: i.MX6 Quad - Cores: 4 - Memory Size: 2/4 GB - GPU: GC2000 - Wifi/Bluetooth: Build In - USB 2.0 ports: 2 - Ethernet: 10/100/1000 Mbps Built-in u-boot requires SPL (secondary program loader) to be present on the SD-card regardless of the image type which will be loaded. SPL is generated by the u-boot-mx6cuboxi package which is preselected by the target device and can be found in bin/u-boot-mx6cuboxi directory. Flashing the SPL: dd if=/dev/zero of=/dev/mmcblk0 bs=1M count=4 dd if=bin/targets/imx6/generic/u-boot-mx6cuboxi/SPL of=/dev/mmcblk0 bs=1K seek=1 Preparing the firmware on the SD-card: (echo o; echo n; echo p; echo 1; echo ''; echo ''; echo w) | fdisk /dev/mmcblk0 mkfs.ext4 /dev/mmcblk0p1 mount /dev/mmcblk0p1 /mnt tar -xzf bin/targets/imx6/generic/openwrt-imx6-device-cubox-i-rootfs.tar.gz -C /mnt/ mkdir -p /mnt/boot cp bin/targets/imx6/generic/{*-uImage,*.dtb,*.scr} /mnt/boot/ Generated u-boot.img needs to be placed on the first partition: cp bin/targets/imx6/generic/u-boot-mx6cuboxi/u-boot.img /mnt/ To boot from the SD card: Boot script which sets mmc/dtb parameters and boots the board is automatically sourced. If this does not work for any reason: mmc dev 0; load mmc 0:1 $scriptaddr boot/boot.scr; source $scriptaddr Currently imx6dl-cubox-i.dtb (Dual Lite) and imx6q-cubox-i.dtb (Quad) device trees are available. Tested on i4Pro, MMC, USB (+ HiD), HDMI and ethernet ports are working. Wireless and bluetooth are broken ATM. According to SolidRun forums, BCM4329/BCM4330 firmware is used which works fine on older kernels. Signed-off-by: Vladimir Vid <vladimir.vid@sartura.hr>
2018-07-09 09:09:53 +00:00
define Build/boot-scr
mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
-n '$(DEVICE_ID) OpenWrt bootscript' \
-d ./bootscript-$(DEVICE_NAME) \
$(BIN_DIR)/boot.scr
endef
#################################################
# Devices
#################################################
KERNEL_LOADADDR=0x10008000
define Device/Default
PROFILES := Generic
FILESYSTEMS := squashfs ext4
KERNEL_INSTALL := 1
KERNEL_SUFFIX := -uImage
KERNEL_NAME := zImage
KERNEL_PREFIX := $$(IMAGE_PREFIX)
KERNEL := kernel-bin | uImage none
IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2)
IMAGES :=
endef
define Device/ventana
DEVICE_TITLE := Gateworks Ventana family (normal NAND flash)
DEVICE_DTS:= \
imx6dl-gw51xx \
imx6dl-gw52xx \
imx6dl-gw53xx \
imx6dl-gw54xx \
imx6dl-gw551x \
imx6dl-gw552x \
imx6dl-gw553x \
imx6dl-gw5904 \
imx6q-gw51xx \
imx6q-gw52xx \
imx6q-gw53xx \
imx6q-gw54xx \
imx6q-gw5400-a \
imx6q-gw551x \
imx6q-gw552x \
imx6q-gw553x \
imx6q-gw5904
DEVICE_PACKAGES := kmod-sky2 kmod-sound-core kmod-sound-soc-imx kmod-sound-soc-imx-sgtl5000 \
kmod-can kmod-can-flexcan kmod-can-raw \
kmod-hwmon-gsc \
kmod-leds-gpio kmod-pps-gpio \
kobs-ng
KERNEL += | boot-overlay
IMAGES := nand.ubi bootfs.tar.gz
UBINIZE_PARTS = boot=$$(KDIR_KERNEL_IMAGE).boot.ubifs=15
IMAGE/nand.ubi := append-ubi
IMAGE/bootfs.tar.gz := bootfs.tar.gz | install-dtb
IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1)-$$(2)
PAGESIZE := 2048
BLOCKSIZE := 128k
MKUBIFS_OPTS := -m $$(PAGESIZE) -e 124KiB
endef
TARGET_DEVICES += ventana
define Device/ventana-large
$(Device/ventana)
DEVICE_NAME := ventana
DEVICE_TITLE := Gateworks Ventana family (large NAND flash)
IMAGES := nand.ubi
PAGESIZE := 4096
BLOCKSIZE := 256k
MKUBIFS_OPTS := -m $$(PAGESIZE) -e 248KiB
endef
TARGET_DEVICES += ventana-large
define Device/wandboard
DEVICE_TITLE := Wandboard Dual
DEVICE_DTS := imx6dl-wandboard
endef
TARGET_DEVICES += wandboard
imx6: Initial support for SolidRun CuBox-i devices based on i.MX6 processors (i1, i2, i2eX, and i4Pro). - Specifications - CuBox i1: - SoC: i.MX6 Solo - Cores: 1 - Memory Size: 512MB - GPU: GC880 - Wifi/Bluetooth: Optional - USB 2.0 ports: 2 - Ethernet: 10/100/1000 Mbps CuBox i2 | i2eX: - SoC: i.MX6 Dual Lite - Cores: 2 - Memory Size: 1GB - GPU: GC2000 - Wifi/Bluetooth: Optional - USB 2.0 ports: 2 - Ethernet: 10/100/1000 Mbps CuBox i4Pro | i4x4: - SoC: i.MX6 Quad - Cores: 4 - Memory Size: 2/4 GB - GPU: GC2000 - Wifi/Bluetooth: Build In - USB 2.0 ports: 2 - Ethernet: 10/100/1000 Mbps Built-in u-boot requires SPL (secondary program loader) to be present on the SD-card regardless of the image type which will be loaded. SPL is generated by the u-boot-mx6cuboxi package which is preselected by the target device and can be found in bin/u-boot-mx6cuboxi directory. Flashing the SPL: dd if=/dev/zero of=/dev/mmcblk0 bs=1M count=4 dd if=bin/targets/imx6/generic/u-boot-mx6cuboxi/SPL of=/dev/mmcblk0 bs=1K seek=1 Preparing the firmware on the SD-card: (echo o; echo n; echo p; echo 1; echo ''; echo ''; echo w) | fdisk /dev/mmcblk0 mkfs.ext4 /dev/mmcblk0p1 mount /dev/mmcblk0p1 /mnt tar -xzf bin/targets/imx6/generic/openwrt-imx6-device-cubox-i-rootfs.tar.gz -C /mnt/ mkdir -p /mnt/boot cp bin/targets/imx6/generic/{*-uImage,*.dtb,*.scr} /mnt/boot/ Generated u-boot.img needs to be placed on the first partition: cp bin/targets/imx6/generic/u-boot-mx6cuboxi/u-boot.img /mnt/ To boot from the SD card: Boot script which sets mmc/dtb parameters and boots the board is automatically sourced. If this does not work for any reason: mmc dev 0; load mmc 0:1 $scriptaddr boot/boot.scr; source $scriptaddr Currently imx6dl-cubox-i.dtb (Dual Lite) and imx6q-cubox-i.dtb (Quad) device trees are available. Tested on i4Pro, MMC, USB (+ HiD), HDMI and ethernet ports are working. Wireless and bluetooth are broken ATM. According to SolidRun forums, BCM4329/BCM4330 firmware is used which works fine on older kernels. Signed-off-by: Vladimir Vid <vladimir.vid@sartura.hr>
2018-07-09 09:09:53 +00:00
define Device/cubox-i
KERNEL := kernel-bin | install-dtb | boot-scr
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
endef
TARGET_DEVICES += cubox-i
$(eval $(call BuildImage))