Creating a burning CF card - not working

I do the following on my linux box:

[ 5132.973586] sd 9:0:0:0: [sdk] Write Protect is off
[ 5132.973589] sd 9:0:0:0: [sdk] Mode Sense: 03 00 00 00
[ 5132.973801] sd 9:0:0:0: [sdk] No Caching mode page found
[ 5132.973807] sd 9:0:0:0: [sdk] Assuming drive cache: write through
[ 5132.975745] sdk: sdk1
[ 5132.976867] sd 9:0:0:0: [sdk] Attached SCSI removable disk
[root@grover ~]# fdisk /dev/sdk

Welcome to fdisk (util-linux 2.29).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): p
Disk /dev/sdk: 7.4 GiB, 7969177600 bytes, 15564800 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: 0xda5cc1d8

Device Boot Start End Sectors Size Id Type
/dev/sdk1 * 2048 15564799 15562752 7.4G b W95 FAT32

Command (m for help): q

[root@grover ~]# mkfs.vfat /dev/sdk1
mkfs.fat 4.0 (2016-05-06)
[root@grover ~]# cd /home/home/ed/Downloads/Vim_Uboot_161008
[root@grover Vim_Uboot_161008]# ls
u-boot.bin u-boot.bin.sd.bin x
[root@grover Vim_Uboot_161008]# dd if=u-boot.bin.sd.bin of=/dev/sdk bs=1 count=444 && sync
444+0 records in
444+0 records out
444 bytes copied, 0.0324785 s, 13.7 kB/s
[root@grover Vim_Uboot_161008]# dd if=u-boot.bin.sd.bin of=/dev/sdk bs=512 skip=1 seek=1 && sync
1792+0 records in
1792+0 records out
917504 bytes (918 kB, 896 KiB) copied, 0.163226 s, 5.6 MB/s
[root@grover Vim_Uboot_161008]# cd /home/home/ed/Downloads
[root@grover Downloads]# ls -l aml*
-rw-r–r-- 1 ed users 589 Jan 12 22:45 aml_sdc_burn.ini
[root@grover Downloads]# cp -a aml_sdc_burn.ini Vim_Marshmallow_161211/update.img ^C
[root@grover Downloads]# mkdir sdk
[root@grover Downloads]# mount /dev/sdk1 sdk
[root@grover Downloads]# cp -a aml_sdc_burn.ini Vim_Marshmallow_161211/update.img sdk/
cp: failed to preserve ownership for ‘sdk/aml_sdc_burn.ini’: Operation not permitted
cp: failed to preserve ownership for ‘sdk/update.img’: Operation not permitted
[root@grover Downloads]# sync
[root@grover Downloads]# umount sdk
[root@grover Downloads]#

Then I move the card to the vim

hold the power button down
press the reset button for second
wait 2-3 seconds and release the power button

the vim boots and ends up showing (via serial console)

U-Boot 2015.01-g101afee (Dec 11 2016 - 13:35:15)

DRAM: 2 GiB
Relocation Offset is: 76ecc000
register usb cfg[0][1] = 0000000077f5f580
vpu: error: vpu: check dts: FDT_ERR_BADMAGIC, load default parameters
vpu: clk_level = 7
vpu: set clk: 666667000Hz, readback: 666660000Hz(0x300)
vpp: vpp_init
boot_device_flag : 1
Nand PHY Ver:1.01.001.0006 © 2013 Amlogic Inc.
init bus_cycle=6, bus_timing=7, system=5.0ns
reset failed
get_chip_type and ret:fffffffe
get_chip_type and ret:fffffffe
chip detect failed and ret:fffffffe
nandphy_init failed and ret=0xfffffff1
MMC: aml_priv->desc_buf = 0x0000000073ecc6b0
aml_priv->desc_buf = 0x0000000073ece9d0
SDIO Port B: 0, SDIO Port C: 1
emmc/sd response timeout, cmd8, status=0x1ff2800
emmc/sd response timeout, cmd55, status=0x1ff2800
[mmc_startup] mmc refix success
[mmc_init] mmc init success
mmc read lba=0x14000, blocks=0x400
start dts,buffer=0000000073ed1270,dt_addr=0000000073ed1270
parts: 11
00: logo 0000000002000000 1
01: recovery 0000000002000000 1
02: rsv 0000000000800000 1
03: tee 0000000000800000 1
04: crypt 0000000002000000 1
05: misc 0000000002000000 1
06: instaboot 0000000020000000 1
07: boot 0000000002000000 1
08: system 0000000040000000 1
09: cache 0000000020000000 2
10: data ffffffffffffffff 4
get_dtb_struct: Get emmc dtb OK!
overide_emmc_partition_table: overide cache
[mmc_get_partition_table] skip partition cache.
Partition table get from SPL is :
name offset size flag

0: bootloader 0 400000 0
1: reserved 2400000 4000000 0
2: cache 6c00000 20000000 2
3: env 27400000 800000 0
4: logo 28400000 2000000 1
5: recovery 2ac00000 2000000 1
6: rsv 2d400000 800000 1
7: tee 2e400000 800000 1
8: crypt 2f400000 2000000 1
9: misc 31c00000 2000000 1
10: instaboot 34400000 20000000 1
11: boot 54c00000 2000000 1
12: system 57400000 40000000 1
13: data 97c00000 30c200000 4
mmc read lba=0x12000, blocks=0x2
mmc read lba=0x12002, blocks=0x2
mmc_read_partition_tbl: mmc read partition OK!
eMMC/TSD partition table have been checked OK!
mmc env offset: 0x27400000
In: serial
Out: serial
Err: serial
reboot_mode=cold_boot
hpd_state=1
set hdmitx VIC = 16
config HPLL = 2970
HPLL: 0xc000027b
config HPLL done
j = 4 vid_clk_div = 1
hdmitx phy setting done
hdmitx: set enc for VIC: 16
rx version is 1.4 or below div=10
hdmtix: set audio
[store]To run cmd[emmc dtb_read 0x1000000 0x40000]
read emmc dtb
Net: dwmac.c9410000
wipe_data=successful
wipe_cache=successful
upgrade_step=2
[OSD]load fb addr from dts
[OSD]failed to get fb addr for logo
[OSD]use default fb_addr parameters
[OSD]fb_addr for logo: 0x3d800000
[OSD]load fb addr from dts
[OSD]failed to get fb addr for logo
[OSD]use default fb_addr parameters
[OSD]fb_addr for logo: 0x3d800000
[CANVAS]canvas init
[CANVAS]addr=0x3d800000 width=3840, height=2160
amlkey_init() enter!
[EFUSE_MSG]keynum is 4
[BL31]: tee size: 0
[KM]Error:f[key_manage_query_size]L507:key[usid] not programed yet
[KM]Error:f[key_manage_query_size]L507:key[mac] not programed yet
[KM]Error:f[key_manage_query_size]L507:key[deviceid] not programed yet
get_cpu_id flag_12bit=1
saradc - saradc sub-system

Usage:
saradc saradc open - open a SARADC channel
saradc close - close the SARADC
saradc getval - get the value in current channel
saradc get_in_range - return 0 if current value in the range of current channel

gpio: pin GPIOAO_2 (gpio 102) value is 0
detect upgrade key
gpio: pin GPIOAO_2 (gpio 102) value is 0
InUsbBurn
[MSG]sof
Set Addr 39
Get DT cfg
Get DT cfg
set CFG

The HDMI output shows “VIM” and no upgrade takes place.

Ideas?
Ed

It seems that something wrong there: you didn’t copy the aml_sdc_burn.ini and update.img successfully yet.

Check http://docs.khadas.com/bootcamp/CreateBurnCardViaCLI/ for more info.

[root@grover Downloads]# cp -a aml_sdc_burn.ini Vim_Marshmallow_161211/update.img sdk/
cp: failed to preserve ownership for ‘sdk/aml_sdc_burn.ini’: Operation not permitted
cp: failed to preserve ownership for ‘sdk/update.img’: Operation not permitted

the ownership errors are because the files are coming from a unix fs and fat does not support the unix owner and chmod bits - the copy still works.

fyi:

root@grover Downloads]# time cp -a aml_sdc_burn.ini Vim_Marshmallow_161211/update.img sdk/
cp: failed to preserve ownership for ‘sdk/aml_sdc_burn.ini’: Operation not permitted
cp: failed to preserve ownership for ‘sdk/update.img’: Operation not permitted

real 0m0.474s
user 0m0.000s
sys 0m0.473s
[root@grover Downloads]# time umount sdk

real 0m56.168s
user 0m0.000s
sys 0m0.147s

Note the umount taking 56 seconds and I can see sdk being written at about 12M/second

(thanks for the fast reply)

Does your issue been solved?

Just not understand your 2nd reply:grin:

No, still the same problem. The unix time command shows how long a command takes to run. The point was to show that quite a bit of data was written to sdk even though cp complained that it could not preserve the ownership info.

Do you see anything in the Uboot log? The data is on the card but the upgrade does not start…

I really do not want to try to erase the eMMC util I have a sd card booting

Hi Gouwa

I have tried this using run update in u-boot:

kvim#run update
InUsbBurn
[MSG]sof
Set Addr 19
Get DT cfg
Get DT cfg
set CFG

same results (Vim is displayed on HDMI and nothing updates)

Is there a way to do this using tftp?

I’ve setup a server and reading the u-boot image works as in the example.

kvim#tftp 1080000 u-boot.bin
Speed: 100, full duplex
Using dwmac.c9410000 device
TFTP from server 192.168.7.4; our IP address is 192.168.7.7
Filename ‘u-boot.bin’.
Load address: 0x1080000
Loading: ###############################################################
5.6 MiB/s
done
Bytes transferred = 917504 (e0000 hex)

How would I use tftp to read the update.img and flash it?

Thanks
Ed

Hi

I used the ‘stor init 3’ method to clear the emmc.

The the burning SD previously created booted and HDMI output was as expected (it says updating and the bar reaches 100%). Then it reboots, displays the android boot animation, and eventually crashes. I have tried three ‘roms’

Vim_Marshmallow_Root_161213
Vim_Marshmallow_161211
Vim_Marshmallow_161209

with Vim_Uboot_161008 & aml on the site 12 Jan

the last entries on the serial console before it crashes are:

[ 21.101561@2] avc open
[ 21.101609@2] allocating phys 0x75100000, size 20480k, wq:ffffffc045fdb400.
[ 21.105212@2] amvenc_avc memory config sucess, buff start:0x75100000, size is 0x1400000, wq:ffffffc045fdb400.
[ 21.116495@2] avc release, wq:ffffffc045fdb400
[ 21.119800@2] remove encode_work_queue ffffffc045fdb400 sucess, _destroy_encode_work_queue line 4285.

complete log at: http://pastebin.ca/3757415

The board says its 1.2 1610 4916 and if the emmc is between the cpu and gpio pins its a samsung

Ideas?
Ed

Didn’t found any issue from the log you posted.

And did you figure out ** Operation not permitted** issue? Screenshot as below from your 1st post:

Gouwa,

That is a normal message when copy from a unix filesystem to a dos filesystem. The dos (fat/vfat/exfat) filesystem has no idea what to do with the unix owner and permissions so ‘cp’ complains.

Guess I will need to get the logs of the upgrade too. Something somewhere has got to be getting an error - the serial console was frozen after those last messages. The android boot animation just stops and no desktop screen ever gets displayed.

pastebin.ca works okay from China? If not, can you recommend a pastebin that does?

Thanks
Ed

I mean I have checked the log you uploaded at pastebin.ca, but didn’t found any issue from the log.

May be you can post more/full contents with the log, I just the below as the end:

[   20.815138@0] P2P interface started
[   20.882661@3] dhd_pktfilter_offload_set: failed to add pktfilter 102 0 0 0 0xFFFFFF 0x01005E, retcode = -2
[   20.907804@3] dhd_set_suspend: Remove extra suspend setting
[   21.101561@2] avc open
[   21.101609@2] allocating phys 0x75100000, size 20480k, wq:ffffffc045fdb400.
[   21.105212@2] amvenc_avc  memory config sucess, buff start:0x75100000, size is 0x1400000, wq:ffffffc045fdb400.
[   21.116495@2] avc release, wq:ffffffc045fdb400
[   21.119800@2] remove  encode_work_queue ffffffc045fdb400 sucess, _destroy_encode_work_queue line 4285.

Have you tried with upgrade using USB-C cable approach on Windows PC?

Gouwa,

That is the end of the log. At that point nothing responds. The serial console is dead and the boot animation stops…

Windows is hard since I linux only here - will see if I can borrow from work…

I do have a tftp server working. Is there a process to do it using tftp?

Thanks
Ed

http://docs.khadas.com/develop/LoadImagesWithUBootViaTFTP/

Just release the draft-version for your reference first.

At first please try to write only 442 bytes to keep all needed MBR data.
Please refer https://en.wikipedia.org/wiki/Master_boot_record/ .

Hi,

Still tring to get a good burning card working here. Updated to the lastest uboot & ubuntu images.

ls -l
total 418896
-rw-r–r-- 1 ed users 589 Jan 21 10:29 aml_sdc_burn.ini
drwxr-xr-x 1 root root 0 Jan 22 14:03 h
-rw-r–r-- 1 ed users 917504 Jan 21 09:40 u-boot.bin
-rw-r–r-- 1 ed users 918016 Jan 21 09:40 u-boot.bin.sd.bin
-rw-r–r-- 1 ed users 49152 Jan 21 09:40 u-boot.bin.usb.bl2
-rw-r–r-- 1 ed users 868352 Jan 21 09:40 u-boot.bin.usb.tpl
-rw-r–r-- 1 root root 426185740 Jan 19 22:57 update.img
drwxr-xr-x 1 ed users 0 Jan 22 13:40 Vim_Uboot_170121
drwxr-xr-x 1 ed users 0 Jan 22 14:02 Vim_Ubuntu-server-16.04_V170120

mkfs.vfat /dev/sdh1
dd if=u-boot.bin.sd.bin of=/dev/sdh conv=fsync,notrunc bs=1 count=442 # as per Andrey’s suggestion
dd if=u-boot.bin.sd.bin of=/dev/sdh conv=fsync,notrunc bs=512 skip=1 seek=1
mount /dev/sdh1 h
cp --sparse=never aml_sdc_burn.ini update.img h/
sync
umount h
minicom -D /dev/ttyUSB0

and inserted the card in the vim and powered on generating the following logs

http://pastebin.ca/3759315

Any idea on what is not working in this attempt?

TIA
Ed

It seems that it’s ROM’s issue: current built doesn’t support SD card burning yet.(Will fix in next built)
Please upgrade with WIndows + USB-C cable approach.

I seems like that you have not prepared partitions on eMMC (for example you have not the boot partition). Please boot from SD till U-Boot console, erase flash, write new dtb for creating needed partitions, write u-boot.bin to the first bootloader partition, then run
#defenv
#saveenv
for saving env.

In other words please follow instruction where descriped this processhttp://docs.khadas.com/develop/LoadImagesWithUBootViaTFTP/

I found a w10 box and used the burning tool to get the image loaded. tftp would be interesting, but where is the dtb file found? ( need to find a good description of the arm boot process ).

kvim.dtb file created during Linux kernel build process.

http://docs.khadas.com/social/BuildBootloaderAndRamfs/

1 Like