Skip to contentSkip to conversation

upgrading u-boot from linux for SH7785LCR board

DISCUSSION Bill Traynor 3 participants 5 messages Jul 4, 2010 – Jul 5, 2010 SuperH

lore
Share & tools
lore
#0 lore raw

I've compiled and tested u-boot from git for the 7785lcr board. I'd like to write the u-boot.bin to flash but do not have a JTAG to be able to recover if the write fails.

Given the MTD layout:
dev: size erasesize name
mtd0: 00080000 00040000 "loader"
mtd1: 00080000 00040000 "bootenv"
mtd2: 00400000 00040000 "kernel"
mtd3: 03b00000 00040000 "data"

Is it reasonable to do the following:

flash_erase /dev/mtd[0]
dd if=/tmp/u-boot.bin of=/dev/mtd0 bs8k conv=sync

I'd rather not brick the board I have, so if someone who does have the capability to recover could test this method for me, it'd be appreciated.

Thanks
Bill

#1 lore raw
Quoted 11 lines · On Sunday, July 04, 2010 14:11:15 Bill Traynor wrote:

I've compiled and tested u-boot from git for the 7785lcr board. I'd like to write the u-boot.bin to flash but do not have a JTAG to be able to recover if the write fails.

Given the MTD layout:
dev: size erasesize name
mtd0: 00080000 00040000 "loader"
mtd1: 00080000 00040000 "bootenv"
mtd2: 00400000 00040000 "kernel"
mtd3: 03b00000 00040000 "data"

Quoted 4 lines

Is it reasonable to do the following:

flash_erase /dev/mtd[0]
dd if=/tmp/u-boot.bin of=/dev/mtd0 bs=128k conv=sync

why dont you just use the mtdblock interface ? it will take care of all the weird flash issues like erasing/etc...

all i do is:
cat u-boot.bin > /dev/mtdblock0
-mike

#2 lore raw
In reply to Bill Traynor

Hi, Bill.

Quoted 11 lines · Bill Traynor

I've compiled and tested u-boot from git for the 7785lcr board. I'd like to write the u-boot.bin to flash but do not have a JTAG to be able to recover if the write fails.

Given the MTD layout:
dev: size erasesize name
mtd0: 00080000 00040000 "loader"
mtd1: 00080000 00040000 "bootenv"
mtd2: 00400000 00040000 "kernel"
mtd3: 03b00000 00040000 "data"

Quoted 4 lines

Is it reasonable to do the following:

flash_erase /dev/mtd[0]
dd if=/tmp/u-boot.bin of=/dev/mtd0 bs8k conv=sync

I think that you shoud use flashcp command if you use flash_erase. This command is in mtd-utils ( same flash_erase).

Best regards,
Nobuhiro

#3 lore raw
In reply to Bill Traynor
Quoted 15 lines · Mike Frysinger
Quoted 13 lines · On Sunday, July 04, 2010 14:11:15 Bill Traynor wrote:

I've compiled and tested u-boot from git for the 7785lcr board. I'd like to write the u-boot.bin to flash but do not have a JTAG to be able to recover if the write fails.

Given the MTD layout:
dev: size erasesize name
mtd0: 00080000 00040000 "loader"
mtd1: 00080000 00040000 "bootenv"
mtd2: 00400000 00040000 "kernel"
mtd3: 03b00000 00040000 "data"

Is it reasonable to do the following:

Quoted 9 lines
Quoted 3 lines

flash_erase /dev/mtd[0]
dd if=/tmp/u-boot.bin of=/dev/mtd0 bs8k conv=sync

why dont you just use the mtdblock interface ? it will take care of all the weird flash issues like erasing/etc...

all i do is:
cat u-boot.bin> /dev/mtdblock0

Thanks, that worked perfectly.

Quoted 2 lines

-mike

#4 lore raw
In reply to Bill Traynor
Quoted 5 lines · On Sunday, July 04, 2010 23:29:28 Bill Traynor wrote:
Quoted 2 lines · Mike Frysinger

all i do is:
cat u-boot.bin> /dev/mtdblock0

Thanks, that worked perfectly.

for safety sake, you might want to dd it back out and cmp the result. so something like:

	dd if=/dev/mtdblock0 of=u-boot.bin.new \
		ibs=$(wc -c u-boot.bin | awk '{print $1}') count=1
	cmp u-boot.bin u-boot.bin.new

-mike