Hi
I am having trouble with the spam filter so I will split this question into several replies on the same thread to figure out why the spam filter hates me ;-)
I am getting started with an embedded Linux project using Yocto and the i.MX28 evk. So far things have gone pretty well but I have run into a hurdle when trying to get Linux to boot from the NAND flash instead of the SD card.
Before I go more into the questions I will just summarize quickly of what I have done to get a general idea of where I stand.
For starters I followed Yocto Training - HOME to get started with the Yocto concept. I took the generated image, dd it to an SD card and then started Linux on the eval board without any problems. I also played around by adding an ftp-server, sshd and apache just to learn a bit more how to add packages.
解決済! 解決策の投稿を見る。
After my latest post I had a u-boot and a kernel flashed to NAND. I was however mistaken about the load address. Fortunately someone with more knowledge had prepared U-boot with default parameters.
=> printenv loadaddr
loadaddr=0x42000000
I have no clue why it is at 0x42000000 and not at 0x40008000 that I got from uboot-mkimage but the U-boot preloaded value was correct in my case. Anyone with input on this would be appreciated.
Once the kernel has the correct load address it will get much further during startup, all the way to mounting the root file system. For the file system it seemed that ubifs was the modern way to go so thats what I did.
Flashing a ubifs file system on a nand can be done in two ways. You can, for one, flash it with a generic NAND flasher. This requires a ubi image which is created by running ubinize on an existing ubifs image.
The other alternative is to flash a ubifs image through U-Boot, which is what I decided to do. The ubifs image is created by running mkubifs but this is handled automatically by bitbake if you have set ubifs as a target in conf/machine/imx28evk.conf.
IMAGE_FSTYPES ?= "tar.bz2 ext3 uboot.mxsboot-sdcard sdcard ubifs"
However building the ubifs image requires certain parameters set in the same file (conf/machine/imx28evk.conf)
MKUBIFS_ARGS = "--min-io-size 2048 --leb-size 126976 --max-leb-cnt 864"
These values can be found by running ubiattach -m 1 /dev/ubi_ctrl (requires packages mtd-utils and mtd-utils-ubifs) in Linux on your target system. The easiest way to do this is to boot on an SD card, see Task #4 - Deploy and test
However depending on your bootargs you might not have access to /dev/mtdX. If the mtd device is missing, reboot and enter U-Boot and add gpmi (Can not see the NAND device /dev/mtd0 or /dev/mtd1 for micron MT29F1G08ABADA) to the mmcargs.
setenv mmcargs setenv bootargs gpmi ${mtdparts} console=${console_mainline},${baudrate} root=${mmcroot}
run mmcboot
Your /dev/mtdX should be available now. The NAND partitions does not work like normal file system partitions, instead they are entirely logical and setup with an address and a size. In U-Boot the NAND partitions can be setup neatly with the command mtdparts and for many imx boards that can translate just nicely to a booted Linux, but not the imx28. The other boards have an external file where the NAND partitions can be configured but the imx28 has the partition hardcoded in the driver. It can be found (grep for mtd_partition) and modified but then it must be maintained as a kernel patch every time there is an upgrade. Instead I opted for going with the default partition the imx28 nand driver offers: /dev/mtd0 20MiB, /dev/mtd1 has the rest. Verify the numbers using mtdinfo command. My strategy is to put bootloader, environment and kernel in /dev/mtd0 and in /dev/mtd1 I put filesystems by using multiple ubifs volumes in the same partition.
So analyzing the output from ubiattach -m 1 /dev/ubi_ctrl
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 126976 bytes
UBI: smallest flash I/O unit: 2048
UBI: VID header offset: 2048 (aligned 2048)
UBI: data offset: 4096
UBI: attached mtd1 to ubi0
UBI: MTD device name: "gpmi-nfc-general-use"
UBI: MTD device size: 108 MiB
UBI: number of good PEBs: 864
UBI: number of bad PEBs: 0
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 0
UBI: available PEBs: 852
UBI: total number of reserved PEBs: 12
UBI: number of PEBs reserved for bad PEB handling: 8
UBI: max/mean erase counter: 1/1
UBI: image sequence number: 0
UBI: background thread "ubi_bgt0d" started, PID 397
UBI device number 0, total 864 LEBs (109707264 bytes, 104.6 MiB), available 852 LEBs (108183552 bytes, 103.2 MiB), LEB size 126976 by)
Use the values to set the MKUBIFS_ARGS to get a ubifs image that will work for your NAND flash.
Now since we are reconsidering the partitioning lets recap where to put stuff and start from the point where we only have u-boot on the nand.
First lets build the partition table using mtdparts default and then we delete the incorrectly placed file system.
mtdparts default
mtdparts del filesystem
Then we place the file system after the first 20MiB. I use a 128MiB NAND here.
mtdparts add nand0 0x06C00000@0x1400000 filesystem
The partition table should look like this now
=> mtdparts
device nand0 <gpmi-nand>, # parts = 7
#: name size offset mask_flags
0: bootloader 0x00300000 0x00000000 1
1: environment 0x00080000 0x00300000 0
2: redundant-environment0x00080000 0x00380000 0
3: kernel 0x00400000 0x00400000 0
4: fdt 0x00080000 0x00800000 0
5: ramdisk 0x00800000 0x00880000 0
6: filesystem 0x06c00000 0x01400000 0
Lets save the partition table to the environment.
saveenv
Now let us first flash the kernel where it is supposed to be. As usual we download it from a USB thumb since I haven't gotten to setup TFTP yet.
usb start
fatls usb 0:1
nand erase.part kernel
fatload usb 0:1 ${loadaddr} uimage-imx28evk.bin
nand write ${loadaddr} kernel
Now the kernel is in place, lets setup the kernel boot arguments. U-boot comes with a default environment nandargs which is almost entirely correct for us.
nandargs=setenv bootargs console=${console_mainline},${baudrate} rootfstype=ubifs ubi.mtd=6 root=ubi0_0 ${mtdparts}
The part that is incorrect for us is ubi.mtd=6 as we are planning to have the filesystem on mtd1. So we take the setenv part and runs it manually. It is also important to add the gpmi argument so the nand driver will load.
setenv bootargs gpmi console=${console_mainline},${baudrate} rootfstype=ubifs ubi.mtd=1 root=ubi0_0 ${mtdparts}
setenv bootcmd 'nboot kernel; bootm'
saveenv
We can now try to boot and should get as far as trying to mount the root file system.
So now it is time to put in our ubifs image into nand. First we load the ubifs image into memory.
usb start
fatls usb 0:1
fatload usb 0:1 ${loadaddr} core-image-minimal-imx28evk.ubifs
Then we erase the filesystem partition.
nand erase.part filesystem
We set the ubi subsystem to work with the filesystem partition
ubi part filesystem
We create a volume. Since we don't set type or size it becomes dynamic and covers the entire size.
ubi create rootfs
Write the loaded image to the newly created volume. If we had created multiple volumes we chose which volume to receive the image. Useful for having multiple filesystems/partitions.
ubi write ${loadaddr} rootfs ${filesize}
Finally we mount the file system locally to verify that it looks ok.
ubifsmount ubi0:rootfs
ubifsls
Now we can reboot and this time Linux should start properly. It did for me and I hope it will work for you too!
Hi Per Smitt,
Can you let us know how the following crash in the rootfs was solved . I am getting similar error when trying to boot an Angstrong image on imx28evk board.
undefined instruction
pc : [<40008010>] lr : [<47f38440>]
sp : 47b32d70 ip : 00000000 fp : 00000000
r10: 00000000 r9 : 47b32f38 r8 : 47b417dc
r7 : 00000000 r6 : 40008000 r5 : 47f9f724 r4 : 00000000
r3 : 47b32fe0 r2 : 40000100 r1 : 000009e3 r0 : 47b32fe0
Flags: nZCv IRQs off FIQs off Mode SVC_32
Resetting CPU ...
Thanks in advance,
Sonu Abraham
Hi persmitt ,
You said you had "played around by adding an ftp-server, sshd and apache just to learn a bit more how to add packages",
I'm now trying to add apcahe,mysql and php into my image, but don't know how.
Here are what i have tryed:
I do bitbake php first, and then add "php" and "php-cli" (which inspired by an answer in question Re: Adding php package to fsl-image-machine-test ) into the CORE_IMAGE_EXTRA_INSTALL varible in local.conf, then do "bitbake fsl-image-qt5". I run the image on my imx6 board and happiely find that php works fine.
But when i want to add apache and mysql, that's not work, I find a .bb file for apache: "source/meta-openembedded/meta-webserver/recipes-httpd/apache2/apache2_2.4.10.bb", but I don't know how to use it.
As to mysql, I do as adding php, and I get only a .so file in a deep chlid tree in /usr/lib on the imx6 board.
So how do I get wrong , how do you add apache? Please help me, many thanks!
Just add apache2 to the same variable. If you find a recipe (in this case apache2_2.4.10.bb) simply truncate the name at the underscore and add it to your CORE_IMAGE_EXTRA_INSTALL. That should add apache to your build.
After my latest post I had a u-boot and a kernel flashed to NAND. I was however mistaken about the load address. Fortunately someone with more knowledge had prepared U-boot with default parameters.
=> printenv loadaddr
loadaddr=0x42000000
I have no clue why it is at 0x42000000 and not at 0x40008000 that I got from uboot-mkimage but the U-boot preloaded value was correct in my case. Anyone with input on this would be appreciated.
Once the kernel has the correct load address it will get much further during startup, all the way to mounting the root file system. For the file system it seemed that ubifs was the modern way to go so thats what I did.
Flashing a ubifs file system on a nand can be done in two ways. You can, for one, flash it with a generic NAND flasher. This requires a ubi image which is created by running ubinize on an existing ubifs image.
The other alternative is to flash a ubifs image through U-Boot, which is what I decided to do. The ubifs image is created by running mkubifs but this is handled automatically by bitbake if you have set ubifs as a target in conf/machine/imx28evk.conf.
IMAGE_FSTYPES ?= "tar.bz2 ext3 uboot.mxsboot-sdcard sdcard ubifs"
However building the ubifs image requires certain parameters set in the same file (conf/machine/imx28evk.conf)
MKUBIFS_ARGS = "--min-io-size 2048 --leb-size 126976 --max-leb-cnt 864"
These values can be found by running ubiattach -m 1 /dev/ubi_ctrl (requires packages mtd-utils and mtd-utils-ubifs) in Linux on your target system. The easiest way to do this is to boot on an SD card, see Task #4 - Deploy and test
However depending on your bootargs you might not have access to /dev/mtdX. If the mtd device is missing, reboot and enter U-Boot and add gpmi (Can not see the NAND device /dev/mtd0 or /dev/mtd1 for micron MT29F1G08ABADA) to the mmcargs.
setenv mmcargs setenv bootargs gpmi ${mtdparts} console=${console_mainline},${baudrate} root=${mmcroot}
run mmcboot
Your /dev/mtdX should be available now. The NAND partitions does not work like normal file system partitions, instead they are entirely logical and setup with an address and a size. In U-Boot the NAND partitions can be setup neatly with the command mtdparts and for many imx boards that can translate just nicely to a booted Linux, but not the imx28. The other boards have an external file where the NAND partitions can be configured but the imx28 has the partition hardcoded in the driver. It can be found (grep for mtd_partition) and modified but then it must be maintained as a kernel patch every time there is an upgrade. Instead I opted for going with the default partition the imx28 nand driver offers: /dev/mtd0 20MiB, /dev/mtd1 has the rest. Verify the numbers using mtdinfo command. My strategy is to put bootloader, environment and kernel in /dev/mtd0 and in /dev/mtd1 I put filesystems by using multiple ubifs volumes in the same partition.
So analyzing the output from ubiattach -m 1 /dev/ubi_ctrl
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 126976 bytes
UBI: smallest flash I/O unit: 2048
UBI: VID header offset: 2048 (aligned 2048)
UBI: data offset: 4096
UBI: attached mtd1 to ubi0
UBI: MTD device name: "gpmi-nfc-general-use"
UBI: MTD device size: 108 MiB
UBI: number of good PEBs: 864
UBI: number of bad PEBs: 0
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 0
UBI: available PEBs: 852
UBI: total number of reserved PEBs: 12
UBI: number of PEBs reserved for bad PEB handling: 8
UBI: max/mean erase counter: 1/1
UBI: image sequence number: 0
UBI: background thread "ubi_bgt0d" started, PID 397
UBI device number 0, total 864 LEBs (109707264 bytes, 104.6 MiB), available 852 LEBs (108183552 bytes, 103.2 MiB), LEB size 126976 by)
Use the values to set the MKUBIFS_ARGS to get a ubifs image that will work for your NAND flash.
Now since we are reconsidering the partitioning lets recap where to put stuff and start from the point where we only have u-boot on the nand.
First lets build the partition table using mtdparts default and then we delete the incorrectly placed file system.
mtdparts default
mtdparts del filesystem
Then we place the file system after the first 20MiB. I use a 128MiB NAND here.
mtdparts add nand0 0x06C00000@0x1400000 filesystem
The partition table should look like this now
=> mtdparts
device nand0 <gpmi-nand>, # parts = 7
#: name size offset mask_flags
0: bootloader 0x00300000 0x00000000 1
1: environment 0x00080000 0x00300000 0
2: redundant-environment0x00080000 0x00380000 0
3: kernel 0x00400000 0x00400000 0
4: fdt 0x00080000 0x00800000 0
5: ramdisk 0x00800000 0x00880000 0
6: filesystem 0x06c00000 0x01400000 0
Lets save the partition table to the environment.
saveenv
Now let us first flash the kernel where it is supposed to be. As usual we download it from a USB thumb since I haven't gotten to setup TFTP yet.
usb start
fatls usb 0:1
nand erase.part kernel
fatload usb 0:1 ${loadaddr} uimage-imx28evk.bin
nand write ${loadaddr} kernel
Now the kernel is in place, lets setup the kernel boot arguments. U-boot comes with a default environment nandargs which is almost entirely correct for us.
nandargs=setenv bootargs console=${console_mainline},${baudrate} rootfstype=ubifs ubi.mtd=6 root=ubi0_0 ${mtdparts}
The part that is incorrect for us is ubi.mtd=6 as we are planning to have the filesystem on mtd1. So we take the setenv part and runs it manually. It is also important to add the gpmi argument so the nand driver will load.
setenv bootargs gpmi console=${console_mainline},${baudrate} rootfstype=ubifs ubi.mtd=1 root=ubi0_0 ${mtdparts}
setenv bootcmd 'nboot kernel; bootm'
saveenv
We can now try to boot and should get as far as trying to mount the root file system.
So now it is time to put in our ubifs image into nand. First we load the ubifs image into memory.
usb start
fatls usb 0:1
fatload usb 0:1 ${loadaddr} core-image-minimal-imx28evk.ubifs
Then we erase the filesystem partition.
nand erase.part filesystem
We set the ubi subsystem to work with the filesystem partition
ubi part filesystem
We create a volume. Since we don't set type or size it becomes dynamic and covers the entire size.
ubi create rootfs
Write the loaded image to the newly created volume. If we had created multiple volumes we chose which volume to receive the image. Useful for having multiple filesystems/partitions.
ubi write ${loadaddr} rootfs ${filesize}
Finally we mount the file system locally to verify that it looks ok.
ubifsmount ubi0:rootfs
ubifsls
Now we can reboot and this time Linux should start properly. It did for me and I hope it will work for you too!
Try posting this question to the meta-fsl-arm mailing list.
A good idea but I actually managed to solve pretty much everything so I will post a detailed description of what I did and which pitfalls I fell in so hopefully others can find all the information in one place. It took some 8-10 hours of googling but step by step all question marks were solved. :smileyhappy:
I have gotten a bit further now in my digging to run an i.MX28 from NAND. After investigating MfgTool for a bit I came to the conclusion that it wanted sb files. I modified my machine config to output sb files.
diff --git a/conf/machine/imx28evk.conf b/conf/machine/imx28evk.conf
index d4f1ad6..2b6939e 100644
--- a/conf/machine/imx28evk.conf
+++ b/conf/machine/imx28evk.conf
@@ -10,7 +10,7 @@ SOC_FAMILY = "mxs:mx28"
-UBOOT_CONFIG ??= "sd"
+UBOOT_CONFIG ??= "nand"
UBOOT_CONFIG[sd] = "mx28evk_config,sdcard"
UBOOT_CONFIG[nand] = "mx28evk_nand_config,ubifs"
UBOOT_CONFIG[sd-auart-console] = "mx28evk_auart_console_config,sdcard"
@@ -19,7 +19,7 @@ KERNEL_IMAGETYPE = "uImage"
SDCARD_ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3"
-IMAGE_FSTYPES ?= "tar.bz2 ext3 uboot.mxsboot-sdcard sdcard"
+IMAGE_FSTYPES ?= "tar.bz2 ext3 uboot.mxsboot-sdcard sdcard sb"
I built using bitbake core-image-minimal, but unfortunately this gave a build error partway and only one relevant file was generated: u-boot-imx28evk.sb
I then modified the ucl.xml in MfgTool to the following:
<LIST name="Singlechip NAND" desc="Install on singlechip NAND">
<CMD type="boot" body="Recovery" file="updater_ivt.sb" timeout="60">Booting Update Firmware.</CMD>
<CMD type="find" body="Updater" timeout="180"/>
<CMD type="push" body="mknod class/mtd,mtd0,/dev/mtd0"/>
<CMD type="push" body="mknod class/mtd,mtd1,/dev/mtd1"/>
<CMD type="push" body="mknod class/misc,ubi_ctrl,/dev/ubi_ctrl"/>
<CMD type="push" body="$ flash_eraseall /dev/mtd0">Erasing rootfs partition 0</CMD>
<CMD type="push" body="$ flash_eraseall /dev/mtd1">Erasing rootfs partition 1</CMD>
<CMD type="push" body="send" file="files/u-boot-imx28evk.sb" >Sending Firmware</CMD>
<CMD type="push" body="$ kobs-ng init $FILE">Flashing firmware</CMD>
<CMD type="push" body="$ echo Update Complete!">Done</CMD>
</LIST>
In hindsight the ubi_ctrl is probably not necessary since I don't load a root file system at this point.
I am also curious about nand flash erase. I would actually prefer to erase the entire /dev/mtd and not just a partition of it. Then again, I am uncertain where the NAND partition table is stored. Anyone who knows, please write a reply telling me. My current theory is that the NAND partition table only exists in the form of kernel parameters and stored in the environment part defined by mtdparts in u-boot.
At this point I set the i.mx28evk jumpers to boot from NAND and I get my u-boot prompt. Since my build earlier had failed I went back and changed machine config:
-IMAGE_FSTYPES ?= "tar.bz2 ext3 uboot.mxsboot-sdcard sdcard"
+IMAGE_FSTYPES ?= "tar.bz2 ext3 uboot.mxsboot-sdcard sdcard ubifs"
And built using bitbake core-image-minimal again.
Now it was time to play around with u-boot. I placed the generated uImage--2.6.35.3-r45-imx28evk-20140818140121.bin on a FAT formatted memory stick.
In u-boot i wrote the default mtdparts using mtdparts default and saveenv. Then I loaded the kernel into memory from the USB stick and wrote it to NAND.
usb start
fatls usb 0:1
fatload usb 0:1 0x40008000 uimage--2.6.35.3-r45-imx28evk-20140818140121.bin
nand erase 0x00400000 0x00400000 (last is size)
nand write 0x40008000 0x00400000 0x00400000 (last is size)
The load address 0x40008000 was obtained by running the following command from the build directory:
tmp/sysroots/x86_64-linux/usr/bin/uboot-mkimage -l tmp/deploy/images/imx28evk/uImage--2.6.35.3-r45-imx28evk-20140818140121.bin
Image Name: Linux-2.6.35.3-maintain+yocto+gb
Created: Mon Aug 18 16:05:09 2014
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2613036 Bytes = 2551.79 kB = 2.49 MB
Load Address: 40008000
Entry Point: 40008000
Now when the kernel is written to the NAND flash I setup the boot and save using the following commands
setenv bootcmd 'nboot 0x40008000 0 0x00400000; bootm'
saveenv
And now I can simply execute boot or reset the board to test:
U-Boot 2014.01 (Aug 18 2014 - 13:55:32)
CPU: Freescale i.MX28 rev1.2 at 454 MHz
BOOT: NAND, 3V3
DRAM: 128 MiB
NAND: 128 MiB
MMC: MXS MMC: 0
Video: MXSFB: 'videomode' variable not set!
In: serial
Out: serial
Err: serial
Net: FEC0 [PRIME], FEC1
Hit any key to stop autoboot: 0
And the kernel is being loaded from NAND! Happy face!
Loading from nand0, offset 0x400000
Image Name: Linux-2.6.35.3-maintain+yocto+gb
Created: 2014-08-18 14:05:09 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2613036 Bytes = 2.5 MiB
Load Address: 40008000
Entry Point: 40008000
## Booting kernel from Legacy Image at 40008000 ...
Image Name: Linux-2.6.35.3-maintain+yocto+gb
Created: 2014-08-18 14:05:09 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2613036 Bytes = 2.5 MiB
Load Address: 40008000
Entry Point: 40008000
Verifying Checksum ... OK
XIP Kernel Image ... OK
Starting kernel ...
And crash! Sad face! But there is no rootfs in place which I am certain is causing the crash so now it is time to setup that.
undefined instruction
pc : [<40008010>] lr : [<47f38440>]
sp : 47b32d70 ip : 00000000 fp : 00000000
r10: 00000000 r9 : 47b32f38 r8 : 47b417dc
r7 : 00000000 r6 : 40008000 r5 : 47f9f724 r4 : 00000000
r3 : 47b32fe0 r2 : 40000100 r1 : 000009e3 r0 : 47b32fe0
Flags: nZCv IRQs off FIQs off Mode SVC_32
Resetting CPU ...
So now obviously the next step is the ubifs file and then I fill have to poke at TFTP to not be dependant on a USB thumb for transferring images.
Hi,
Can you share the error you are getting? Just like you said, it is very probable that the lack of the rootfs is causing that problem.
I do not know that if it is possible to generate a .sb file that only includes Linux, that way you can boot directly to Linux and get rid of U-Boot.
Best Regards,
Alejandro
First of all, the error message is not hampering me in any way, so don't spend any time on it for my sake.
The setup I am trying to achieve is to use MfgTool to get U-Boot in place and after that use my own tools for communicating with U-Boot over the debug port.
I had just assumed that if I wanted .sb files I just set sb as a target and the files that could be generated would be. And since I got my U-Boot sb file I am very happy.
Since I did get everything I wanted I have not looked closely at the error and tried to debug it so it could be trivial. Just putting it out there to avoid wearing a dunce cap later on ;-)
When building the rootfs I get the following error (the referenced log file is attached):
ERROR: Error executing a python function in /home/per/work/fsl-community-bsp/sources/poky/meta/recipes-core/images/core-image-minimal.bb:
The stack trace of python calls that resulted in this exception/failure was:
File: 'do_rootfs', lineno: 17, function: <module>
0013: # generate final images
0014: create_image(d)
0015:
0016:
*** 0017:do_rootfs(d)
0018:
File: 'do_rootfs', lineno: 14, function: do_rootfs
0010: # generate rootfs
0011: create_rootfs(d)
0012:
0013: # generate final images
*** 0014: create_image(d)
0015:
0016:
0017:do_rootfs(d)
0018:
File: '/home/per/work/fsl-community-bsp/sources/poky/meta/lib/oe/image.py', lineno: 329, function: create_image
0325: execute_pre_post_process(self.d, post_process_cmds)
0326:
0327:
0328:def create_image(d):
*** 0329: Image(d).create()
0330:
0331:if __name__ == "__main__":
0332: """
0333: Image creation can be called independent from bitbake environment.
File: '/home/per/work/fsl-community-bsp/sources/poky/meta/lib/oe/image.py', lineno: 307, function: create
0303: execute_pre_post_process(self.d, pre_process_cmds)
0304:
0305: self._remove_old_symlinks()
0306:
*** 0307: image_cmd_groups = self._get_imagecmds()
0308:
0309: for image_cmds in image_cmd_groups:
0310: # create the images in parallel
0311: nproc = multiprocessing.cpu_count()
File: '/home/per/work/fsl-community-bsp/sources/poky/meta/lib/oe/image.py', lineno: 277, function: _get_imagecmds
0273: localdata.setVar('OVERRIDES', '%s:%s' % (type, old_overrides))
0274: bb.data.update_data(localdata)
0275: localdata.setVar('type', type)
0276:
*** 0277: cmds.append("\t" + localdata.getVar("IMAGE_CMD", True))
0278: cmds.append(localdata.expand("\tcd ${DEPLOY_DIR_IMAGE}"))
0279:
0280: if type in cimages:
0281: for ctype in cimages[type]:
Exception: TypeError: cannot concatenate 'str' and 'NoneType' objects
ERROR: Function failed: do_rootfs
ERROR: Logfile of failure stored in: /home/per/work/fsl-community-bsp/sbtest/tmp/work/imx28evk-poky-linux-gnueabi/core-image-minimal/1.0-r0/temp/log.do_rootfs.3351
ERROR: Task 7 (/home/per/work/fsl-community-bsp/sources/poky/meta/recipes-core/images/core-image-minimal.bb, do_rootfs) failed with exit code '1'
The problem is that the final hardware target does not have an SD card reader, only a NAND flash so I started searching for ways to make a NAND image. I found the following thread: To make NAND image by Yocto. which discusses the making of a NAND image but it differs from my requirements since the author is looking to use a direct NAND programmer and not MfgTool. I have no direct preference how to program the NAND and only want to find the smoothest way to do it. I have played around with MfgTool enough that I get it to download the special upgrade-Linux firmware into RAM. At this point I would have to supply a file to be flashed to NAND.
To generate such an image I have tried the following modifications to source/meta-fsl-arm:
diff --git a/conf/machine/imx28evk.conf b/conf/machine/imx28evk.conf
index d4f1ad6..2b6939e 100644
--- a/conf/machine/imx28evk.conf
+++ b/conf/machine/imx28evk.conf
@@ -10,7 +10,7 @@ SOC_FAMILY = "mxs:mx28"
-UBOOT_CONFIG ??= "sd"
+UBOOT_CONFIG ??= "nand"
UBOOT_CONFIG[sd] = "mx28evk_config,sdcard"
UBOOT_CONFIG[nand] = "mx28evk_nand_config,ubifs"
UBOOT_CONFIG[sd-auart-console] = "mx28evk_auart_console_config,sdcard"
@@ -19,7 +19,7 @@ KERNEL_IMAGETYPE = "uImage"
SDCARD_ROOTFS ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3"
-IMAGE_FSTYPES ?= "tar.bz2 ext3 uboot.mxsboot-sdcard sdcard"
+IMAGE_FSTYPES ?= "tar.bz2 ext3 ubifs"
Then I created the images using: bitbake core-image-minimal. This only yielded the following files:
persm@mewmew:~/work/fsl-community-bsp/build/tmp/deploy/images/imx28evk$ ls -la
total 47412
drwxrwxr-x 2 persm persm 4096 aug 15 14:25 .
drwxrwxr-x 3 persm persm 4096 aug 15 14:23 ..
-rw-r--r-- 1 persm persm 67108864 aug 15 14:25 core-image-minimal-imx28evk-20140815110253.rootfs.ext3
-rw-r--r-- 1 persm persm 1286 aug 15 14:25 core-image-minimal-imx28evk-20140815110253.rootfs.manifest
-rw-r--r-- 1 persm persm 6432958 aug 15 14:25 core-image-minimal-imx28evk-20140815110253.rootfs.tar.bz2
-rw-r--r-- 1 persm persm 15998976 aug 15 14:25 core-image-minimal-imx28evk-20140815110253.rootfs.ubifs
lrwxrwxrwx 1 persm persm 54 aug 15 14:25 core-image-minimal-imx28evk.ext3 -> core-image-minimal-imx28evk-20140815110253.rootfs.ext3
lrwxrwxrwx 1 persm persm 58 aug 15 14:25 core-image-minimal-imx28evk.manifest -> core-image-minimal-imx28evk-20140815110253.rootfs.manifest
lrwxrwxrwx 1 persm persm 57 aug 15 14:25 core-image-minimal-imx28evk.tar.bz2 -> core-image-minimal-imx28evk-20140815110253.rootfs.tar.bz2
lrwxrwxrwx 1 persm persm 55 aug 15 14:25 core-image-minimal-imx28evk.ubifs -> core-image-minimal-imx28evk-20140815110253.rootfs.ubifs
-rw-rw-r-- 2 persm persm 784435 aug 15 14:23 modules--2.6.35.3-r45-imx28evk-20140815110253.tgz
lrwxrwxrwx 1 persm persm 49 aug 15 14:23 modules-imx28evk.tgz -> modules--2.6.35.3-r45-imx28evk-20140815110253.tgz
-rw-r--r-- 2 persm persm 294 aug 15 14:24 README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt
lrwxrwxrwx 1 persm persm 48 aug 15 14:23 uImage -> uImage--2.6.35.3-r45-imx28evk-20140815110253.bin
-rw-r--r-- 2 persm persm 2612216 aug 15 14:22 uImage--2.6.35.3-r45-imx28evk-20140815110253.bin
lrwxrwxrwx 1 persm persm 48 aug 15 14:23 uImage-imx28evk.bin -> uImage--2.6.35.3-r45-imx28evk-20140815110253.bin
As far as I can tell I have a ubifs file for the rootfs file system and thats it. Maybe I don't need to have all files as ubifs since I am using MfgTool but I don't know. I also seem to lack a u-boot image and the actual kernel image seems to be just a standard uImage. Can I simply place the kernel image in the NAND just like that, and if so how does it deal with a potential bad sector there?
If anyone have any tips, advice or even a guide how to build a NAND image in Yocto and get it to run on the nand flash on the imx28evk I would be really grateful.
Many thanks and apologies for the horrible structure of messages.
/Per Smitt