Commit 723226c1a4151e4e1b89c58bff7b045baba16588

Authored by Eric Lee
1 parent 4fbdfd36c0

Yocto Sumo Support for SMARC-iMX8M, Based on Linux 4.14.98_2.0.0_ga, Initial Release

Showing 11 changed files with 737 additions and 137 deletions Inline Diff

conf/machine/smarcimx8m2g.conf
1 #@TYPE: Machine 1 #@TYPE: Machine
2 #@NAME: EMBEDIAN SMARC-iMX8M COMPUTER ON MODULES with 2GB LPDDR4 MEMORY 2 #@NAME: EMBEDIAN SMARC-iMX8M COMPUTER ON MODULES with 2GB LPDDR4 MEMORY
3 #@SOC: i.MX8MQ 3 #@SOC: i.MX8MQ
4 #@DESCRIPTION: Machine configuration for Embedian SMARC-iMX8M 4 #@DESCRIPTION: Machine configuration for Embedian SMARC-iMX8M
5 #@MAINTAINER: Eric Lee <eric.lee@embedian.com> 5 #@MAINTAINER: Eric Lee <eric.lee@embedian.com>
6 # 6 #
7 # http://www.www.embedian.com 7 # http://www.www.embedian.com
8 8
9 MACHINEOVERRIDES =. "mx8:mx8m:mx8mq:" 9 MACHINEOVERRIDES =. "mx8:mx8m:mx8mq:"
10 require conf/machine/include/imx-base.inc 10 require conf/machine/include/imx-base.inc
11 require conf/machine/include/arm/arch-arm64.inc 11 require conf/machine/include/arm/arch-arm64.inc
12 12
13 MACHINE_FEATURES += " usbgadget vfat ext2 alsa serial pci wifi bluetooth" 13 MACHINE_FEATURES += " usbgadget vfat ext2 alsa serial pci wifi bluetooth"
14 14
15 IMAGE_FEATURES += "package-management" 15 IMAGE_FEATURES += "package-management"
16 16
17 # Embedian BSP default providers 17 # Embedian BSP default providers
18 PREFERRED_PROVIDER_virtual/kernel_smarcimx8m2g ?= "linux-smarcimx8m" 18 PREFERRED_PROVIDER_virtual/kernel_smarcimx8m2g ?= "linux-smarcimx8m"
19 PREFERRED_VERSION_linux-smarcimx8m2g_smarcimx8m2g = "4.14.78" 19 PREFERRED_VERSION_linux-smarcimx8m2g_smarcimx8m2g = "4.14.98"
20 20
21 KERNEL_DEVICETREE = " \ 21 KERNEL_DEVICETREE = " \
22 embedian/fsl-smarcimx8mq.dtb \ 22 embedian/fsl-smarcimx8mq.dtb \
23 embedian/fsl-smarcimx8mq-dcss-lvds.dtb \ 23 embedian/fsl-smarcimx8mq-dcss-lvds.dtb \
24 embedian/fsl-smarcimx8mq-lcdif-lvds.dtb \ 24 embedian/fsl-smarcimx8mq-lcdif-lvds.dtb \
25 embedian/fsl-smarcimx8mq-hdmi.dtb \ 25 embedian/fsl-smarcimx8mq-hdmi.dtb \
26 embedian/fsl-smarcimx8mq-dp.dtb \ 26 embedian/fsl-smarcimx8mq-dp.dtb \
27 embedian/fsl-smarcimx8mq-edp.dtb \ 27 embedian/fsl-smarcimx8mq-edp.dtb \
28 embedian/fsl-smarcimx8mq-dual-display.dtb \ 28 embedian/fsl-smarcimx8mq-dual-display.dtb \
29 " 29 "
30 IMAGE_BOOTFILES_DEPENDS += "imx-m4-demos:do_deploy" 30 IMAGE_BOOTFILES_DEPENDS += "imx-m4-demos:do_deploy"
31 IMAGE_BOOTFILES += "imx8mq_m4_TCM_hello_world.bin imx8mq_m4_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin imx8mq_m4_TCM_rpmsg_lite_str_echo_rtos.bin" 31 IMAGE_BOOTFILES += "imx8mq_m4_TCM_hello_world.bin imx8mq_m4_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin imx8mq_m4_TCM_rpmsg_lite_str_echo_rtos.bin"
32 32
33 PREFERRED_PROVIDER_u-boot_smarcimx8m2g = "u-boot-smarcimx8m" 33 PREFERRED_PROVIDER_u-boot_smarcimx8m2g = "u-boot-smarcimx8m"
34 PREFERRED_PROVIDER_virtual/bootloader_smarcimx8m2g = "u-boot-smarcimx8m" 34 PREFERRED_PROVIDER_virtual/bootloader_smarcimx8m2g = "u-boot-smarcimx8m"
35 35
36 UBOOT_CONFIG ??= "sd" 36 UBOOT_CONFIG ??= "sd"
37 UBOOT_CONFIG[sd] = "smarcimx8mq_2g_ser3_defconfig,sdcard" 37 UBOOT_CONFIG[sd] = "smarcimx8mq_2g_ser3_defconfig,sdcard"
38 SPL_BINARY = "spl/u-boot-spl.bin" 38 SPL_BINARY = "spl/u-boot-spl.bin"
39 39
40 # Set DDR FIRMWARE 40 # Set DDR FIRMWARE
41 DDR_FIRMWARE_NAME = "lpddr4_pmu_train_1d_imem.bin lpddr4_pmu_train_1d_dmem.bin lpddr4_pmu_train_2d_imem.bin lpddr4_pmu_train_2d_dmem.bin" 41 DDR_FIRMWARE_NAME = "lpddr4_pmu_train_1d_imem.bin lpddr4_pmu_train_1d_dmem.bin lpddr4_pmu_train_2d_imem.bin lpddr4_pmu_train_2d_dmem.bin"
42 42
43 # Set U-Boot DTB 43 # Set U-Boot DTB
44 UBOOT_DTB_NAME = "fsl-smarcimx8mq.dtb" 44 UBOOT_DTB_NAME = "fsl-smarcimx8mq.dtb"
45 45
46 # Set imx-mkimage boot target 46 # Set imx-mkimage boot target
47 IMXBOOT_TARGETS = "flash_evk flash_evk_no_hdmi flash_dp_evk" 47 IMXBOOT_TARGETS = "flash_evk flash_evk_no_hdmi flash_dp_evk"
48 48
49 SERIAL_CONSOLE = "115200 ttymxc0" 49 SERIAL_CONSOLE = "115200 ttymxc0"
50 50
51 IMAGE_BOOTLOADER = "imx-boot" 51 IMAGE_BOOTLOADER = "imx-boot"
52 52
53 BOOT_SPACE = "65536" 53 BOOT_SPACE = "65536"
54 54
55 LOADADDR = "" 55 LOADADDR = ""
56 UBOOT_SUFFIX = "bin" 56 UBOOT_SUFFIX = "bin"
57 UBOOT_MAKE_TARGET = "" 57 UBOOT_MAKE_TARGET = ""
58 IMX_BOOT_SEEK = "33" 58 IMX_BOOT_SEEK = "33"
59 59
60 PREFERRED_RPROVIDER_ptpd = "ptpd" 60 PREFERRED_RPROVIDER_ptpd = "ptpd"
61 PREFERRED_RPROVIDER_ptpd-dev = "ptpd" 61 PREFERRED_RPROVIDER_ptpd-dev = "ptpd"
62 62
63 MACHINE_EXTRA_RDEPENDS += " \ 63 MACHINE_EXTRA_RDEPENDS += " \
64 packagegroup-tools-bluetooth \ 64 packagegroup-tools-bluetooth \
65 pm-utils \ 65 pm-utils \
66 kmod \ 66 kmod \
67 hdparm \ 67 hdparm \
68 gptfdisk \ 68 gptfdisk \
69 lftp \ 69 lftp \
70 vim \ 70 vim \
71 ntp \ 71 ntp \
72 boost \ 72 boost \
73 nodejs \ 73 nodejs \
74 networkmanager \ 74 networkmanager \
75 imx-gpu-viv \
75 " 76 "
76 77
77 BBMASK_prepend = "fsl-image-mfgtool-initramfs " 78 BBMASK_prepend = "fsl-image-mfgtool-initramfs "
78 79
79 # Packages added to all images (including core-image-minimal) 80 # Packages added to all images (including core-image-minimal)
80 IMAGE_INSTALL_append = " \ 81 IMAGE_INSTALL_append = " \
81 firmware-imx-sdma \ 82 firmware-imx-sdma \
82 firmware-imx-epdc \ 83 firmware-imx-epdc \
83 fsl-rc-local \ 84 fsl-rc-local \
84 " 85 "
85 86
86 IMAGE_FSTYPES = "tar.bz2" 87 IMAGE_FSTYPES = "tar.bz2"
87 88
88 # Ship all kernel modules by default 89 # Ship all kernel modules by default
89 MACHINE_EXTRA_RRECOMMENDS = "kernel-modules" 90 MACHINE_EXTRA_RRECOMMENDS = "kernel-modules"
90 91
91 MACHINE_FIRMWARE_append_mx8 = " linux-firmware-ath10k" 92 MACHINE_FIRMWARE_append_mx8 = " linux-firmware-ath10k"
92 93
conf/machine/smarcimx8m2gind.conf
1 #@TYPE: Machine File was deleted
2 #@NAME: EMBEDIAN SMARC-iMX8M COMPUTER ON MODULES with 2GB LPDDR4 MEMORY
3 #@SOC: i.MX8MQ
4 #@DESCRIPTION: Machine configuration for Embedian SMARC-iMX8M
5 #@MAINTAINER: Eric Lee <eric.lee@embedian.com>
6 #
7 # http://www.www.embedian.com
8
9 MACHINEOVERRIDES =. "mx8:mx8m:mx8mq:"
10 require conf/machine/include/imx-base.inc
11 require conf/machine/include/arm/arch-arm64.inc
12
13 MACHINE_FEATURES += " usbgadget vfat ext2 alsa serial pci wifi bluetooth"
14
15 IMAGE_FEATURES += "package-management"
16
17 # Embedian BSP default providers
18 PREFERRED_PROVIDER_virtual/kernel_smarcimx8m2gind ?= "linux-smarcimx8m"
19 PREFERRED_VERSION_linux-smarcimx8m_smarcimx8m2gind = "4.14.78"
20
21 KERNEL_DEVICETREE = " \
22 embedian/fsl-smarcimx8mq.dtb \
23 embedian/fsl-smarcimx8mq-dcss-lvds.dtb \
24 embedian/fsl-smarcimx8mq-lcdif-lvds.dtb \
25 embedian/fsl-smarcimx8mq-hdmi.dtb \
26 embedian/fsl-smarcimx8mq-dp.dtb \
27 embedian/fsl-smarcimx8mq-edp.dtb \
28 embedian/fsl-smarcimx8mq-dual-display.dtb \
29 "
30 IMAGE_BOOTFILES_DEPENDS += "imx-m4-demos:do_deploy"
31 IMAGE_BOOTFILES += "imx8mq_m4_TCM_hello_world.bin imx8mq_m4_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin imx8mq_m4_TCM_rpmsg_lite_str_echo_rtos.bin"
32
33 PREFERRED_PROVIDER_u-boot_smarcimx8m2gind = "u-boot-smarcimx8m"
34 PREFERRED_PROVIDER_virtual/bootloader_smarcimx8m2gind = "u-boot-smarcimx8m"
35
36 UBOOT_CONFIG ??= "sd"
37 UBOOT_CONFIG[sd] = "smarcimx8mq_2g_ser3_ind_defconfig,sdcard"
38 SPL_BINARY = "spl/u-boot-spl.bin"
39
40 # Set DDR FIRMWARE
41 DDR_FIRMWARE_NAME = "lpddr4_pmu_train_1d_imem.bin lpddr4_pmu_train_1d_dmem.bin lpddr4_pmu_train_2d_imem.bin lpddr4_pmu_train_2d_dmem.bin"
42
43 # Set U-Boot DTB
44 UBOOT_DTB_NAME = "fsl-smarcimx8mq.dtb"
45
46 # Set imx-mkimage boot target
47 IMXBOOT_TARGETS = "flash_evk flash_evk_no_hdmi flash_dp_evk"
48
49 SERIAL_CONSOLE = "115200 ttymxc0"
50
51 IMAGE_BOOTLOADER = "imx-boot"
52
53 BOOT_SPACE = "65536"
54
55 LOADADDR = ""
56 UBOOT_SUFFIX = "bin"
57 UBOOT_MAKE_TARGET = ""
58 IMX_BOOT_SEEK = "33"
59
60 PREFERRED_RPROVIDER_ptpd = "ptpd"
61 PREFERRED_RPROVIDER_ptpd-dev = "ptpd"
62
63 MACHINE_EXTRA_RDEPENDS += " \
64 packagegroup-tools-bluetooth \
65 pm-utils \
66 kmod \
67 hdparm \
68 gptfdisk \
69 lftp \
70 vim \
71 ntp \
72 boost \
73 nodejs \
74 networkmanager \
75 "
76
77 BBMASK_prepend = "fsl-image-mfgtool-initramfs "
78
79 # Packages added to all images (including core-image-minimal)
80 IMAGE_INSTALL_append = " \
81 firmware-imx-sdma \
82 firmware-imx-epdc \
83 fsl-rc-local \
84 "
85
86 IMAGE_FSTYPES = "tar.bz2"
87
88 # Ship all kernel modules by default
89 MACHINE_EXTRA_RRECOMMENDS = "kernel-modules"
90
91 MACHINE_FIRMWARE_append_mx8 = " linux-firmware-ath10k"
92 1 #@TYPE: Machine
conf/machine/smarcimx8m4g.conf
1 #@TYPE: Machine 1 #@TYPE: Machine
2 #@NAME: EMBEDIAN SMARC-iMX8M COMPUTER ON MODULES with 2GB LPDDR4 MEMORY 2 #@NAME: EMBEDIAN SMARC-iMX8M COMPUTER ON MODULES with 2GB LPDDR4 MEMORY
3 #@SOC: i.MX8MQ 3 #@SOC: i.MX8MQ
4 #@DESCRIPTION: Machine configuration for Embedian SMARC-iMX8M 4 #@DESCRIPTION: Machine configuration for Embedian SMARC-iMX8M
5 #@MAINTAINER: Eric Lee <eric.lee@embedian.com> 5 #@MAINTAINER: Eric Lee <eric.lee@embedian.com>
6 # 6 #
7 # http://www.www.embedian.com 7 # http://www.www.embedian.com
8 8
9 MACHINEOVERRIDES =. "mx8:mx8m:mx8mq:" 9 MACHINEOVERRIDES =. "mx8:mx8m:mx8mq:"
10 require conf/machine/include/imx-base.inc 10 require conf/machine/include/imx-base.inc
11 require conf/machine/include/arm/arch-arm64.inc 11 require conf/machine/include/arm/arch-arm64.inc
12 12
13 MACHINE_FEATURES += " usbgadget vfat ext2 alsa serial pci wifi bluetooth" 13 MACHINE_FEATURES += " usbgadget vfat ext2 alsa serial pci wifi bluetooth"
14 14
15 IMAGE_FEATURES += "package-management" 15 IMAGE_FEATURES += "package-management"
16 16
17 # Embedian BSP default providers 17 # Embedian BSP default providers
18 PREFERRED_PROVIDER_virtual/kernel_smarcimx8m4g ?= "linux-smarcimx8m" 18 PREFERRED_PROVIDER_virtual/kernel_smarcimx8m4g ?= "linux-smarcimx8m"
19 PREFERRED_VERSION_linux-smarcimx8m_smarcimx8m4g = "4.14.78" 19 PREFERRED_VERSION_linux-smarcimx8m_smarcimx8m4g = "4.14.98"
20 20
21 KERNEL_DEVICETREE = " \ 21 KERNEL_DEVICETREE = " \
22 embedian/fsl-smarcimx8mq.dtb \ 22 embedian/fsl-smarcimx8mq.dtb \
23 embedian/fsl-smarcimx8mq-dcss-lvds.dtb \ 23 embedian/fsl-smarcimx8mq-dcss-lvds.dtb \
24 embedian/fsl-smarcimx8mq-lcdif-lvds.dtb \ 24 embedian/fsl-smarcimx8mq-lcdif-lvds.dtb \
25 embedian/fsl-smarcimx8mq-hdmi.dtb \ 25 embedian/fsl-smarcimx8mq-hdmi.dtb \
26 embedian/fsl-smarcimx8mq-dp.dtb \ 26 embedian/fsl-smarcimx8mq-dp.dtb \
27 embedian/fsl-smarcimx8mq-edp.dtb \ 27 embedian/fsl-smarcimx8mq-edp.dtb \
28 embedian/fsl-smarcimx8mq-dual-display.dtb \ 28 embedian/fsl-smarcimx8mq-dual-display.dtb \
29 " 29 "
30 IMAGE_BOOTFILES_DEPENDS += "imx-m4-demos:do_deploy" 30 IMAGE_BOOTFILES_DEPENDS += "imx-m4-demos:do_deploy"
31 IMAGE_BOOTFILES += "imx8mq_m4_TCM_hello_world.bin imx8mq_m4_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin imx8mq_m4_TCM_rpmsg_lite_str_echo_rtos.bin" 31 IMAGE_BOOTFILES += "imx8mq_m4_TCM_hello_world.bin imx8mq_m4_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin imx8mq_m4_TCM_rpmsg_lite_str_echo_rtos.bin"
32 32
33 PREFERRED_PROVIDER_u-boot_smarcimx8m4g = "u-boot-smarcimx8m" 33 PREFERRED_PROVIDER_u-boot_smarcimx8m4g = "u-boot-smarcimx8m"
34 PREFERRED_PROVIDER_virtual/bootloader_smarcimx8m4g = "u-boot-smarcimx8m" 34 PREFERRED_PROVIDER_virtual/bootloader_smarcimx8m4g = "u-boot-smarcimx8m"
35 35
36 UBOOT_CONFIG ??= "sd" 36 UBOOT_CONFIG ??= "sd"
37 UBOOT_CONFIG[sd] = "smarcimx8mq_4g_ser3_defconfig,sdcard" 37 UBOOT_CONFIG[sd] = "smarcimx8mq_4g_ser3_defconfig,sdcard"
38 SPL_BINARY = "spl/u-boot-spl.bin" 38 SPL_BINARY = "spl/u-boot-spl.bin"
39 39
40 # Set DDR FIRMWARE 40 # Set DDR FIRMWARE
41 DDR_FIRMWARE_NAME = "lpddr4_pmu_train_1d_imem.bin lpddr4_pmu_train_1d_dmem.bin lpddr4_pmu_train_2d_imem.bin lpddr4_pmu_train_2d_dmem.bin" 41 DDR_FIRMWARE_NAME = "lpddr4_pmu_train_1d_imem.bin lpddr4_pmu_train_1d_dmem.bin lpddr4_pmu_train_2d_imem.bin lpddr4_pmu_train_2d_dmem.bin"
42 42
43 # Set U-Boot DTB 43 # Set U-Boot DTB
44 UBOOT_DTB_NAME = "fsl-smarcimx8mq.dtb" 44 UBOOT_DTB_NAME = "fsl-smarcimx8mq.dtb"
45 45
46 # Set imx-mkimage boot target 46 # Set imx-mkimage boot target
47 IMXBOOT_TARGETS = "flash_evk flash_evk_no_hdmi flash_dp_evk" 47 IMXBOOT_TARGETS = "flash_evk flash_evk_no_hdmi flash_dp_evk"
48 48
49 SERIAL_CONSOLE = "115200 ttymxc0" 49 SERIAL_CONSOLE = "115200 ttymxc0"
50 50
51 IMAGE_BOOTLOADER = "imx-boot" 51 IMAGE_BOOTLOADER = "imx-boot"
52 52
53 BOOT_SPACE = "65536" 53 BOOT_SPACE = "65536"
54 54
55 LOADADDR = "" 55 LOADADDR = ""
56 UBOOT_SUFFIX = "bin" 56 UBOOT_SUFFIX = "bin"
57 UBOOT_MAKE_TARGET = "" 57 UBOOT_MAKE_TARGET = ""
58 IMX_BOOT_SEEK = "33" 58 IMX_BOOT_SEEK = "33"
59 59
60 PREFERRED_RPROVIDER_ptpd = "ptpd" 60 PREFERRED_RPROVIDER_ptpd = "ptpd"
61 PREFERRED_RPROVIDER_ptpd-dev = "ptpd" 61 PREFERRED_RPROVIDER_ptpd-dev = "ptpd"
62 62
63 MACHINE_EXTRA_RDEPENDS += " \ 63 MACHINE_EXTRA_RDEPENDS += " \
64 packagegroup-tools-bluetooth \ 64 packagegroup-tools-bluetooth \
65 pm-utils \ 65 pm-utils \
66 kmod \ 66 kmod \
67 hdparm \ 67 hdparm \
68 gptfdisk \ 68 gptfdisk \
69 lftp \ 69 lftp \
70 vim \ 70 vim \
71 ntp \ 71 ntp \
72 boost \ 72 boost \
73 nodejs \ 73 nodejs \
74 networkmanager \ 74 networkmanager \
75 imx-gpu-viv \
75 " 76 "
76 77
77 BBMASK_prepend = "fsl-image-mfgtool-initramfs " 78 BBMASK_prepend = "fsl-image-mfgtool-initramfs "
78 79
79 # Packages added to all images (including core-image-minimal) 80 # Packages added to all images (including core-image-minimal)
80 IMAGE_INSTALL_append = " \ 81 IMAGE_INSTALL_append = " \
81 firmware-imx-sdma \ 82 firmware-imx-sdma \
82 firmware-imx-epdc \ 83 firmware-imx-epdc \
83 fsl-rc-local \ 84 fsl-rc-local \
84 " 85 "
85 86
86 IMAGE_FSTYPES = "tar.bz2" 87 IMAGE_FSTYPES = "tar.bz2"
87 88
88 # Ship all kernel modules by default 89 # Ship all kernel modules by default
89 MACHINE_EXTRA_RRECOMMENDS = "kernel-modules" 90 MACHINE_EXTRA_RRECOMMENDS = "kernel-modules"
90 91
91 MACHINE_FIRMWARE_append_mx8 = " linux-firmware-ath10k" 92 MACHINE_FIRMWARE_append_mx8 = " linux-firmware-ath10k"
92 93
recipes-bsp/u-boot/u-boot-smarcimx8m_2018.03.bb
1 # Copyright (C) 2013-2016 Freescale Semiconductor 1 # Copyright (C) 2013-2016 Freescale Semiconductor
2 # Copyright 2017-2018 NXP 2 # Copyright 2017-2018 NXP
3 3
4 DESCRIPTION = "i.MX U-Boot suppporting i.MX reference boards." 4 DESCRIPTION = "i.MX U-Boot suppporting i.MX reference boards."
5 require recipes-bsp/u-boot/u-boot.inc 5 require recipes-bsp/u-boot/u-boot.inc
6 inherit pythonnative 6 inherit pythonnative
7 7
8 PROVIDES += "u-boot" 8 PROVIDES += "u-boot"
9 DEPENDS_append = " python dtc-native" 9 DEPENDS_append = " python dtc-native"
10 10
11 LICENSE = "GPLv2+" 11 LICENSE = "GPLv2+"
12 LIC_FILES_CHKSUM = "file://Licenses/gpl-2.0.txt;md5=b234ee4d69f5fce4486a80fdaf4a4263" 12 LIC_FILES_CHKSUM = "file://Licenses/gpl-2.0.txt;md5=b234ee4d69f5fce4486a80fdaf4a4263"
13 13
14 UBOOT_SRC ?= "${EMB_UBOOT_MIRROR};protocol=ssh" 14 UBOOT_SRC ?= "${EMB_UBOOT_MIRROR};protocol=ssh"
15 SRCBRANCH = "smarc-imx_v2018.03_4.14.78_1.0.0_ga" 15 SRCBRANCH = "smarc_8m-imx_v2018.03_4.14.98_2.0.0_ga"
16 SRC_URI = "${UBOOT_SRC};branch=${SRCBRANCH}" 16 SRC_URI = "${UBOOT_SRC};branch=${SRCBRANCH}"
17 SRCREV = "2a0a07c75344130b0c43ae5cecc657afc2672a30" 17 SRCREV = "f5822d3223a48fbb57c8bde92579b125ef26fd1f"
18 18
19 S = "${WORKDIR}/git" 19 S = "${WORKDIR}/git"
20 20
21 inherit fsl-u-boot-localversion 21 inherit fsl-u-boot-localversion
22 22
23 LOCALVERSION ?= "-${SRCBRANCH}" 23 LOCALVERSION ?= "-${SRCBRANCH}"
24 24
25 BOOT_TOOLS = "imx-boot-tools" 25 BOOT_TOOLS = "imx-boot-tools"
26 26
27 do_deploy_append_mx8m () { 27 do_deploy_append_mx8m () {
28 # Deploy the mkimage, u-boot-nodtb.bin and fsl-imx8mq-XX.dtb for mkimage to generate boot binary 28 # Deploy the mkimage, u-boot-nodtb.bin and fsl-imx8mq-XX.dtb for mkimage to generate boot binary
29 if [ -n "${UBOOT_CONFIG}" ] 29 if [ -n "${UBOOT_CONFIG}" ]
30 then 30 then
31 for config in ${UBOOT_MACHINE}; do 31 for config in ${UBOOT_MACHINE}; do
32 i=$(expr $i + 1); 32 i=$(expr $i + 1);
33 for type in ${UBOOT_CONFIG}; do 33 for type in ${UBOOT_CONFIG}; do
34 j=$(expr $j + 1); 34 j=$(expr $j + 1);
35 if [ $j -eq $i ] 35 if [ $j -eq $i ]
36 then 36 then
37 install -d ${DEPLOYDIR}/${BOOT_TOOLS} 37 install -d ${DEPLOYDIR}/${BOOT_TOOLS}
38 install -m 0777 ${B}/${config}/arch/arm/dts/${UBOOT_DTB_NAME} ${DEPLOYDIR}/${BOOT_TOOLS} 38 install -m 0777 ${B}/${config}/arch/arm/dts/${UBOOT_DTB_NAME} ${DEPLOYDIR}/${BOOT_TOOLS}
39 install -m 0777 ${B}/${config}/tools/mkimage ${DEPLOYDIR}/${BOOT_TOOLS}/mkimage_uboot 39 install -m 0777 ${B}/${config}/tools/mkimage ${DEPLOYDIR}/${BOOT_TOOLS}/mkimage_uboot
40 install -m 0777 ${B}/${config}/u-boot-nodtb.bin ${DEPLOYDIR}/${BOOT_TOOLS}/u-boot-nodtb.bin-${MACHINE}-${UBOOT_CONFIG} 40 install -m 0777 ${B}/${config}/u-boot-nodtb.bin ${DEPLOYDIR}/${BOOT_TOOLS}/u-boot-nodtb.bin-${MACHINE}-${UBOOT_CONFIG}
41 fi 41 fi
42 done 42 done
43 unset j 43 unset j
44 done 44 done
45 unset i 45 unset i
46 fi 46 fi
47 47
48 } 48 }
49 49
50 PACKAGE_ARCH = "${MACHINE_ARCH}" 50 PACKAGE_ARCH = "${MACHINE_ARCH}"
51 COMPATIBLE_MACHINE = "(mx6|mx7|mx8)" 51 COMPATIBLE_MACHINE = "(mx6|mx7|mx8)"
52 52
53 UBOOT_NAME_mx6 = "u-boot-${MACHINE}.bin-${UBOOT_CONFIG}" 53 UBOOT_NAME_mx6 = "u-boot-${MACHINE}.bin-${UBOOT_CONFIG}"
54 UBOOT_NAME_mx7 = "u-boot-${MACHINE}.bin-${UBOOT_CONFIG}" 54 UBOOT_NAME_mx7 = "u-boot-${MACHINE}.bin-${UBOOT_CONFIG}"
55 UBOOT_NAME_mx8 = "u-boot-${MACHINE}.bin-${UBOOT_CONFIG}" 55 UBOOT_NAME_mx8 = "u-boot-${MACHINE}.bin-${UBOOT_CONFIG}"
56 56
recipes-kernel/linux/linux-smarcimx8m_4.14.78.bb
1 # Copyright (C) 2013-2016 Freescale Semiconductor File was deleted
2 # Copyright 2017 NXP
3 # Copyright 2018-2019 Embedian, Inc.
4 # Released under the MIT license (see COPYING.MIT for the terms)
5
6 SUMMARY = "Linux kernel provided and supported by Embedian"
7 DESCRIPTION = "Linux kernel provided and supported by Embedian (based on the kernel imx_4.14.78_1.0.0_ga provided by NXP) \
8 with focus on i.MX Family SOMs. It includes support for many IPs such as GPU, VPU and IPU."
9
10 require recipes-kernel/linux/linux-imx.inc
11
12 DEPENDS += "lzop-native bc-native"
13
14 DEFAULT_PREFERENCE = "1"
15
16 SRCBRANCH = "smarc_8m_imx_4.14.78_1.0.0_ga"
17
18 LOCALVERSION = "-${SRCBRANCH}"
19 KERNEL_DEFCONFIG = "${S}/arch/arm64/configs/smarcimx8m_defconfig"
20 DEFAULT_DTB = "fsl-smarcimx8mq"
21
22 KERNEL_SRC ?= "git@git.embedian.com:developer/smarc-fsl-linux-kernel.git;protocol=git"
23 SRC_URI = "${EMB_KERNEL_MIRROR};protocol=ssh;branch=${SRCBRANCH}"
24 SRCREV = "5391ef46f0e83d177b39b575518a70df15d8dcc2"
25
26 S = "${WORKDIR}/git"
27
28 addtask copy_defconfig after do_unpack before do_preconfigure
29 do_copy_defconfig () {
30 install -d ${B}
31 mkdir -p ${B}
32 cp ${KERNEL_DEFCONFIG} ${B}/.config
33 cp ${KERNEL_DEFCONFIG} ${B}/../defconfig
34 }
35
36 pkg_postinst_kernel-devicetree_append_mx8 () {
37 cd $D/boot
38 ln -s ${DEFAULT_DTB}.dtb ${UBOOT_DTB_NAME}
39 }
40
41 COMPATIBLE_MACHINE = "(mx6|mx7|mx8)"
42 EXTRA_OEMAKE_append_mx8 = " ARCH=arm64"
43 1 # Copyright (C) 2013-2016 Freescale Semiconductor
recipes-kernel/linux/linux-smarcimx8m_4.14.98.bb
File was created 1 # Copyright (C) 2013-2016 Freescale Semiconductor
2 # Copyright 2017 NXP
3 # Copyright 2018-2019 Embedian, Inc.
4 # Released under the MIT license (see COPYING.MIT for the terms)
5
6 SUMMARY = "Linux kernel provided and supported by Embedian"
7 DESCRIPTION = "Linux kernel provided and supported by Embedian (based on the kernel imx_4.14.78_1.0.0_ga provided by NXP) \
8 with focus on i.MX Family SOMs. It includes support for many IPs such as GPU, VPU and IPU."
9
10 require recipes-kernel/linux/linux-imx.inc
11
12 DEPENDS += "lzop-native bc-native"
13
14 DEFAULT_PREFERENCE = "1"
15
16 SRCBRANCH = "smarc_8m_imx_4.14.98_2.0.0_ga"
17
18 LOCALVERSION = "-${SRCBRANCH}"
19 KERNEL_DEFCONFIG = "${S}/arch/arm64/configs/smarcimx8m_defconfig"
20 DEFAULT_DTB = "fsl-smarcimx8mq"
21
22 KERNEL_SRC ?= "git@git.embedian.com:developer/smarc-fsl-linux-kernel.git;protocol=git"
23 SRC_URI = "${EMB_KERNEL_MIRROR};protocol=ssh;branch=${SRCBRANCH}"
24 SRCREV = "eded7c98ab8eccc988eddf2dcbca68c937c324e8"
25
26 S = "${WORKDIR}/git"
27
28 addtask copy_defconfig after do_unpack before do_preconfigure
29 do_copy_defconfig () {
30 install -d ${B}
31 mkdir -p ${B}
32 cp ${KERNEL_DEFCONFIG} ${B}/.config
33 cp ${KERNEL_DEFCONFIG} ${B}/../defconfig
34 }
35
36 pkg_postinst_kernel-devicetree_append_mx8 () {
37 cd $D/boot
38 ln -s ${DEFAULT_DTB}.dtb ${UBOOT_DTB_NAME}
39 }
40
41 COMPATIBLE_MACHINE = "(mx6|mx7|mx8)"
42 EXTRA_OEMAKE_append_mx8 = " ARCH=arm64"
43
scripts/emb_mk_yocto_sdcard/README.txt
File was created 1 How to use the Embedian SD card creation script:
2 =================================================
3
4 This utility is provided on an "AS IS" basis.
5 This is the script we use to create our recovery SD card.
6 For machines with Android support, it is a part of a larger script we use to create our recovery SD card, which also includes Android.
7 It is a good example for using the output of the Yocto build to create a bootable SD card, and use it to flash the target NAND flash/eMMC.
8
9 Note:
10 Before running this script you need to bitbake fsl-image-gui.
11
12
13 Usage:
14 sudo MACHINE=<smarcimx8m2g|smarcimx8m4g> ./emb-create-yocto-sdcard.sh [options] /dev/sdX
15 (Change /dev/sdX to your device name)
16
17 options:
18 -h Display help message
19 -s Only show partition sizes to be written, without actually write them
20 -a Automatically set the rootfs partition size to fill the SD card
21 -r Select alternative rootfs for recovery images (default: build_x11/tmp/deploy/images/<machine name>/fsl-image-validation-imx.tar.bz2)
22
23 If you don't use the '-a' option, a default rootfs size of 3700MiB will be used.
24 The '-r' option allows you to create a bootable sdcard with an alternative image for the installation to NAND flash or eMMC.
25 Example: "-r tmp/deploy/images/<machine name>/fsl-image-qt5-validation-imx" -- selects the "Qt5 image with X11" recovery image
26
27
28 Once the script is done, use the SD card to boot, and then to flash your internal storage/s either use the icons,
29 or the following linux shell script:
30 install_yocto.sh
31
scripts/emb_mk_yocto_sdcard/emb-create-yocto-emmc.sh
File was created 1 #!/bin/bash -e
2
3 blue_underlined_bold_echo()
4 {
5 echo -e "\e[34m\e[4m\e[1m$@\e[0m"
6 }
7
8 blue_bold_echo()
9 {
10 echo -e "\e[34m\e[1m$@\e[0m"
11 }
12
13 red_bold_echo()
14 {
15 echo -e "\e[31m\e[1m$@\e[0m"
16 }
17
18 IMGS_PATH=/opt/images/Yocto
19 UBOOT_IMAGE=imx-boot-sd.bin
20 KERNEL_IMAGE=Image
21 ROOTFS_IMAGE=rootfs.tar.bz2
22 BOOTLOADER_RESERVED_SIZE=2
23 PART1_SIZE=48
24 BOOTLOADER_OFFSET=33
25 DISPLAY=-hdmi
26 PART=p
27 BOOTPART=1
28 ROOTFSPART=2
29 BOOTDIR=/boot
30
31 check_board()
32 {
33 if grep -q "i.MX8M" /sys/devices/soc0/soc_id; then
34 BOARD=smarc-imx8m
35 DTB_PREFIX=fsl-smarcimx8mq
36 BLOCK=mmcblk0
37
38 if [[ $DISPLAY != "-lvds" && $DISPLAY != "-hdmi" && \
39 $DISPLAY != "-dual-display" && $DISPLAY != "" ]]; then
40 red_bold_echo "ERROR: invalid display, should be lvds, hdmi, dual-display or empty"
41 exit 1
42 fi
43 else
44 red_bold_echo "ERROR: Unsupported board"
45 exit 1
46 fi
47
48
49 if [[ ! -b /dev/${BLOCK} ]] ; then
50 red_bold_echo "ERROR: Can't find eMMC device (/dev/${BLOCK})."
51 red_bold_echo "Please verify you are using the correct options for your SMARC Module."
52 exit 1
53 fi
54 }
55
56 check_images()
57 {
58 if [[ ! -f $IMGS_PATH/$UBOOT_IMAGE ]] ; then
59 red_bold_echo "ERROR: \"$IMGS_PATH/$UBOOT_IMAGE\" does not exist"
60 exit 1
61 fi
62
63 if [[ ! -f $IMGS_PATH/$KERNEL_IMAGE ]] ; then
64 red_bold_echo "ERROR: \"$IMGS_PATH/$KERNEL_IMAGE\" does not exist"
65 exit 1
66 fi
67
68 if [[ ! -f $IMGS_PATH/${DTB_PREFIX}${DISPLAY}.dtb ]] ; then
69 red_bold_echo "ERROR: \"$IMGS_PATH/${DTB_PREFIX}${DISPLAY}.dtb\" does not exist"
70 exit 1
71 fi
72
73 if [[ ! -f $IMGS_PATH/uEnv.txt ]] ; then
74 red_bold_echo "ERROR: \"$IMGS_PATH/uEnv.txt\" does not exist"
75 exit 1
76 fi
77
78 if [[ ! -f $IMGS_PATH/$ROOTFS_IMAGE ]] ; then
79 red_bold_echo "ERROR: \"$IMGS_PATH/$ROOTFS_IMAGE\" does not exist"
80 exit 1
81 fi
82 }
83
84 delete_emmc()
85 {
86 echo
87 blue_underlined_bold_echo "Deleting current partitions"
88
89 umount /dev/${BLOCK}${PART}* 2>/dev/null || true
90
91 for ((i=1; i<=16; i++)); do
92 if [[ -e /dev/${BLOCK}${PART}${i} ]]; then
93 dd if=/dev/zero of=/dev/${BLOCK}${PART}${i} bs=1M count=1 2>/dev/null || true
94 fi
95 done
96 sync
97
98 dd if=/dev/zero of=/dev/${BLOCK} bs=1M count=${BOOTLOADER_RESERVED_SIZE}
99
100 sync; sleep 1
101 }
102
103 create_emmc_parts()
104 {
105 echo
106 blue_underlined_bold_echo "Creating new partitions"
107
108 SECT_SIZE_BYTES=`cat /sys/block/${BLOCK}/queue/hw_sector_size`
109 PART1_FIRST_SECT=$(($BOOTLOADER_RESERVED_SIZE * 1024 * 1024 / $SECT_SIZE_BYTES))
110 PART1_END_SECT=$((($BOOTLOADER_RESERVED_SIZE + $PART1_SIZE) * 1024 * 1024 / $SECT_SIZE_BYTES))
111 PART2_FIRST_SECT=`expr ${PART1_END_SECT} + 1`
112
113 (echo n; echo p; echo $BOOTPART; echo $PART1_FIRST_SECT; \
114 echo $PART1_END_SECT; echo n; echo p; echo $ROOTFSPART; \
115 echo $PART2_FIRST_SECT; echo; \
116 echo p; echo w) | fdisk -u /dev/${BLOCK} > /dev/null
117
118 sync; sleep 1
119 fdisk -u -l /dev/${BLOCK}
120 }
121
122 format_emmc_parts()
123 {
124 echo
125 blue_underlined_bold_echo "Formatting partitions"
126
127 mkfs.vfat -F 16 /dev/${BLOCK}${PART}${BOOTPART} -n boot
128 mkfs.ext4 /dev/${BLOCK}${PART}${ROOTFSPART} -L rootfs
129
130 sync; sleep 1
131 }
132
133 install_bootloader_to_emmc()
134 {
135 echo
136 blue_underlined_bold_echo "Installing booloader"
137
138 dd if=${IMGS_PATH}/${UBOOT_IMAGE} of=/dev/${BLOCK} bs=1K seek=${BOOTLOADER_OFFSET}
139 sync
140 }
141
142 install_kernel_to_emmc()
143 {
144 echo
145 blue_underlined_bold_echo "Installing kernel"
146
147 MOUNTDIR=/run/media/${BLOCK}${PART}${BOOTPART}
148 mkdir -p ${MOUNTDIR}
149 mount /dev/${BLOCK}${PART}${BOOTPART} ${MOUNTDIR}
150 mkdir -p ${MOUNTDIR}/dtbs/
151 cp -v ${IMGS_PATH}/${KERNEL_IMAGE} ${MOUNTDIR}
152 cp -v ${IMGS_PATH}/${DTB_PREFIX}${DISPLAY}.dtb ${MOUNTDIR}/dtbs/fsl-smarcimx8mq.dtb
153 cp -v ${IMGS_PATH}/uEnv.txt ${MOUNTDIR}
154
155 echo
156 sync
157
158 umount ${MOUNTDIR}
159 }
160
161 install_rootfs_to_emmc()
162 {
163 echo
164 blue_underlined_bold_echo "Installing rootfs"
165
166 MOUNTDIR=/run/media/${BLOCK}${PART}${ROOTFSPART}
167 mkdir -p ${MOUNTDIR}
168 mount /dev/${BLOCK}${PART}${ROOTFSPART} ${MOUNTDIR}
169
170 printf "Extracting files"
171 tar --warning=no-timestamp -jxvf ${IMGS_PATH}/${ROOTFS_IMAGE} -C ${MOUNTDIR} --checkpoint=.1200
172
173 # Create DTB symlink
174 (cd ${MOUNTDIR}/${BOOTDIR}; ln -fs ${DTB_PREFIX}${DISPLAY}.dtb ${DTB_PREFIX}.dtb)
175
176 echo
177 sync
178
179 umount ${MOUNTDIR}
180 }
181
182 stop_udev()
183 {
184 if [ -f /lib/systemd/system/systemd-udevd.service ]; then
185 systemctl -q mask --runtime systemd-udevd
186 systemctl -q stop systemd-udevd
187 fi
188 }
189
190 start_udev()
191 {
192 if [ -f /lib/systemd/system/systemd-udevd.service ]; then
193 systemctl -q unmask --runtime systemd-udevd
194 systemctl -q start systemd-udevd
195 fi
196 }
197
198 usage()
199 {
200 echo
201 echo "This script installs Yocto Rootfs on the SMARC-iMX8M's internal eMMC storage device"
202 echo
203 echo " Usage: $(basename $0) <option>"
204 echo
205 echo " options:"
206 echo " -h show help message"
207 echo " -d <lvds|hdmi|dual-display> set display type, default is lvds"
208 echo
209 }
210
211 finish()
212 {
213 echo
214 blue_bold_echo "Yocto Sumo installed successfully"
215 exit 0
216 }
217
218 #################################################
219 # Execution starts here #
220 #################################################
221
222 if [[ $EUID != 0 ]] ; then
223 red_bold_echo "This script must be run with super-user privileges"
224 exit 1
225 fi
226
227 blue_underlined_bold_echo "*** Embedian SMARC-iMX8M on-module eMMC Recovery ***"
228 echo
229
230 while getopts d:h OPTION;
231 do
232 case $OPTION in
233 d)
234 DISPLAY=$OPTARG
235 ;;
236 h)
237 usage
238 exit 0
239 ;;
240 *)
241 usage
242 exit 1
243 ;;
244 esac
245 done
246
247 printf "Board: "
248 blue_bold_echo $BOARD
249
250 printf "Installing to internal storage device: "
251 blue_bold_echo eMMC
252
253 check_board
254 check_images
255 stop_udev
256 delete_emmc
257 create_emmc_parts
258 format_emmc_parts
259 install_bootloader_to_emmc
260 install_kernel_to_emmc
261 install_rootfs_to_emmc
262 start_udev
263 finish
264
scripts/emb_mk_yocto_sdcard/emb-create-yocto-sdcard.sh
File was created 1 #!/bin/bash
2 set -e
3
4 #### Script version ####
5 SCRIPT_NAME=${0##*/}
6 readonly SCRIPT_VERSION="0.7"
7
8 #### Exports Variables ####
9 #### global variables ####
10 readonly ABSOLUTE_FILENAME=`readlink -e "$0"`
11 readonly ABSOLUTE_DIRECTORY=`dirname ${ABSOLUTE_FILENAME}`
12 readonly SCRIPT_POINT=${ABSOLUTE_DIRECTORY}
13 readonly SCRIPT_START_DATE=`date +%Y%m%d`
14
15 readonly YOCTO_ROOT="${SCRIPT_POINT}/../../../../"
16
17 readonly BSP_TYPE="YOCTO"
18 readonly YOCTO_BUILD=${YOCTO_ROOT}/imx8m-build-qt5wayland
19 readonly YOCTO_DEFAULT_IMAGE=fsl-image-qt5-validation-imx
20
21 readonly YOCTO_SCRIPTS_PATH=${SCRIPT_POINT}
22 readonly YOCTO_IMGS_PATH=${YOCTO_BUILD}/tmp/deploy/images/${MACHINE}
23
24 ## display (one of "-hdmi", "-lcdif-lvds", "-dp", "-dcss-lvds", "-dual-display", "-edp")
25 readonly DISPLAY="-hdmi"
26
27 # $1 -- block device
28 # $2 -- output images dir
29 readonly LPARAM_BLOCK_DEVICE=${1}
30 readonly LPARAM_OUTPUT_DIR=${2}
31 readonly P1_MOUNT_DIR="${G_TMP_DIR}/p1"
32 readonly P2_MOUNT_DIR="${G_TMP_DIR}/p2"
33
34 readonly BOOTLOAD_RESERVE_SIZE=2
35 readonly PART1_SIZE=48
36 readonly BOOTPART=1
37 readonly ROOTFSPART=2
38 readonly SPARE_SIZE=4
39
40 # Sizes are in MiB
41 BOOTLOADER_OFFSET=33
42
43 AUTO_FILL_SD=0
44 LOOP_MAJOR=7
45
46 # This function performs sanity check to verify that the target device is removable devise of proper size
47 function check_device()
48 {
49 # Check that parameter is a valid block device
50 if [ ! -b "$1" ]; then
51 echo "$1 is not a valid block device, exiting"
52 exit 1
53 fi
54
55 local dev=$(basename $1)
56
57 # Check that /sys/block/$dev exists
58 if [ ! -d /sys/block/$dev ]; then
59 echo "Directory /sys/block/${dev} missing, exiting"
60 exit 1
61 fi
62
63 # Get device parameters
64 local removable=$(cat /sys/block/${dev}/removable)
65 local size_bytes=$((512*$(cat /sys/class/block/${dev}/size)))
66 local size_gb=$((size_bytes/1000000000))
67
68 # Non-removable SD card readers require additional check
69 if [ "${removable}" != "1" ]; then
70 local drive=$(udisksctl info -b /dev/${dev}|grep "Drive:"|cut -d"'" -f 2)
71 local mediaremovable=$(gdbus call --system --dest org.freedesktop.UDisks2 \
72 --object-path ${drive} --method org.freedesktop.DBus.Properties.Get \
73 org.freedesktop.UDisks2.Drive MediaRemovable)
74 if [[ "${mediaremovable}" = *"true"* ]]; then
75 removable=1
76 fi
77 fi
78
79 # Check that device is either removable or loop
80 if [ "$removable" != "1" -a $(stat -c '%t' /dev/$dev) != ${LOOP_MAJOR} ]; then
81 echo "$1 is not a removable device, exiting"
82 exit 1
83 fi
84
85 # Check that device is attached
86 if [ ${size_bytes} -eq 0 ]; then
87 echo "$1 is not attached, exiting"
88 exit 1
89 fi
90
91 # Check that device has a valid size
92 echo "Detected removable device $1, size=${size_gb}GB"
93 }
94
95 YOCTO_RECOVERY_ROOTFS_PATH=${YOCTO_IMGS_PATH}
96
97 echo "================================================"
98 echo "= Embedian recovery SD card creation script ="
99 echo "================================================"
100
101 help() {
102 bn=`basename $0`
103 echo " Usage: MACHINE=<smarcimx8m2g|smarcimx8m4g> $bn <options> device_node"
104 echo
105 echo " options:"
106 echo " -h display this Help message"
107 echo " -s only Show partition sizes to be written, without actually write them"
108 echo " -a Automatically set the rootfs partition size to fill the SD card (leaving spare ${SPARE_SIZE}MiB)"
109 echo " -r ROOTFS_NAME select an alternative Rootfs for recovery images"
110 echo " (default: \"${YOCTO_RECOVERY_ROOTFS_PATH}/${YOCTO_DEFAULT_IMAGE}\")"
111 echo " -n TEXT_FILE add a release Notes text file"
112 echo
113 }
114
115 if [[ $EUID -ne 0 ]] ; then
116 echo "This script must be run with super-user privileges"
117 exit 1
118 fi
119
120 if [[ $MACHINE != "smarcimx8m2g" && $MACHINE != "smarcimx8m4g" ]] ; then
121 help
122 exit 1
123 fi
124
125
126 # Parse command line
127 moreoptions=1
128 node="na"
129 cal_only=0
130
131 while [ "$moreoptions" = 1 -a $# -gt 0 ]; do
132 case $1 in
133 -h) help; exit 3 ;;
134 -s) cal_only=1 ;;
135 -a) AUTO_FILL_SD=1 ;;
136 -r) shift;
137 YOCTO_RECOVERY_ROOTFS_MASK_PATH=`readlink -e "${1}.tar.bz2"`;
138 YOCTO_RECOVERY_ROOTFS_PATH=`dirname ${YOCTO_RECOVERY_ROOTFS_MASK_PATH}`
139 YOCTO_RECOVERY_ROOTFS_BASE_IN_NAME=`basename ${1}`
140 ;;
141 -n) shift;
142 RELEASE_NOTES_FILE=${1}
143 ;;
144 *) moreoptions=0;;
145 esac
146 [ "$moreoptions" = 0 ] && [ $# -gt 1 ] && help && exit 1
147 [ "$moreoptions" = 1 ] && shift
148 done
149
150 part=""
151 if [ `echo ${LPARAM_BLOCK_DEVICE} | grep -c mmcblk` -ne 0 ]; then
152 part="p"
153 fi
154
155 # allow only removable/loopback devices, to protect host PC
156 echo "MACHINE=${MACHINE}"
157 echo "SD card rootfs: ${YOCTO_DEFAULT_IMAGE}"
158 echo "Recovery rootfs: ${YOCTO_DEFAULT_IMAGE}"
159 echo "================================================"
160 check_device ${LPARAM_BLOCK_DEVICE}
161 echo "================================================"
162 read -p "Press Enter to continue"
163
164 function delete_device
165 {
166 echo
167 echo "Deleting current partitions"
168 for ((i=0; i<10; i++))
169 do
170 if [ `ls ${LPARAM_BLOCK_DEVICE}${part}$i 2> /dev/null | grep -c ${LPARAM_BLOCK_DEVICE}${part}$i` -ne 0 ]; then
171 dd if=/dev/zero of=${LPARAM_BLOCK_DEVICE}${part}$i bs=512 count=1024
172 fi
173 done
174 sync
175
176 ((echo d; echo 1; echo d; echo 2; echo d; echo 3; echo d; echo w) | fdisk ${LPARAM_BLOCK_DEVICE} &> /dev/null) || true
177 sync
178
179 dd if=/dev/zero of=${LPARAM_BLOCK_DEVICE} bs=1M count=${BOOTLOAD_RESERVE_SIZE}
180 sync; sleep 1
181 }
182
183 function ceildiv
184 {
185 local num=$1
186 local div=$2
187 echo $(( (num + div - 1) / div ))
188 }
189
190 function create_parts
191 {
192 echo
193 echo "Creating new partitions"
194 # Get total card size
195 TOTAL_SIZE=`fdisk -s ${LPARAM_BLOCK_DEVICE}`
196 TOTAL_SIZE=`expr ${TOTAL_SIZE} / 1024`
197 ROOTFS_SIZE=`expr ${TOTAL_SIZE} - ${BOOTLOAD_RESERVE_SIZE} - ${PART1_SIZE} - ${SPARE_SIZE}`
198
199 echo "ROOT SIZE=${ROOTFS_SIZE} TOTAl SIZE=${TOTAL_SIZE}"
200
201 BLOCK=`echo ${LPARAM_BLOCK_DEVICE} | cut -d "/" -f 3`
202 SECT_SIZE_BYTES=`cat /sys/block/${BLOCK}/queue/physical_block_size`
203
204 BOOTLOAD_RESERVE_SIZE_BYTES=$((BOOTLOAD_RESERVE_SIZE * 1024 * 1024))
205 PART1_SIZE_BYTES=$((PART1_SIZE * 1024 * 1024))
206 PART1_END_BYTES=`expr ${BOOTLOAD_RESERVE_SIZE_BYTES} + ${PART1_SIZE_BYTES}`
207 ROOTFS_SIZE_BYTES=$((ROOTFS_SIZE * 1024 * 1024))
208
209 PART1_FIRST_SECT=`ceildiv ${BOOTLOAD_RESERVE_SIZE_BYTES} ${SECT_SIZE_BYTES}`
210 PART1_END_SECT=`ceildiv ${PART1_END_BYTES} ${SECT_SIZE_BYTES}`
211 PART2_FIRST_SECT=`expr ${PART1_END_SECT} + 1 `
212
213 (echo n; echo p; echo $BOOTPART; echo $PART1_FIRST_SECT; \
214 echo $PART1_END_SECT; echo n; echo p; echo $ROOTFSPART; \
215 echo $PART2_FIRST_SECT; echo; echo p; echo w) | fdisk -u ${LPARAM_BLOCK_DEVICE} > /dev/null
216
217 sleep 2; sync;
218 fdisk -l ${LPARAM_BLOCK_DEVICE}
219
220 sleep 2; sync;
221 }
222
223 function format_parts
224 {
225 echo
226 echo "Formatting partitions"
227 mkfs.vfat -F 16 ${LPARAM_BLOCK_DEVICE}${part}1 -n boot
228 mkfs.ext4 ${LPARAM_BLOCK_DEVICE}${part}2 -L rootfs
229 sync; sleep 1
230 }
231
232 function install_bootloader
233 {
234 echo
235 echo "Installing U-Boot"
236 dd if=${YOCTO_IMGS_PATH}/imx-boot-${MACHINE}-sd.bin-flash_evk of=${LPARAM_BLOCK_DEVICE} bs=1K seek=${BOOTLOADER_OFFSET}; sync
237 }
238
239 function mount_parts
240 {
241 mkdir -p ${P1_MOUNT_DIR}
242 mkdir -p ${P2_MOUNT_DIR}
243 sync
244
245 mount ${LPARAM_BLOCK_DEVICE}${part}1 ${P1_MOUNT_DIR}
246 mount ${LPARAM_BLOCK_DEVICE}${part}2 ${P2_MOUNT_DIR}
247 sleep 2; sync;
248 }
249
250 function unmount_parts
251 {
252 umount ${P1_MOUNT_DIR}
253 umount ${P2_MOUNT_DIR}
254
255 rm -rf ${P1_MOUNT_DIR}
256 rm -rf ${P2_MOUNT_DIR}
257 }
258
259 function install_yocto
260 {
261 echo
262 echo "Flashing \"Image, device tree and uEnv.txt\" partition"
263 cp -v ${YOCTO_IMGS_PATH}/Image ${P1_MOUNT_DIR}/
264 mkdir -p ${P1_MOUNT_DIR}/dtbs/
265 cp -v ${YOCTO_IMGS_PATH}/fsl-smarcimx8mq${DISPLAY}.dtb ${P1_MOUNT_DIR}/dtbs/fsl-smarcimx8mq.dtb
266 cp -v ${YOCTO_SCRIPTS_PATH}/uEnv.txt ${P1_MOUNT_DIR}/
267
268 echo
269 echo "Installing Yocto Root File System"
270 tar jxvf ${YOCTO_IMGS_PATH}/${YOCTO_DEFAULT_IMAGE}-${MACHINE}.tar.bz2 -C ${P2_MOUNT_DIR}/
271 sync
272 }
273
274 function copy_images
275 {
276 echo
277 echo "Copying Yocto images to /opt/images/"
278 mkdir -p ${P2_MOUNT_DIR}/opt/images/Yocto
279
280 # Copy image for eMMC
281 if [ -f ${YOCTO_IMGS_PATH}/${YOCTO_DEFAULT_IMAGE}-${MACHINE}.tar.bz2 ]; then
282 pv ${YOCTO_IMGS_PATH}/${YOCTO_DEFAULT_IMAGE}-${MACHINE}.tar.bz2 > ${P2_MOUNT_DIR}/opt/images/Yocto/rootfs.tar.bz2
283 else
284 echo "rootfs.tar.gz file is not present. Installation on \"eMMC\" will not be supported."
285 fi
286
287 echo
288 echo "Copying Kernel Images to /opt/images/"
289 cp ${YOCTO_IMGS_PATH}/Image ${P2_MOUNT_DIR}/opt/images/Yocto/Image
290
291 echo
292 echo "Copying Kernel Device Tree Blob to /opt/images/"
293 cp -v ${YOCTO_IMGS_PATH}/*.dtb ${P2_MOUNT_DIR}/opt/images/Yocto/
294
295 echo
296 echo "Copying Kernel Parameter uEnv.txt to /opt/images/"
297 cp -v ${YOCTO_SCRIPTS_PATH}/uEnv_emmc.txt ${P2_MOUNT_DIR}/opt/images/Yocto/uEnv.txt
298
299 if [[ $MACHINE = "smarcimx8m2g" || ${MACHINE} = "smarcimx8m4g" ]]; then
300 cp ${YOCTO_IMGS_PATH}/imx-boot-${MACHINE}-sd.bin-* ${P2_MOUNT_DIR}/opt/images/Yocto
301 (cd ${P2_MOUNT_DIR}/opt/images/Yocto; ln -fs imx-boot-${MACHINE}-sd.bin-flash_evk imx-boot-sd.bin)
302 else
303 cp ${YOCTO_IMGS_PATH}/imx-boot-${MACHINE}-sd.bin ${P2_MOUNT_DIR}/opt/images/Yocto/imx-boot-sd.bin
304 fi
305 }
306
307 function copy_scripts
308 {
309 echo
310 echo "Copying scripts"
311
312 cp ${YOCTO_SCRIPTS_PATH}/emb-create-yocto-emmc.sh ${P2_MOUNT_DIR}/usr/bin/
313 }
314
315 umount ${LPARAM_BLOCK_DEVICE}${part}* 2> /dev/null || true
316
317 delete_device
318 create_parts
319 format_parts
320
321 mount_parts
322 install_yocto
323 copy_images
324 copy_scripts
325
326 echo
327 echo "Syncing"
328 sync | pv -t
329
330 unmount_parts
331
332 install_bootloader
333
334 echo
335 echo "Done"
336 echo "========Flash to SD card Completed!========="
337
338 exit 0
339
scripts/emb_mk_yocto_sdcard/uEnv.txt
File was created 1 optargs="video=HDMI-A-1:1920x1080-32@60 consoleblank=0"
2 #optargs="video=HDMI-A-1:3840x2160-32@30 consoleblank=0"
3 #optargs="video=HDMI-A-1:3840x2160-32@60 consoleblank=0"
4 #console port SER3
5 console=ttymxc0,115200 earlycon=ec_imx6q,0x30860000,115200
6 #console port SER2
7 #console=ttymxc1,115200 earlycon=ec_imx6q,0x30890000,115200
8 #console port SER1
9 #console=ttymxc2,115200 earlycon=ec_imx6q,0x30880000,115200
10 #console port SER0
11 #console=ttymxc3,115200 earlycon=ec_imx6q,0x30A60000,115200
12 mmcdev=1
13 mmcpart=1
14 image=Image
15 loadaddr=0x40480000
16 fdt_addr=0x43000000
17 mmcroot=/dev/mmcblk1p2 rw
18 usbroot=/dev/sda2 rw
19 mmcrootfstype=ext4 rootwait fixrtc
20 netdev=eth0
21 ethact=FEC0
22 ipaddr=192.168.1.150
23 serverip=192.168.1.53
24 gatewayip=192.168.1.254
25 mmcargs=setenv bootargs console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} ${optargs}
26 uenvcmd=run loadimage; run loadfdt; run mmcboot
27 # USB Boot
28 #usbargs=setenv bootargs console=${console} root=${usbroot} rootfstype=${mmcrootfstype} ${optargs}
29 #uenvcmd=run loadusbimage; run loadusbfdt; run usbboot
30
scripts/emb_mk_yocto_sdcard/uEnv_emmc.txt
File was created 1 optargs="video=HDMI-A-1:1920x1080-32@60 consoleblank=0"
2 #optargs="video=HDMI-A-1:3840x2160-32@30 consoleblank=0"
3 #optargs="video=HDMI-A-1:3840x2160-32@60 consoleblank=0"
4 #console port SER3
5 console=ttymxc0,115200 earlycon=ec_imx6q,0x30860000,115200
6 #console port SER2
7 #console=ttymxc1,115200 earlycon=ec_imx6q,0x30890000,115200
8 #console port SER1
9 #console=ttymxc2,115200 earlycon=ec_imx6q,0x30880000,115200
10 #console port SER0
11 #console=ttymxc3,115200 earlycon=ec_imx6q,0x30A60000,115200
12 mmcdev=0
13 mmcpart=1
14 image=Image
15 loadaddr=0x40480000
16 fdt_addr=0x43000000
17 mmcroot=/dev/mmcblk0p2 rw
18 usbroot=/dev/sda2 rw
19 mmcrootfstype=ext4 rootwait fixrtc
20 netdev=eth0
21 ethact=FEC0
22 ipaddr=192.168.1.150
23 serverip=192.168.1.53
24 gatewayip=192.168.1.254
25 mmcargs=setenv bootargs console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} ${optargs}
26 uenvcmd=run loadimage; run loadfdt; run mmcboot
27 # USB Boot
28 #usbargs=setenv bootargs console=${console} root=${usbroot} rootfstype=${mmcrootfstype} ${optargs}
29 #uenvcmd=run loadusbimage; run loadusbfdt; run usbboot
30