bobs
Posts: 8
Joined: Mon Sep 26, 2016 1:05 pm

Installing Image on CM3 twice failing

Fri May 18, 2018 8:11 pm

We are using a custom Alpine Linux image and if I image the OS onto the CM3 twice, it appears that the CM3 does not find the bootloader on the EMMC. This doesn't appear to happen with the default Rasbian image, but I've only verified this a couple times. Things I've tried:
1. Delete all partitions on the emmc before imaging
2. dd zero the emmc before imaging
3. Image Raspbian then image our Alpine Linux
4. Remove all partitions and use fdisk to create a FAT32 partition, make active, format then extract the default Alpine Linux .tar.gz file from Alpine.

I'm running out of ideas on what could be the cause. Anyone have any?

bobs
Posts: 8
Joined: Mon Sep 26, 2016 1:05 pm

Re: Installing Image on CM3 twice failing

Tue May 22, 2018 12:35 pm

Slight clarification on my problem stated above. If I flash Rasbian and then flash our custom image the problem occurs. I've also tried to install vanilla Alpine after the EMMC has been flashed with Rasbian and that is unsuccessful as well.

Other things I've tried since the previous message that are all unsuccessful.
1. dd a working image from a CM3 to a file. Tried the dding that image to a CM3 that had been previously flashed with Rasbian.
2. dding a working MBR from a CM3 to a file. Then dding that image to a CM3 that isn't booting.

I've also tested using a CM3L with a SD Card, but I can't replicate the problem. Currently, the problem only happens when using the EMMC on the CM.

Does anyone have any ideas at all?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1878
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Installing Image on CM3 twice failing

Tue May 22, 2018 12:47 pm

It sounds baffling.

1. Can you clarify what happens when you install Raspbian over the broken Alpine OS?

2. What evidence is there to suggest that you can't simplify your report to say "Installing Alpine OS on CM3 doesn't work"?

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1331
Joined: Sat Sep 10, 2011 11:43 am

Re: Installing Image on CM3 twice failing

Tue May 22, 2018 12:48 pm

How do you know it doesn't find the bootloader on the eMMC?
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

bobs
Posts: 8
Joined: Mon Sep 26, 2016 1:05 pm

Re: Installing Image on CM3 twice failing

Tue May 22, 2018 1:53 pm

Thank you all for responding. It is baffling. I'll try to clarify anything I've posted.
It sounds baffling.

1. Can you clarify what happens when you install Raspbian over the broken Alpine OS?

2. What evidence is there to suggest that you can't simplify your report to say "Installing Alpine OS on CM3 doesn't work"?
1. Raspbian works fine after imaging overtop the broken Alpine OS
2. Alpine and our custom Alpine works fine on a straight factory CM3. One thing to note is that Alpine isn't distributed as an image. It's a tar.gz that you extract over a Fat32 partition. Our custom Alpine is an image, but I'd have to double check on how they are creating the image file.

bobs
Posts: 8
Joined: Mon Sep 26, 2016 1:05 pm

Re: Installing Image on CM3 twice failing

Tue May 22, 2018 2:05 pm

gsh wrote:
Tue May 22, 2018 12:48 pm
How do you know it doesn't find the bootloader on the eMMC?
I do not know if it is the bootloader exactly or at what stage it is having a problem. It's at such an early stage that the only indication I have is nothing is trying to drive the HDMI port as the monitor believes it is inactive and goes to sleep. The LED that is used for drive activity appears to be on solid (I haven't verified with a scope that it isn't pulsing) which is also the same indication if I use the CM3L and don't have a SD Card installed.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1878
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Installing Image on CM3 twice failing

Tue May 22, 2018 2:13 pm

You're more likely to get answers if you can detail the steps in making your custom image, but you could start by posting the output from:

Code: Select all

$ sudo fdisk -l /dev/mmcblk0
from
1. a working Raspbian,
2. a working Alpine OS installed clean from one of your images, and
3. with the CM3 in slave mode, plugged into another Pi (or Linux box) running rpiboot, "$ sudo fdisk -l /dev/sda" on a CM3 in the broken state.

bobs
Posts: 8
Joined: Mon Sep 26, 2016 1:05 pm

Re: Installing Image on CM3 twice failing

Tue May 22, 2018 2:29 pm

PhilE wrote:
Tue May 22, 2018 2:13 pm
You're more likely to get answers if you can detail the steps in making your custom image, but you could start by posting the output from:

Code: Select all

$ sudo fdisk -l /dev/mmcblk0
from
1. a working Raspbian,
2. a working Alpine OS installed clean from one of your images, and
3. with the CM3 in slave mode, plugged into another Pi (or Linux box) running rpiboot, "$ sudo fdisk -l /dev/sda" on a CM3 in the broken state.
Talked to the SW guys and the custom image is created by using fallocate to create a 512 MB file that is then mounted, partitioned into 3 partitions, formatted, files copied onto the correct partitions, then unmounted.

I'll get to work on collecting the other information.

bobs
Posts: 8
Joined: Mon Sep 26, 2016 1:05 pm

Re: Installing Image on CM3 twice failing

Tue May 22, 2018 3:26 pm

PhilE wrote:
Tue May 22, 2018 2:13 pm
You're more likely to get answers if you can detail the steps in making your custom image, but you could start by posting the output from:

Code: Select all

$ sudo fdisk -l /dev/mmcblk0
from
1. a working Raspbian,
2. a working Alpine OS installed clean from one of your images, and
3. with the CM3 in slave mode, plugged into another Pi (or Linux box) running rpiboot, "$ sudo fdisk -l /dev/sda" on a CM3 in the broken state.
Hoping this is fine, but here is the output of all three while the CM3 is in slave mode.

Raspbian

Code: Select all

Disk /dev/sdb: 3.7 GiB, 3909091328 bytes, 7634944 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc7cb7e34

Device     Boot Start     End Sectors  Size Id Type
/dev/sdb1        8192   96453   88262 43.1M  c W95 FAT32 (LBA)
/dev/sdb2       98304 3637247 3538944  1.7G 83 Linux

Our custom Alpine OS in the working state

Code: Select all

Disk /dev/sdb: 3.7 GiB, 3909091328 bytes, 7634944 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xdd5108ed

Device     Boot  Start    End Sectors   Size Id Type
/dev/sdb1  *      2048 522239  520192   254M  c W95 FAT32 (LBA)
/dev/sdb2       522240 784383  262144   128M 83 Linux
/dev/sdb3       784384 999999  215616 105.3M 83 Linux

Custom Alpine in the non working state

Code: Select all

Disk /dev/sdb: 3.7 GiB, 3909091328 bytes, 7634944 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xdd5108ed

Device     Boot  Start    End Sectors   Size Id Type
/dev/sdb1  *      2048 522239  520192   254M  c W95 FAT32 (LBA)
/dev/sdb2       522240 784383  262144   128M 83 Linux
/dev/sdb3       784384 999999  215616 105.3M 83 Linux

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1878
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Installing Image on CM3 twice failing

Tue May 22, 2018 3:44 pm

Assuming that the second and third results are genuinely identical and not a cut-and-paste error, the next thing I would try would be to compare the boot partitions between the two Alpine images:

Code: Select all

sudo mount /dev/sdb1 /mnt; sudo find /mnt -type f -exec md5sum {} \; > sums.txt; sudo umount /mnt
(or similar)

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1331
Joined: Sat Sep 10, 2011 11:43 am

Re: Installing Image on CM3 twice failing

Tue May 22, 2018 5:01 pm

OK, that does sound like it is indeed failing to find the FAT partition...

Can you dd the FAT partition from the non-working and working CM3 to a file?

dd if=/dev/sdb of=file.img bs=512 count=522239

You can then do 'hexdump -C file.img' for both files and compare them... This may tell you what's different between them
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

bobs
Posts: 8
Joined: Mon Sep 26, 2016 1:05 pm

Re: Installing Image on CM3 twice failing

Wed May 23, 2018 3:35 pm

gsh wrote:
Tue May 22, 2018 5:01 pm
OK, that does sound like it is indeed failing to find the FAT partition...

Can you dd the FAT partition from the non-working and working CM3 to a file?

dd if=/dev/sdb of=file.img bs=512 count=522239

You can then do 'hexdump -C file.img' for both files and compare them... This may tell you what's different between them
Ok, a few updates.

1. First to answer PhilE's question, no that was not a cut and paste error.
2. I dd'd as above from a working and non-working CM3 to different files. I then used cmp and there were no byte differences.
3. I ran the same test on a CM1 using a CM I/O board and the same problem happens.
4. We tried two other different distributions. ResinOS and PiCore. The problem happens with ResinOS and does not happen with PiCore.

bobs
Posts: 8
Joined: Mon Sep 26, 2016 1:05 pm

Re: Installing Image on CM3 twice failing

Wed May 23, 2018 5:00 pm

Just to clarify #4 above, using an CM3 that already exhibits the issue we can flash PiCore and the CM3 will boot. If we flash ResinOS, the CM3 will not boot. Haven't tried the experiment on a brand new CM3.

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1331
Joined: Sat Sep 10, 2011 11:43 am

Re: Installing Image on CM3 twice failing

Fri May 25, 2018 9:34 pm

I think we're going to need to get hold of your cm3 with the broken image so we can debug it. I cannot really even begin to hazard a guess at what the problem may be at the moment...

Email me at [email protected]

Gordon
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

Return to “Compute Module”