Recovery Tizen On ARTIK

From Tizen Wiki
Jump to: navigation, search

« back to Tizen_On_ARTIK

Introduction

Follow the procedure how to recover for Tizen 3.0 common image to ARTIK in case of eMMC booting.

Trouble Shooting

Partition issue

Due to partition chaging or broken issues, fastboot and lthor are not able to flash on ARTIK(eMMC).
In order to recover the partition on eMMC, we need to prepare SD card and a few files into the sd card.
The steps are similar to making SD booting disk and let's see how it works.

Preparing Recovery microSD

1. Download script

You can get script file and sd boot file from github.

$ git clone https://github.com/tizen-artik/sdboot

Enter the sdboot folder and check the file list.

$ ls
build.sh      prebuilt   tizen-sd-boot-artik10.tar.gz
mk_sdboot.sh  README.md  tizen-sd-boot-artik5.tar.gz

2. Make script executable

$ chmod +x mk_sdboot.sh

3. Checking SD card to flash
Prepare a microSD card (Recommend higher than 4GB)
Insert the microSD into your host PC

Check your microSD device node from ‘lsblk’ command

  • From below example, your card node might be “sdb”
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda      8:0    0 465.8G  0 disk 
├─sda1   8:1    0 461.9G  0 part /
├─sda2   8:2    0     1K  0 part 
└─sda5   8:5    0   3.9G  0 part [SWAP]
sdb      8:16   1   3.7G  0 disk 
└─sdb1   8:17   1   3.7G  0 part /media

4. Flashing Image
Format your microSD

  • Be careful, the command below must be run exactly as described. Just replace the /dev/sdX for your device!

ex) ARTIK 10

$ sudo ./mk_sdboot.sh -m artik10 -d /dev/sdb -f   # check your device name
WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util sfdisk doesn't support GPT. Use GNU Parted.

========================================
Label          dev           size
========================================
boot		 /dev/sdb1  	 32 MB
modules		 /dev/sdb2  	 32 MB
rootfs		 /dev/sdb3  	 2048 MB
[Extend]	 /dev/sdb4
 system-data	 /dev/sdb5  	 1024 MB
 user		 /dev/sdb6  	 621 MB
Remove partition table...
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.00367677 s, 139 kB/s
Checking that no-one is using this disk right now ...
OK

Disk /dev/sdb: 1018 cylinders, 122 heads, 62 sectors/track

sfdisk: ERROR: sector 0 does not have an msdos signature
 /dev/sdb: unrecognized partition table type
Old situation:
No partitions found
New situation:
Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start   End    MiB    #blocks   Id  System
/dev/sdb1   *     4     35     32      32768    e  W95 FAT16 (LBA)
/dev/sdb2        36     67     32      32768   83  Linux
/dev/sdb3        68   2115   2048    2097152   83  Linux
/dev/sdb4      2116   3762   1647    1686528    5  Extended
/dev/sdb5      2116+  3139   1024-   1048575+  83  Linux
/dev/sdb6      3140+  3760    621-    635903+  83  Linux
Successfully wrote the new partition table

Re-reading the partition table ...

If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)
mkfs.fat 3.0.26 (2014-03-07)
mkfs.fat: warning - lowercase labels might not work properly with DOS or Windows
bl1.bin
bl2.bin
u-boot.bin
tzsw.bin
params.bin
params_recovery.bin
params_sdboot.bin
zImage
exynos5422-artik10.dtb
uInitrd
modules.img
~/source/tizen/new/sdboot/artik10 ~/source/tizen/new/sdboot
4191+0 records in
4191+0 records out
2145792 bytes (2.1 MB) copied, 0.00545645 s, 393 MB/s
30+0 records in
30+0 records out
15360 bytes (15 kB) copied, 0.000108808 s, 141 MB/s
28+0 records in
28+0 records out
14336 bytes (14 kB) copied, 9.5132e-05 s, 151 MB/s
729+1 records in
729+1 records out
373464 bytes (373 kB) copied, 0.000665131 s, 561 MB/s
512+0 records in
512+0 records out
262144 bytes (262 kB) copied, 0.000489658 s, 535 MB/s
32+0 records in
32+0 records out
16384 bytes (16 kB) copied, 0.000139606 s, 117 MB/s
~/source/tizen/new/sdboot
~/source/tizen/new/sdboot/artik10 ~/source/tizen/new/sdboot
32+0 records in
32+0 records out
33554432 bytes (34 MB) copied, 0.0295966 s, 1.1 GB/s
mkfs.fat 3.0.26 (2014-03-07)
mkfs.fat: warning - lowercase labels might not work properly with DOS or Windows
~/source/tizen/new/sdboot
4190+0 records in
4190+0 records out
2145280 bytes (2.1 MB) copied, 0.587444 s, 3.7 MB/s
32+0 records in
32+0 records out
33554432 bytes (34 MB) copied, 4.72697 s, 7.1 MB/s
32+0 records in
32+0 records out
33554432 bytes (34 MB) copied, 4.62761 s, 7.3 MB/s 

If format and making partitions are done, please check the partition with 'lsblk" command. 3 partitions are created in sdX node.

$ lsblk
 sdb      8:16   1   3.7G  0 disk 
├─sdb1   8:17   1    32M  0 part 
├─sdb2   8:18   1    32M  0 part 
└─sdb3   8:19   1   128M  0 part

Make a Recovery device

If you use ARTIK 10 or 5, you should check the Tizen version when it is released. If your taget is installed Tizen OS which is from Dec 2016, you have to do Recovery at least once.
Otherwise if you face partition broken due to unexpected flashing, you can recover the boot partition. ARTIK 7 is also can be recovred, but it's not mandatory. If you face broken of partion issuse, you can follow it to recover.

For ARTIK10


$:~/source/tizen/new/sdboot$ sudo ./mk_sdboot.sh -m artik10 -d /dev/sdb -r

WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util sfdisk doesn't support GPT. Use GNU Parted.

========================================
Label          dev           size
========================================
boot		 /dev/sdb1  	 32 MB
modules		 /dev/sdb2  	 32 MB
rootfs		 /dev/sdb3  	 128 MB
Remove partition table...
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.00279869 s, 183 kB/s
Checking that no-one is using this disk right now ...
OK

Disk /dev/sdb: 1018 cylinders, 122 heads, 62 sectors/track

sfdisk: ERROR: sector 0 does not have an msdos signature
 /dev/sdb: unrecognized partition table type
Old situation:
No partitions found
New situation:
Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start   End    MiB    #blocks   Id  System
/dev/sdb1   *     4     35     32      32768    e  W95 FAT16 (LBA)
/dev/sdb2        36     67     32      32768   83  Linux
/dev/sdb3        68    195    128     131072   83  Linux
/dev/sdb4         0      -      0          0    0  Empty
Successfully wrote the new partition table

Re-reading the partition table ...

If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)
mkfs.fat 3.0.26 (2014-03-07)
mkfs.fat: warning - lowercase labels might not work properly with DOS or Windows
bl1.bin
bl2.bin
u-boot.bin
tzsw.bin
params.bin
params_recovery.bin
params_sdboot.bin
zImage
exynos5422-artik10.dtb
uInitrd
modules.img
~/source/tizen/new/sdboot/artik10 ~/source/tizen/new/sdboot
4191+0 records in
4191+0 records out
2145792 bytes (2.1 MB) copied, 0.00788911 s, 272 MB/s
30+0 records in
30+0 records out
15360 bytes (15 kB) copied, 0.000261673 s, 58.7 MB/s
28+0 records in
28+0 records out
14336 bytes (14 kB) copied, 0.000202517 s, 70.8 MB/s
729+1 records in
729+1 records out
373464 bytes (373 kB) copied, 0.00129813 s, 288 MB/s
512+0 records in
512+0 records out
262144 bytes (262 kB) copied, 0.000702726 s, 373 MB/s
32+0 records in
32+0 records out
16384 bytes (16 kB) copied, 0.000232472 s, 70.5 MB/s
~/source/tizen/new/sdboot
~/source/tizen/new/sdboot/artik10 ~/source/tizen/new/sdboot
32+0 records in
32+0 records out
33554432 bytes (34 MB) copied, 0.0305993 s, 1.1 GB/s
mkfs.fat 3.0.26 (2014-03-07)
mkfs.fat: warning - lowercase labels might not work properly with DOS or Windows
~/source/tizen/new/sdboot
~/source/tizen/new/sdboot/artik10 ~/source/tizen/new/sdboot
128+0 records in
128+0 records out
134217728 bytes (134 MB) copied, 0.0846271 s, 1.6 GB/s
mke2fs 1.42.9 (4-Feb-2014)
Discarding device blocks: done                            
Filesystem label=rootfs
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
32768 inodes, 32768 blocks
1638 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=33554432
1 block group
32768 blocks per group, 32768 fragments per group
32768 inodes per group

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

~/source/tizen/new/sdboot
4190+0 records in
4190+0 records out
2145280 bytes (2.1 MB) copied, 0.53713 s, 4.0 MB/s
32+0 records in
32+0 records out
33554432 bytes (34 MB) copied, 4.91878 s, 6.8 MB/s
32+0 records in
32+0 records out
33554432 bytes (34 MB) copied, 4.1308 s, 8.1 MB/s
128+0 records in
128+0 records out
134217728 bytes (134 MB) copied, 16.8514 s, 8.0 MB/s

For ARTIK5

$ sudo ./mk_sdboot.sh -m artik5 -d /dev/sdb -r

For ARTIK7

$ sudo ./mk_sdboot.sh -m artik710 -d /dev/sdb -r

Booting and Fusing the image

If you boot via SD card which you made, it will automatically be fused into eMMC.

ARTIK 5 / 10

Insert the microSD into your ARTIK5/10 devices.

  • Change OM pin to the SD card mode
    1. Turn on “OM pin number.1”
    2. Turn off “OM pin number.2”

ARTIK5 Board

Checking Boot Mode ... SDMMC
MMC:   S5P_MSHC2: 0, S5P_MSHC0: 1
MMC Device 0: 14.9 GiB
MMC Device 1: 14.6 GiB
MMC Device 2: MMC Device 2 not found
In:    serial
Out:   serial
Err:   serial
rst_stat : 0x100
Net:   No ethernet found.
Hit any key to stop autoboot:  0 
[Fusing Image from SD Card.]
[Partition table on MoviNAND]
ptn 0 name='fwbl1' start=0x0 len=N/A (use hard-coded info. (cmd: movi))
ptn 1 name='bl2' start=N/A len=N/A (use hard-coded info. (cmd: movi))
ptn 2 name='bootloader' start=N/A len=N/A (use hard-coded info. (cmd: movi))
ptn 3 name='tzsw' start=N/A len=N/A (use hard-coded info. (cmd: movi))
ptn 4 name='env' start=N/A len=N/A (use hard-coded info. (cmd: movi))
ptn 5 name='kernel' start=N/A len=N/A 
ptn 6 name='ramdisk' start=N/A len=0x1a00000(~26624KB) 
ptn 7 name='dtb' start=N/A len=N/A 
ptn 8 name='boot' start=0x100000 len=0x2000000(~32768KB) 
ptn 9 name='modules' start=0x2100000 len=0x2000000(~32768KB) 
ptn 10 name='rootfs' start=0x4100000 len=0x80000000(~2097152KB) 
ptn 11 name='system-data' start=0x84100000 len=0x40000000(~1048576KB) 
ptn 12 name='user' start=0xc4100000 len=0x2dfcfbe00(~12055535KB) 
Writing GPT: success!
mmc1(part 0) is current device
mmc0 is current device
[Fusing Image from SD Card.]
[Partition table on MoviNAND]
ptn 0 name='fwbl1' start=0x0 len=N/A (use hard-coded info. (cmd: movi))
ptn 1 name='bl2' start=N/A len=N/A (use hard-coded info. (cmd: movi))
ptn 2 name='bootloader' start=N/A len=N/A (use hard-coded info. (cmd: movi))
ptn 3 name='tzsw' start=N/A len=N/A (use hard-coded info. (cmd: movi))
ptn 4 name='env' start=N/A len=N/A (use hard-coded info. (cmd: movi))
ptn 5 name='kernel' start=N/A len=N/A 
ptn 6 name='ramdisk' start=N/A len=0x1a00000(~26624KB) 
ptn 7 name='dtb' start=N/A len=N/A 
ptn 8 name='boot' start=0x400000 len=0x2000000(~32768KB) 
ptn 9 name='modules' start=0x2400000 len=0x2000000(~32768KB) 
ptn 10 name='rootfs' start=0x4400000 len=0x80000000(~2097152KB) 
ptn 11 name='system-data' start=0x84400000 len=0x40000000(~1048576KB) 
ptn 12 name='user' start=0xc4400000 len=0x2df9fbe00(~12052463KB) 
15360 (0x00003c00) bytes read
flashing 'fwbl1'
eMMC OPEN Success.!!
                        !!!Notice!!!
!You must close eMMC boot Partition after all image writing!
!eMMC boot partition has continuity at image writing time.!
!So, Do not close boot partition, Before, all images is written.!
writing FWBL1 ..device 1 Start 0, Count 30 
MMC write: dev # 1, block # 0, count 30 ... 30 blocks write: OK
completed
eMMC CLOSE Success.!!
partition 'fwbl1' flashed
14336 (0x00003800) bytes read
flashing 'bl2'
eMMC OPEN Success.!!
                        !!!Notice!!!
!You must close eMMC boot Partition after all image writing!
!eMMC boot partition has continuity at image writing time.!
!So, Do not close boot partition, Before, all images is written.!
writing BL2 ..device 1 Start 30, Count 32 
MMC write: dev # 1, block # 30, count 32 ... 32 blocks write: OK
completed
eMMC CLOSE Success.!!
partition 'bl2' flashed
262144 (0x00040000) bytes read
flashing 'tzsw'
eMMC OPEN Success.!!
                        !!!Notice!!!
!You must close eMMC boot Partition after all image writing!
!eMMC boot partition has continuity at image writing time.!
!So, Do not close boot partition, Before, all images is written.!
writing 1 TrustZone S/W.. Start 2110, Count 2048 
MMC write: dev # 1, block # 2110, count 2048 ... 2048 blocks write: OK
completed
eMMC CLOSE Success.!!
partition 'tzsw' flashed
373464 (0x0005b2d8) bytes read
flashing 'bootloader'
eMMC OPEN Success.!!
                        !!!Notice!!!
!You must close eMMC boot Partition after all image writing!
!eMMC boot partition has continuity at image writing time.!
!So, Do not close boot partition, Before, all images is written.!
writing bootloader..device 1 Start 62, Count 2048 
MMC write: dev # 1, block # 62, count 2048 ... 2048 blocks write: OK
completed
eMMC CLOSE Success.!!
partition 'bootloader' flashed
16384 (0x00004000) bytes read
flashing 'env'
writing 1 Environment.. Start 4159, Count 32 
MMC write: dev # 1, block # 4159, count 32 ... 32 blocks write: OK
completed
partition 'env' flashed

MMC write: dev # 1, block # 8192, count 65536 ... 65536 blocks write: OK
(1/1) downloaded and flashed successfully

downloading of 33554432 bytes finished

MMC write: dev # 1, block # 73728, count 65536 ... 65536 blocks write: OK
(1/1) downloaded and flashed successfully

downloading of 33554432 bytes finished
File not found rootfs.img
File not found data.img
  • Turn off the target and changes OM pin as 'Off' all
  • Turn on the target and enter to boot mode.
Checking Boot Mode ... EMMC
MMC:   S5P_MSHC0: 0, S5P_MSHC2: 1
MMC Device 0: 14.6 GiB
MMC Device 1: [ERROR] response timeout error : 00000104 cmd 1
Card did not respond to voltage select!
In:    serial
Out:   serial
Err:   serial
rst_stat : 0x100
Net:   No ethernet found.
Hit any key to stop autoboot:  0 
ARTIK10 # 

ARTIK 7

Insert the microSD into your ARTIK7 devices. - Turn on “OM pin number.4”

ARTIK7 Board

  • Turn on the Target with SD card
U-Boot 2016.01-ge9fb5cf (Dec 19 2016 - 11:07:28 +0900)

Model: Samsung artik710 raptor board based on Nexell s5p6818

Board: ARTIK710 Raptor
DRAM:  991 MiB
HW Revision:    3
MMC:   NEXELL DWMMC: 0, NEXELL DWMMC: 1
In:    serial
Out:   serial
Err:   serial
Cannot read from device: 00000000795383f0 register: 0x10 -121
Cannot read sensor type - -121
Net:   
Warning: ethernet@c0060000 (eth0) using random MAC address - 12:5b:fd:40:3d:39
eth0: ethernet@c0060000
Hit any key to stop autoboot:  0 
** Unrecognized filesystem type **
576 bytes read in 10 ms (55.7 KiB/s)

Partitions:
  mmc.0 : 2ndboot : img : 0x200, 0x10000 : bl1-emmcboot.img , 0
  mmc.0 : fip-loader : img : 0x10200, 0x50000 : fip-loader-emmc.img , 0
  mmc.0 : fip-secure : img : 0x60200, 0x180000 : fip-secure.img , 0
  mmc.0 : fip-nonsecure : img : 0x1e0200, 0x100000 : fip-nonsecure.img , 0
  mmc.0 : env : img : 0x2e0200, 0x4000 : params.bin , 0
  mmc.0 : boot : fs : 0x400000, 0x2000000 : boot.img , 1
  mmc.0 : modules : fs : 0x2400000, 0x2000000 : modules.img , 2
  mmc.0 : rootfs : fs : 0x4400000, 0x80000000 : rootfs.img , 3
  mmc.0 : system-data : fs : 0x84500000, 0x40000000 : system-data.img , 4
  mmc.0 : user : fs : 0xc4500000, 0x0 : user.img , 5

24976 bytes read in 13 ms (1.8 MiB/s)
** mmc.0 partition 2ndboot (Image)**
switch to partitions #0, OK
mmc0(part 0) is current device

MMC write: dev # 0, block # 1, count 49 ... 49 blocks written: OK
Flash : bl1-emmcboot.img - DONE
279040 bytes read in 26 ms (10.2 MiB/s)
** mmc.0 partition fip-loader (Image)**
switch to partitions #0, OK
mmc0(part 0) is current device

MMC write: dev # 0, block # 129, count 545 ... 545 blocks written: OK
Flash : fip-loader-emmc.img - DONE
261856 bytes read in 27 ms (9.2 MiB/s)
** mmc.0 partition fip-secure (Image)**
switch to partitions #0, OK
mmc0(part 0) is current device

MMC write: dev # 0, block # 769, count 512 ... 512 blocks written: OK
Flash : fip-secure.img - DONE
518208 bytes read in 42 ms (11.8 MiB/s)
** mmc.0 partition fip-nonsecure (Image)**
switch to partitions #0, OK
mmc0(part 0) is current device

MMC write: dev # 0, block # 3841, count 1013 ... 1013 blocks written: OK
Flash : fip-nonsecure.img - DONE
16384 bytes read in 19 ms (841.8 KiB/s)
** mmc.0 partition env (Image)**
switch to partitions #0, OK
mmc0(part 0) is current device

MMC write: dev # 0, block # 5889, count 32 ... 32 blocks written: OK
Flash : params.bin - DONE
33554432 bytes read in 1052 ms (30.4 MiB/s)
** mmc.0 partition boot (FS)**
switch to partitions #0, OK
mmc0(part 0) is current device
switch to partitions #0, OK
mmc0(part 0) is current device
write mmc.0 = 0x400000(0x2000) ~ 0x2000000(0x10000): Done
Flash : boot.img - DONE
33554432 bytes read in 1576 ms (20.3 MiB/s)
** mmc.0 partition modules (FS)**
switch to partitions #0, OK
mmc0(part 0) is current device
switch to partitions #0, OK
mmc0(part 0) is current device
write mmc.0 = 0x2400000(0x12000) ~ 0x2000000(0x10000): Done
Flash : modules.img - DONE
** File not found rootfs.img **
33554432 bytes read in 28 ms (1.1 GiB/s)
** File not found system-data.img **
33554432 bytes read in 28 ms (1.1 GiB/s)
** File not found user.img **
33554432 bytes read in 28 ms (1.1 GiB/s)
sd recovery end
  • Turn off the target and changes OM pin as 'Off' all
  • Turn on the target and see how it works.

Finally, your boot partition was recovered and possible to re-flash kernel, modules, dtb, rootfs, user and system-data using fastboot or lthor.