Initial commit
This commit is contained in:
226
target/linux/imx6/image/Makefile
Normal file
226
target/linux/imx6/image/Makefile
Normal file
@@ -0,0 +1,226 @@
|
||||
#
|
||||
# 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 UBOOT BOOT_SCRIPT
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
define Build/recovery-scr
|
||||
mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
|
||||
-n '$(DEVICE_ID) OpenWrt recovery bootscript' \
|
||||
-d ./recovery-$(DEVICE_NAME) $@
|
||||
endef
|
||||
|
||||
define Build/imx6-combined-image-prepare
|
||||
rm -rf $@.boot
|
||||
mkdir -p $@.boot
|
||||
endef
|
||||
|
||||
define Build/imx6-combined-image-clean
|
||||
rm -rf $@.boot $@.fs
|
||||
endef
|
||||
|
||||
define Build/imx6-combined-image
|
||||
$(CP) $(IMAGE_KERNEL) $@.boot/uImage
|
||||
|
||||
$(foreach dts,$(DEVICE_DTS), \
|
||||
$(CP) \
|
||||
$(DTS_DIR)/$(dts).dtb \
|
||||
$@.boot/;
|
||||
)
|
||||
|
||||
mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
|
||||
-n '$(DEVICE_ID) OpenWrt bootscript' \
|
||||
-d $(BOOT_SCRIPT) \
|
||||
$@.boot/boot.scr
|
||||
|
||||
cp $@ $@.fs
|
||||
|
||||
$(SCRIPT_DIR)/gen_image_generic.sh $@ \
|
||||
$(CONFIG_TARGET_KERNEL_PARTSIZE) \
|
||||
$@.boot \
|
||||
$(CONFIG_TARGET_ROOTFS_PARTSIZE) \
|
||||
$@.fs \
|
||||
1024
|
||||
endef
|
||||
|
||||
define Build/imx6-sdcard
|
||||
$(Build/imx6-combined-image-prepare)
|
||||
|
||||
$(CP) $(STAGING_DIR_IMAGE)/$(UBOOT)-u-boot.img $@.boot/u-boot.img
|
||||
$(Build/imx6-combined-image)
|
||||
dd if=$(STAGING_DIR_IMAGE)/$(UBOOT)-SPL of=$@ bs=1024 seek=1 conv=notrunc
|
||||
|
||||
$(Build/imx6-combined-image-clean)
|
||||
endef
|
||||
|
||||
define Build/apalis-emmc
|
||||
$(Build/imx6-combined-image-prepare)
|
||||
$(Build/imx6-combined-image)
|
||||
$(Build/imx6-combined-image-clean)
|
||||
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
|
||||
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
|
||||
IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2)
|
||||
UBINIZE_PARTS = boot=$$(KDIR_KERNEL_IMAGE).boot.ubifs=15
|
||||
BOOT_SCRIPT := bootscript-ventana
|
||||
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
|
||||
|
||||
define Device/cubox-i
|
||||
KERNEL := kernel-bin | install-dtb
|
||||
UBOOT := mx6cuboxi
|
||||
BOOT_SCRIPT = bootscript-cubox
|
||||
DEVICE_NAME := cubox
|
||||
DEVICE_TITLE := SolidRun CuBox-i
|
||||
DEVICE_PACKAGES := kmod-drm-imx kmod-drm-imx-hdmi kmod-usb-hid
|
||||
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
|
||||
|
||||
define Device/apalis
|
||||
DEVICE_TITLE := Toradex Apalis family
|
||||
SUPPORTED_DEVICES := apalis,ixora apalis,eval
|
||||
DEVICE_DTS := \
|
||||
imx6q-apalis-eval \
|
||||
imx6q-apalis-ixora \
|
||||
imx6q-apalis-ixora-v1.1
|
||||
DEVICE_PACKAGES := \
|
||||
kmod-can kmod-can-flexcan kmod-can-raw \
|
||||
kmod-leds-gpio kmod-gpio-button-hotplug \
|
||||
kmod-pps-gpio kmod-rtc-ds1307
|
||||
BOOT_SCRIPT := bootscript-apalis
|
||||
UBOOT := apalis_imx6
|
||||
FILESYSTEMS := squashfs
|
||||
IMAGES := combined.bin sysupgrade.bin
|
||||
IMAGE_NAME = $$(IMAGE_PREFIX)-$$(1).$$(2)
|
||||
IMAGE/combined.bin := append-rootfs | pad-extra 128k | apalis-emmc
|
||||
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
|
||||
ARTIFACTS := recovery.scr
|
||||
ARTIFACT/recovery.scr := recovery-scr
|
||||
endef
|
||||
TARGET_DEVICES += apalis
|
||||
|
||||
$(eval $(call BuildImage))
|
||||
20
target/linux/imx6/image/bootscript-apalis
Normal file
20
target/linux/imx6/image/bootscript-apalis
Normal file
@@ -0,0 +1,20 @@
|
||||
echo "Toradex Apalis OpenWrt Boot script v1.0"
|
||||
|
||||
run finduuid
|
||||
|
||||
setenv nextcon 0
|
||||
setenv fdt_file imx6q-apalis-ixora.dtb
|
||||
setenv root root=PARTUUID=${uuid} rootfstype=squashfs rootwait
|
||||
setenv bootargs earlyprintk console=${console},${baudrate}n8 ${root}
|
||||
setenv fsload ext4load mmc ${mmcbootdev}:${bootpart}
|
||||
|
||||
if ${fsload} ${kernel_addr_r} ${boot_file}; then
|
||||
if ${fsload} ${fdt_addr_r} ${fdt_file}; then
|
||||
test -n "$fdt_fixup" && run fdt_fixup
|
||||
bootm ${kernel_addr_r} - ${fdt_addr_r}
|
||||
else
|
||||
echo "Error loading device-tree"
|
||||
fi
|
||||
else
|
||||
echo "Error loading kernel image"
|
||||
fi
|
||||
31
target/linux/imx6/image/bootscript-cubox
Normal file
31
target/linux/imx6/image/bootscript-cubox
Normal file
@@ -0,0 +1,31 @@
|
||||
echo "CuBox OpenWrt Boot script"
|
||||
|
||||
# Set console variable for both UART and HDMI
|
||||
setenv console console=ttymxc0,115200 video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24,bpp=32
|
||||
|
||||
# Find correct 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
|
||||
if test ${devtype} != mmc; then setenv devtype mmc; fi
|
||||
if mmc dev 0; then
|
||||
setenv mmcdev 0
|
||||
elif mmc dev 1; then
|
||||
setenv mmcdev 1
|
||||
fi
|
||||
|
||||
# Boot from the SD card is supported at the moment
|
||||
setenv bootargs "${console} root=/dev/mmcblk1p2 rw rootwait"
|
||||
mmc dev ${mmcdev}
|
||||
load ${devtype} ${mmcdev}:${devplist} ${kernel_addr_r} /uImage
|
||||
load ${devtype} ${mmcdev}:${devplist} ${fdt_addr_r} /${fdt_name}
|
||||
bootz ${kernel_addr_r} - ${fdt_addr_r}
|
||||
79
target/linux/imx6/image/bootscript-ventana
Normal file
79
target/linux/imx6/image/bootscript-ventana
Normal file
@@ -0,0 +1,79 @@
|
||||
echo "Gateworks Ventana OpenWrt Boot script v1.01"
|
||||
|
||||
# set some defaults
|
||||
# set some defaults
|
||||
test -n "$fs" || fs=ext2
|
||||
test -n "$disk" || disk=0
|
||||
setenv nextcon 0
|
||||
setenv bootargs console=${console},${baudrate}
|
||||
setenv loadaddr 10800000
|
||||
setenv fdt_addr 18000000
|
||||
|
||||
# detect dtype and bootdev by looking for kernel on media the bootloader
|
||||
# has mounted (in order of preference: usb/mmc/sata)
|
||||
#
|
||||
# This assumes the bootloader has already started the respective subsystem
|
||||
# or mounted the filesystem if appropriate to get to this bootscript
|
||||
#
|
||||
# To Speed up boot set dtype manually
|
||||
if test -n "$dtype" ; then
|
||||
echo "Using dtype from env: $dtype"
|
||||
else
|
||||
echo "Detecting boot device (dtype)..."
|
||||
if ${fs}load usb ${disk}:1 ${loadaddr} ${bootdir}/uImage ; then
|
||||
dtype=usb
|
||||
elif ${fs}load mmc ${disk}:1 ${loadaddr} ${bootdir}/uImage ; then
|
||||
dtype=mmc
|
||||
elif ${fs}load sata ${disk}:1 ${loadaddr} ${bootdir}/uImage ; then
|
||||
dtype=sata
|
||||
elif ubifsload ${loadaddr} ${bootdir}/uImage ; then
|
||||
dtype=nand
|
||||
fi
|
||||
echo "detected dtype:$dtype"
|
||||
fi
|
||||
if test -n "$bootdev" ; then
|
||||
echo "Using bootdev from env: $bootdev"
|
||||
else
|
||||
if itest.s "x${dtype}" == "xmmc" ; then
|
||||
bootdev=mmcblk0p1
|
||||
else
|
||||
bootdev=sda1
|
||||
fi
|
||||
fi
|
||||
|
||||
if itest.s "x${dtype}" == "xnand" ; then
|
||||
echo "Booting from NAND..."
|
||||
# fix partition name
|
||||
# OpenWrt kernel bug prevents partition name of 'rootfs' from booting
|
||||
# instead name the partition ubi which is what is looked for by
|
||||
# procd sysupgrade
|
||||
mtdparts del rootfs && mtdparts add nand0 - ubi
|
||||
echo "mtdparts:${mtdparts}"
|
||||
setenv fsload ubifsload
|
||||
setenv root "ubi0:ubi ubi.mtd=2 rootfstype=squashfs,ubifs"
|
||||
else
|
||||
echo "Booting from block device ${bootdev}..."
|
||||
setenv fsload "${fs}load ${dtype} ${disk}:1"
|
||||
setenv root "root=/dev/${bootdev} rootfstype=${fs} rootwait rw"
|
||||
fi
|
||||
|
||||
setenv bootargs "${bootargs}" "${root}" "${video}" "${extra}"
|
||||
if ${fsload} ${loadaddr} ${bootdir}/uImage; then
|
||||
if ${fsload} ${fdt_addr} ${bootdir}/${fdt_file}; then
|
||||
echo Loaded DTB from ${bootdir}/${fdt_file}
|
||||
test -n "$fixfdt" && run fixfdt
|
||||
bootm ${loadaddr} - ${fdt_addr}
|
||||
elif ${fsload} ${fdt_addr} ${bootdir}/${fdt_file1}; then
|
||||
echo Loaded DTB from ${bootdir}/${fdt_file1}
|
||||
test -n "$fixfdt" && run fixfdt
|
||||
bootm ${loadaddr} - ${fdt_addr}
|
||||
elif ${fsload} ${fdt_addr} ${bootdir}/${fdt_file2}; then
|
||||
echo Loaded DTB from ${bootdir}/${fdt_file2}
|
||||
test -n "$fixfdt" && run fixfdt
|
||||
bootm ${loadaddr} - ${fdt_addr}
|
||||
else
|
||||
echo "Error loading device-tree"
|
||||
fi
|
||||
else
|
||||
echo "Error loading kernel image"
|
||||
fi
|
||||
14
target/linux/imx6/image/recovery-apalis
Normal file
14
target/linux/imx6/image/recovery-apalis
Normal file
@@ -0,0 +1,14 @@
|
||||
# flash u-boot-with-spl.imx
|
||||
# using fixed size of 1M for U-Boot + SPL
|
||||
mmc dev 0 1
|
||||
mmc write 0x12100000 0x2 0x800
|
||||
|
||||
# flash openwrt-imx6-apalis-squashfs.combined.bin
|
||||
run set_blkcnt
|
||||
mmc dev 0 0
|
||||
mmc write 0x12500000 0 ${blkcnt}
|
||||
|
||||
env default -f -a
|
||||
saveenv
|
||||
|
||||
reset
|
||||
Reference in New Issue
Block a user