1

I have Arch linux on multiple Embedded boards that are similar to Odroid C2. To resolve a DTB file issue, I wrote dtb.img to /dev/dtb of the eMMC via the command :

dd if="/boot/dtb.img" of="/dev/dtb" bs=262144 status=none && sync

This resulted in the partition table of the eMMC getting corrupted. I can no longer boot from eMMC. During boot up from eMMC I get errors on a couple of places.

I have a 4 month old backup image that I can use to rebuild this system. How should I go about rebuilding the boot partition from a backup image, such that I do not lose the /dev/data EXT4 partition ?

Relevant logs from boot via eMMC that fails :

[2.157928@0] Unpacking initramfs...
[2.157940@0] Initramfs unpacking failed: junk in compressed archive
[5.135966@2] emmc: delay[6]= 3375 padding= 5, bidx=3
[5.135968@2] emmc: delay[7]= 2875 padding= 1, bidx=2
[5.135970@2] emmc: calibration result @ 0: max(3875), min(2875)
[5.135973@2] emmc: line_delay =0x84854056, max_cal_result =3875
[5.135975@2] emmc: base_index_max 3, base_index_min 2
[5.135980@2] emmc: clk 200000000 SDR mode tuning start
[5.136278@2] emmc: rx_tuning_result[0] = 10
[5.136491@2] emmc: rx_tuning_result[1] = 10
[5.136701@2] emmc: rx_tuning_result[2] = 10
[5.136934@2] emmc: rx_tuning_result[4] = 10
[5.136936@2] emmc: best_win_start =4, best_win_size =4
[5.136938@2] emmc: adj_win_start 5
[5.136940@2] emmc: sd_emmc_regs->gclock=0x1000245,sd_emmc_regs->gadjust=0x2007
[5.136943@2] emmc: gclock =0x1000245, gdelay=0x84854056, gadjust=0x2007
[5.137014@2] emmc: new HS200 MMC card at address 0001
[5.141476@2] emmc: clock 200000000, 8-bit-bus-width
[5.141708@2] mmcblk0: emmc:0001 AWPD3R 14.5 GiB 
[5.141819@2] mmcblk0boot0: emmc:0001 AWPD3R partition 1 4.00 MiB
[5.141927@2] mmcblk0boot1: emmc:0001 AWPD3R partition 2 4.00 MiB
[5.142038@2] mmcblk0rpmb: emmc:0001 AWPD3R partition 3 4.00 MiB
[5.142728@1]  mmcblk0: unknown partition table
[5.143254@2] [mmc_read_partition_tbl] mmc read partition OK!
[5.143255@2] add_emmc_partition
[5.143409@1] [mmcblk0p01]           bootloader  offset 0x000000000000, size 0x000000400000 
[5.143531@1] [mmcblk0p02]             reserved  offset 0x000002400000, size 0x000004000000 
[5.143647@1] [mmcblk0p03]                cache  offset 0x000006c00000, size 0x000020000000 
[5.143764@1] [mmcblk0p04]                  env  offset 0x000027400000, size 0x000000800000 
[5.143882@1] [mmcblk0p05]                 logo  offset 0x000028400000, size 0x000002000000 
[5.143999@1] [mmcblk0p06]             recovery  offset 0x00002ac00000, size 0x000002000000 
[5.144116@1] [mmcblk0p07]                  rsv  offset 0x00002d400000, size 0x000000800000 
[5.144236@1] [mmcblk0p08]                  tee  offset 0x00002e400000, size 0x000000800000 
[5.144355@1] [mmcblk0p09]                crypt  offset 0x00002f400000, size 0x000002000000 
[5.144479@1] [mmcblk0p10]                 misc  offset 0x000031c00000, size 0x000002000000 
[5.144597@1] [mmcblk0p11]            instaboot  offset 0x000034400000, size 0x000020000000 
[5.144720@1] [mmcblk0p12]                 boot  offset 0x000054c00000, size 0x000002000000 
[5.144836@1] [mmcblk0p13]               system  offset 0x000057400000, size 0x000040000000 
[5.144953@1] [mmcblk0p14]                 data  offset 0x000097c00000, size 0x00030c200000 
[7.528113@2] UDF-fs: bad mount option "data=ordered" or missing value
[7.533304@2] List of all partitions:
[7.537253@2] b300        15267840 mmcblk0  driver: mmcblk
[7.544342@2]   b301            4096 mmcblk0p1 
[7.550153@2]   b302           65536 mmcblk0p2 
[7.554602@2]   b303          524288 mmcblk0p3 
[7.560638@2]   b304            8192 mmcblk0p4 
[7.566567@2]   b305           32768 mmcblk0p5 
[7.572389@2]   b306           32768 mmcblk0p6 
[7.578165@2]   b307            8192 mmcblk0p7 
[7.583837@2]   b308            8192 mmcblk0p8 
[7.589418@2]   b309           32768 mmcblk0p9 
[7.594886@2]   b30a           32768 mmcblk0p10 
[7.600250@2]   b30b          524288 mmcblk0p11 
[7.605580@2]   b30c           32768 mmcblk0p12 
[7.610882@2]   b30d         1048576 mmcblk0p13 
[7.616163@2]   b30e        12781568 mmcblk0p14 
[7.621396@2] b360            4096 mmcblk0rpmb  (driver?)
[7.626623@2] b340            4096 mmcblk0boot1  (driver?)
[7.631776@2] b320            4096 mmcblk0boot0  (driver?)
[7.636883@2] b380        15558144 mmcblk1  driver: mmcblk
[7.641942@2]   b381           98304 mmcblk1p1 720e0863-01
[7.648518@2]   b382         7766016 mmcblk1p2 720e0863-02
[7.653879@2] No filesystem could mount root, tried:  ext3 ext2 ext4 cramfs vfat msdos iso9660 udf btrfs
[7.661669@2] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,14)
[7.668121@2] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 3.14.29-g70e9c2a-dirty #1

In these logs, it seems that the Partition table information is there. The mmcblk0p14 should be used for rootfs, as it was working before this incident.

The commands "fdisk -l" and "parted -l" return the following output:

[root@alarm pankaj]# fdisk -l
------------------------------
Disk /dev/mmcblk0: 14.6 GiB, 15634268160 bytes, 30535680 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

Disk /dev/mmcblk0rpmb: 4 MiB, 4194304 bytes, 8192 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

Disk /dev/mmcblk0boot1: 4 MiB, 4194304 bytes, 8192 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

Disk /dev/mmcblk0boot0: 4 MiB, 4194304 bytes, 8192 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

Disk /dev/mmcblk1: 14.9 GiB, 15931539456 bytes, 31116288 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: 0x720e0863

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk1p1 *      2048   198655   196608   96M  b W95 FAT32
/dev/mmcblk1p2      198656 15730687 15532032  7.4G 83 Linux

[root@alarm pankaj]# parted -l
-----------------------------------
Error: /dev/mmcblk0rpmb: unrecognised disk label
Model: Generic SD/MMC Storage Card (sd/mmc)                               
Disk /dev/mmcblk0rpmb: 4194kB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 

Error: /dev/mmcblk0boot0: unrecognised disk label
Model: Generic SD/MMC Storage Card (sd/mmc)                               
Disk /dev/mmcblk0boot0: 4194kB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 

Error: /dev/mmcblk0boot1: unrecognised disk label
Model: Generic SD/MMC Storage Card (sd/mmc)                               
Disk /dev/mmcblk0boot1: 4194kB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 

Error: /dev/mmcblk0: unrecognised disk label
Model: MMC AWPD3R (sd/mmc)                                                
Disk /dev/mmcblk0: 15.6GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 

Model: SD SL16G (sd/mmc)
Disk /dev/mmcblk1: 15.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  102MB   101MB   primary  fat32        boot
 2      102MB   8054MB  7952MB  primary  ext4

closed as too broad by Rui F Ribeiro, slm Jun 30 '18 at 20:22

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.