Sanity check on a flashing process design
Currently, I have a functional Yocto image in .wic.gz format, and I have a ~7GB eMMC storage. I then set the size for the partition in my .wks to ~7GB also, but this makes the flashing process painfully long (by doing gzwrite mmc). Hence, I thought of having a minimal Linux image (since, AFAIK, U-boot does not the tools to manipulate partitions and filesystem) with tools to do storage partition and filesystem creation. I then can flash this image (in .wic.gz format) onto my eMMC, and use that image to partition, create the filesystem, and extract my featureful image (in tar.gz) onto the newly created filesystem. I have a working POC but I have a few questions:
* Is there anything wrong with this approach? Is there some simpler approach that can achieve what I need? (Improving the flashing time)
* Since I only need a small Linux image, I found that I can use the poky-tiny distro to make the image as small as conveniently possible. However, this means that my featureful image and my minimal image will use different distros. Is this a problem? If it is, how can I set different distro options for different images?
* Let's say I start with a system having only U-boot, can I automate the whole process from plugging in a USB (with the appropriate images on there) to having the featureful image flashed?
Uy Ha via lists.yoctoproject.org schrieb am So 17. Nov, 08:48 (-0800):
Quoted 4 lines
Currently, I have a functional Yocto image in
.wic.gzformat, and I have a ~7GB eMMC storage. I then set the size for the partition in my.wksto ~7GB also, but this makes the flashing process painfully long (by doinggzwrite mmc).
Maybe bmaptool copy would help or zcat |dd conv=sparse.
Regards, Jörg
I think this only works if I can interact with the storage (e.g an SD card) from my workstation, is that correct? Because my iMX6 has the eMMC storage builtin, hence it is not removable and I cannot access it from my workstation.
Quoted 5 lines · Uy Ha via lists.yoctoproject.org
I think this only works if I can interact with the storage (e.g an SD card) from my workstation, is that correct? Because my iMX6 has the eMMC storage builtin, hence it is not removable and I cannot access it from my workstation.
Depending on your hardware, maybe you can use USB OTG and USB Mass-Storage (command "ums" from u-boot) to write your eMMC from your workstation with bmaptool.
Or you can boot your system not using eMMC (external USB, network TFTP/NFS, ...) and then use bmaptool on your target to flash the eMMC. So, "yes" to your 3rd question : you can automate this.
Regards,
Signature · 2 lines
Yoann Congal Smile ECS - Tech expert
Quoted 4 lines
Or you can boot your system not using eMMC (external USB, network TFTP/NFS, ...) and then use bmaptool on your target to flash the eMMC.
I am trying this approach now. I created a bootable USB (well, theoretically bootable, I haven't actually managed to boot from it) using bmaptool. However, I am not sure how to boot from it from the U-Boot console. I tried loading the fitImage in the /boot and run bootm to boot (I am just trying random things at this point, I am not really sure what I am doing) but the kernel panics.
The steps I have done:
* Run: usb start
* Load the fitImage into memory: load usb 0:1 $loadaddr /boot/fitImage
* Boot: bootm
Then the kernel panics with the following error message
Quoted 45 lines
/dev/root: Can't open blockdev
VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6 Please append a correct "root=" boot option; here are the available partitions:
0100 65536 ram0
(driver?)
0101 65536 ram1
(driver?)
0102 65536 ram2
(driver?)
0103 65536 ram3
(driver?)
0104 65536 ram4
(driver?)
0105 65536 ram5
(driver?)
0106 65536 ram6
(driver?)
0107 65536 ram7
(driver?)
0108 65536 ram8
(driver?)
0109 65536 ram9
(driver?)
010a 65536 ram10
(driver?)
010b 65536 ram11
(driver?)
010c 65536 ram12
(driver?)
010d 65536 ram13
(driver?)
010e 65536 ram14
(driver?)
010f 65536 ram15
(driver?)
b300 7634944 mmcblk2
driver: mmcblk
b301 134010 mmcblk2p1 076c4a2a-01
b302 7496704 mmcblk2p2 076c4a2a-02
b308 4096 mmcblk2boot0
(driver?)
b310 4096 mmcblk2boot1
(driver?)
Quoted 3 lines
Kernel panic - not syncing: VFS: Unable to mount root fs onunknown-block(0,0)
What am I missing here?
Hi,
Quoted 62 lines · Uy Ha via lists.yoctoproject.org
Quoted 4 lines
Or you can boot your system not using eMMC (external USB, network TFTP/NFS, ...) and then use bmaptool on your target to flash the eMMC.
I am trying this approach now. I created a bootable USB (well, theoretically bootable, I haven't actually managed to boot from it) using
bmaptool. However, I am not sure how to boot from it from the U-Boot console. I tried loading thefitImagein the /boot and runbootmto boot (I am just trying random things at this point, I am not really sure what I am doing) but the kernel panics.The steps I have done:
* Run:usb start
* Load thefitImageinto memory:load usb 0:1 $loadaddr /boot/fitImage
* Boot:bootm
Then the kernel panics with the following error messageQuoted 45 lines
/dev/root: Can't open blockdev
VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6 Please append a correct "root=" boot option; here are the available partitions:
0100 65536 ram0
(driver?)
0101 65536 ram1
(driver?)
0102 65536 ram2
(driver?)
0103 65536 ram3
(driver?)
0104 65536 ram4
(driver?)
0105 65536 ram5
(driver?)
0106 65536 ram6
(driver?)
0107 65536 ram7
(driver?)
0108 65536 ram8
(driver?)
0109 65536 ram9
(driver?)
010a 65536 ram10
(driver?)
010b 65536 ram11
(driver?)
010c 65536 ram12
(driver?)
010d 65536 ram13
(driver?)
010e 65536 ram14
(driver?)
010f 65536 ram15
(driver?)
b300 7634944 mmcblk2
driver: mmcblk
b301 134010 mmcblk2p1 076c4a2a-01
b302 7496704 mmcblk2p2 076c4a2a-02
b308 4096 mmcblk2boot0
(driver?)
b310 4096 mmcblk2boot1
(driver?)Quoted 3 lines
Kernel panic - not syncing: VFS: Unable to mount root fs onunknown-block(0,0)
Quoted 2 lines
What am I missing here?
You are missing a rootfs. Usually passed via bootargs with root= or as an initramfs if part of the fitimage configuration that is used by default.
Cheers,
Quentin
Yes, I managed to trace the boot script from my vendor and saw what needs to be done to set the correct arguments.
For future reference, the steps I have taken to boot from a USB with Yocto is as follows:
1. Create .wic and .wic.bmap files by following the steps in
https://docs.yoctoproject.org/dev/dev-manual/bmaptool.html
- TLDR: Put IMAGE_FSTYPES="wic wic.bmap" to your image
2. Flash the image onto your USB
- Run the following command: bmaptool copy /path/to/image.wic /path/to/usb
3. Plug in the USB and start U-Boot's USB system:
- usb start
- (Optional) Verify that the USB is visible, has a partition and has the expected structure
- List USB: usb storage
- List partition: part list usb 0 (0 here is the number of the USB device according to the above result)
- LIst the content in the USB: ls usb 0:1 (1 here is the bootable partition on the USB)
4. Loading fitImage and setting bootargs
- Load fitImage into memory: load usb 0:1 $loadaddr /boot/fitImage (I know that there is a fitImage according to my Yocto build)
- Get the UUID of the partition and put it in the uuid variable:
part uuid usb 0:1 uuid
- Set the value for bootargs: setenv bootargs "console=ttymxc0,115200 root=PARTUUID=${uuid} rw rootwait consolebank=0"
- Boot: bootm
Quoted 80 lines · Quentin Schulz
Hi,
Quoted 6 lines · Uy Ha via lists.yoctoproject.org
Quoted 4 lines
Or you can boot your system not using eMMC (external USB, network TFTP/NFS, ...) and then use bmaptool on your target to flash the eMMC.
I am trying this approach now. I created a bootable USB (well,
theoretically bootable, I haven't actually managed to boot from it) using
bmaptool. However, I am not sure how to boot from it from the U-Boot console. I tried loading thefitImagein the /boot and runbootmto boot (I am just trying random things at this point, I am not really sure what I am doing) but the kernel panics.Quoted 4 lines
The steps I have done:
* Run:usb start
* Load thefitImageinto memory: `load usb 0:1 $loadaddr/boot/fitImage`
Quoted 52 lines
* Boot:
bootm
Then the kernel panics with the following error messageQuoted 45 lines
/dev/root: Can't open blockdev
VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6 Please append a correct "root=" boot option; here are the available partitions:
0100 65536 ram0
(driver?)
0101 65536 ram1
(driver?)
0102 65536 ram2
(driver?)
0103 65536 ram3
(driver?)
0104 65536 ram4
(driver?)
0105 65536 ram5
(driver?)
0106 65536 ram6
(driver?)
0107 65536 ram7
(driver?)
0108 65536 ram8
(driver?)
0109 65536 ram9
(driver?)
010a 65536 ram10
(driver?)
010b 65536 ram11
(driver?)
010c 65536 ram12
(driver?)
010d 65536 ram13
(driver?)
010e 65536 ram14
(driver?)
010f 65536 ram15
(driver?)
b300 7634944 mmcblk2
driver: mmcblk
b301 134010 mmcblk2p1 076c4a2a-01
b302 7496704 mmcblk2p2 076c4a2a-02
b308 4096 mmcblk2boot0
(driver?)
b310 4096 mmcblk2boot1
(driver?)Quoted 3 lines
Kernel panic - not syncing: VFS: Unable to mount root fs onunknown-block(0,0)
Quoted 2 lines
What am I missing here?
You are missing a rootfs. Usually passed via bootargs with root= or as an initramfs if part of the fitimage configuration that is used by default.
Cheers,
Quentin
Uy Ha via Lists.Yoctoproject.Org schrieb am Mo 18. Nov, 00:26 (-0800):
Quoted 2 lines
I think this only works if I can interact with the storage (e.g an SD card) from my workstation, is that correct?
How did you run gzwrite? You can use dd the same way.
Quoted 2 lines
Because my iMX6 has the eMMC storage builtin, hence it is not removable and I cannot access it from my workstation.
Do you have a SSH connection? I flash new images via SSH.
Quoted 3 lines
How did you run
gzwrite? You can use dd the same way.
I ran it in the U-Boot console, like this
```
gzwrite mmc 2 ${loadaddr} ${filesize}
```I can't find dd in U-Boot's document and it also does not exist in my U-Boot console.
Quoted 3 lines
Do you have a SSH connection? I flash new images via SSH.
In the expected setup that I have to deal with, no. I need the process to set up the system from scratch to functional to have as little interaction as possible, ideally
* plugging a USB
* see messages about the progress
* see a final message saying everything is done
* functional system
Hence, connecting via SSH is undesirable in my case.