diff options
Diffstat (limited to 'classes')
-rw-r--r-- | classes/image_types_fsl.bbclass | 68 |
1 files changed, 48 insertions, 20 deletions
diff --git a/classes/image_types_fsl.bbclass b/classes/image_types_fsl.bbclass index 6877243..8b184f2 100644 --- a/classes/image_types_fsl.bbclass +++ b/classes/image_types_fsl.bbclass | |||
@@ -11,6 +11,12 @@ UBOOT_SUFFIX_SDCARD ?= "${UBOOT_SUFFIX}" | |||
11 | # Handles i.MX mxs bootstream generation | 11 | # Handles i.MX mxs bootstream generation |
12 | # | 12 | # |
13 | 13 | ||
14 | # IMX Bootlets Linux bootstream | ||
15 | IMAGE_DEPENDS_linux.sb = "elftosb-native imx-bootlets virtual/kernel" | ||
16 | IMAGE_CMD_linux.sb = "(cd ${DEPLOY_DIR_IMAGE} ; elftosb -z -c imx-bootlets-linux_prebuilt.db-${MACHINE} \ | ||
17 | -o ${IMAGE_NAME}.linux.sb)" | ||
18 | |||
19 | # U-Boot mxsboot generation to SD-Card | ||
14 | UBOOT_SUFFIX_SDCARD_mxs ?= "mxsboot-sdcard" | 20 | UBOOT_SUFFIX_SDCARD_mxs ?= "mxsboot-sdcard" |
15 | IMAGE_DEPENDS_uboot.mxsboot-sdcard = "u-boot-mxsboot-native u-boot" | 21 | IMAGE_DEPENDS_uboot.mxsboot-sdcard = "u-boot-mxsboot-native u-boot" |
16 | IMAGE_CMD_uboot.mxsboot-sdcard = "mxsboot sd ${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.${UBOOT_SUFFIX} \ | 22 | IMAGE_CMD_uboot.mxsboot-sdcard = "mxsboot sd ${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.${UBOOT_SUFFIX} \ |
@@ -57,6 +63,10 @@ generate_imx_sdcard () { | |||
57 | parted ${SDCARD} print | 63 | parted ${SDCARD} print |
58 | 64 | ||
59 | case "${IMAGE_BOOTLOADER}" in | 65 | case "${IMAGE_BOOTLOADER}" in |
66 | imx-bootlets) | ||
67 | bberror "The imx-bootlets is not supported for i.MX based machines" | ||
68 | exit 1 | ||
69 | ;; | ||
60 | u-boot) | 70 | u-boot) |
61 | dd if=${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.${UBOOT_SUFFIX_SDCARD} of=${SDCARD} conv=notrunc seek=2 skip=${UBOOT_PADDING} bs=512 | 71 | dd if=${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.${UBOOT_SUFFIX_SDCARD} of=${SDCARD} conv=notrunc seek=2 skip=${UBOOT_PADDING} bs=512 |
62 | ;; | 72 | ;; |
@@ -85,29 +95,47 @@ generate_imx_sdcard () { | |||
85 | # | 95 | # |
86 | # External variables needed: | 96 | # External variables needed: |
87 | # ${SDCARD_ROOTFS} - the rootfs image to incorporate | 97 | # ${SDCARD_ROOTFS} - the rootfs image to incorporate |
88 | # ${IMAGE_BOOTLOADER} - bootloader to use {u-boot, barebox} | 98 | # ${IMAGE_BOOTLOADER} - bootloader to use {imx-bootlets, u-boot} |
89 | # | ||
90 | # The disk layout used is: | ||
91 | # | ||
92 | # 1M - 2M - reserved to bootloader and other data | ||
93 | # 2M - BOOT_SPACE - kernel | ||
94 | # BOOT_SPACE - SDCARD_SIZE - rootfs | ||
95 | # | 99 | # |
96 | generate_mxs_sdcard () { | 100 | generate_mxs_sdcard () { |
97 | # Create partition table | 101 | # Create partition table |
98 | parted -s ${SDCARD} mklabel msdos | 102 | parted -s ${SDCARD} mklabel msdos |
99 | parted -s ${SDCARD} mkpart primary 1MiB 2MiB | ||
100 | parted -s ${SDCARD} mkpart primary 2MiB ${BOOT_SPACE} | ||
101 | parted -s ${SDCARD} mkpart primary ${BOOT_SPACE} 100% | ||
102 | parted ${SDCARD} print | ||
103 | |||
104 | # Change partition type for mxs processor family | ||
105 | bbnote "Setting partition type to 0x53 as required for mxs' SoC family." | ||
106 | echo -n S | dd of=${SDCARD} bs=1 count=1 seek=450 conv=notrunc | ||
107 | 103 | ||
108 | case "${IMAGE_BOOTLOADER}" in | 104 | case "${IMAGE_BOOTLOADER}" in |
105 | imx-bootlets) | ||
106 | # The disk layout used is: | ||
107 | # | ||
108 | # 1M - BOOT_SPACE - kernel | ||
109 | # BOOT_SPACE - SDCARD_SIZE - rootfs | ||
110 | # | ||
111 | parted -s ${SDCARD} mkpart primary 1MiB ${BOOT_SPACE} | ||
112 | parted -s ${SDCARD} mkpart primary ${BOOT_SPACE} 100% | ||
113 | |||
114 | # Empty 4 bytes from boot partition | ||
115 | dd if=/dev/zero of=${SDCARD} conv=notrunc seek=2048 count=4 | ||
116 | |||
117 | # Write the bootstream in (2048 + 4) bytes | ||
118 | dd if=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.linux.sb of=${SDCARD} conv=notrunc seek=1 seek=2052 | ||
119 | ;; | ||
109 | u-boot) | 120 | u-boot) |
121 | # The disk layout used is: | ||
122 | # | ||
123 | # 1M - 2M - reserved to bootloader and other data | ||
124 | # 2M - BOOT_SPACE - kernel | ||
125 | # BOOT_SPACE - SDCARD_SIZE - rootfs | ||
126 | # | ||
127 | parted -s ${SDCARD} mkpart primary 1MiB 2MiB | ||
128 | parted -s ${SDCARD} mkpart primary 2MiB ${BOOT_SPACE} | ||
129 | parted -s ${SDCARD} mkpart primary ${BOOT_SPACE} 100% | ||
130 | |||
110 | dd if=${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.${UBOOT_SUFFIX_SDCARD} of=${SDCARD} conv=notrunc seek=1 skip=${UBOOT_PADDING} bs=1MiB | 131 | dd if=${DEPLOY_DIR_IMAGE}/u-boot-${MACHINE}.${UBOOT_SUFFIX_SDCARD} of=${SDCARD} conv=notrunc seek=1 skip=${UBOOT_PADDING} bs=1MiB |
132 | BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDCARD} unit b print \ | ||
133 | | awk '/ 2 / { print substr($4, 1, length($4 -1)) / 1024 }') | ||
134 | |||
135 | mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS | ||
136 | mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/uImage-${MACHINE}.bin ::/uImage | ||
137 | |||
138 | dd if=${WORKDIR}/boot.img of=${SDCARD} conv=notrunc seek=2 bs=1MiB | ||
111 | ;; | 139 | ;; |
112 | *) | 140 | *) |
113 | bberror "Unkown IMAGE_BOOTLOADER value" | 141 | bberror "Unkown IMAGE_BOOTLOADER value" |
@@ -115,12 +143,12 @@ generate_mxs_sdcard () { | |||
115 | ;; | 143 | ;; |
116 | esac | 144 | esac |
117 | 145 | ||
118 | BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDCARD} unit b print \ | 146 | # Change partition type for mxs processor family |
119 | | awk '/ 2 / { print substr($4, 1, length($4 -1)) / 1024 }') | 147 | bbnote "Setting partition type to 0x53 as required for mxs' SoC family." |
120 | mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS | 148 | echo -n S | dd of=${SDCARD} bs=1 count=1 seek=450 conv=notrunc |
121 | mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/uImage-${MACHINE}.bin ::/uImage | 149 | |
150 | parted ${SDCARD} print | ||
122 | 151 | ||
123 | dd if=${WORKDIR}/boot.img of=${SDCARD} conv=notrunc seek=2 bs=1MiB | ||
124 | dd if=${SDCARD_ROOTFS} of=${SDCARD} conv=notrunc seek=1 bs=${BOOT_SPACE} | 152 | dd if=${SDCARD_ROOTFS} of=${SDCARD} conv=notrunc seek=1 bs=${BOOT_SPACE} |
125 | } | 153 | } |
126 | 154 | ||