Skip to contentSkip to conversation

Socfpga preloader signing patch

U-Boot Pavel Machek 3 participants 5 messages Apr 4, 2014 – Apr 7, 2014

lore
Share & tools
lore
#0 lore raw

Hi!

I'm trying to get custom preloader to work (on EBV Socrates)... I tried applying old patch from mail archives, but a) applying patch from mail archives is not fun and b) it did not seem to do the trick.

Do you have newer version of the socfpga image signing patch by chance? (Or v7 in format more suitable for application than web archive?)

Thanks,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#1 lore raw

Hi!

Quoted 3 lines

I'm trying to get custom preloader to work (on EBV Socrates)... I tried applying old patch from mail archives, but a) applying patch from mail archives is not fun and b) it did not seem to do the trick.

Just to make sure... right way to use the
socfpga-signed-preloader.bin is

dd if=socfpga-signed-preloader.bin of=/dev/mmcblk0p1 bs=64k seek=0 dd if=u-boot.img of=/dev/mmcblk0p1 bs=64K seek=4

right?

Thanks,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#2 lore raw
Quoted 7 lines · Pavel Machek

Hi!

Quoted 3 lines

I'm trying to get custom preloader to work (on EBV Socrates)... I tried applying old patch from mail archives, but a) applying patch from mail archives is not fun and b) it did not seem to do the trick.

Quoted 5 lines

Just to make sure... right way to use the
socfpga-signed-preloader.bin is

dd if=socfpga-signed-preloader.bin of=/dev/mmcblk0p1 bs=64k seek=0 dd if=u-boot.img of=/dev/mmcblk0p1 bs=64K seek=4

Assuming that mmcblk0p1 is the raw partition (type A2) on your disk, then yes these are the correct instructions. You only update one of the four preloader copies, but this is fine as well. Cannot spot a problem here.

virtually yours
Gerhard Sittig

Signature · 3 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
#3 lore raw
In reply to Pavel Machek
Quoted 11 lines · On Saturday 05 April 2014 09:47:02 Pavel Machek wrote:

Hi!

Quoted 3 lines

I'm trying to get custom preloader to work (on EBV Socrates)... I tried applying old patch from mail archives, but a) applying patch from mail archives is not fun and b) it did not seem to do the trick.

Just to make sure... right way to use the
socfpga-signed-preloader.bin is

dd if=socfpga-signed-preloader.bin of=/dev/mmcblk0p1 bs=64k seek=0 dd if=u-boot.img of=/dev/mmcblk0p1 bs=64K seek=4

Almost right.

It must be partition 3, which must be of type A2.

dd .....of=/dev/mmcblk0p3 ...

I use the following script to set up an sd card with some useful partitions:

#!/bin/bash
# Script to partition an SDCard for the SoCFPGA

# /dev/sdx3 MUST be type A2. It is used for the bootloaders.
#
# We also make /dev/sdx1 -  FAT, then the rest is ext2
#

#set -e -x

DEVICE=$1
THIS_DIR="$( cd "$( dirname "$0" )" && pwd )"
BASE_DIR="${THIS_DIR}/.."

errmsg() {
	echo "Error: $@" 2>&1
}
errdie() {
	errmsg "$@"
	exit 1
}
log() {
	echo '----'
	echo "$@"
	echo '----'
}

usage() {
echo "Usage: $1 <sd/mmc device file>"
}

if [ $# -ne 1 ]; then
errmsg "incorrect usage"
usage $0
exit 1
fi

DEVICE=$1

# precondition checks

if [ ! -b ${DEVICE} ]; then

	errdie "${DEVICE} is not an accessable block device"

fi

# confirm

read -p "The ${DEVICE} device will be formatted. Continue? [y/n] " answer if [ "$answer" != "y" ]; then

	exit 0;

fi

# umount if device partitions are mounted

for partition in mount | grep ${DEVICE} | cut -d ' ' -f 1; do

	echo "Umounting ${partition} ..."
	umount $partition
	if [ $? -ne 0 ]; then
		errdie "failed to umount ${partition}"
	fi

done

# go

log 'Repartitioning...'

#
# Set up 3 partitions, then set their type.
# /dev/sdx3 is the bootloader partition and must be type A2 # We add a small FAT partition, as /dev/sdx1 then the rest is

# an ext2 partition.
#
fdisk $DEVICE << EOF
o
n
p
3
2048
+8M
n
p
1

+20M
n
p
2

t
1
4
t
2
83
t
3
a2
p
w
EOF

if [ $? -ne 0 ]; then
errdie "repartitioning failed"
fi

log 'Formatting...'

echo "Formatting FAT aprtition..."

mkfs.vfat ${DEVICE}1
if [ $? -ne 0 ]; then
errdie "formatting failed"
fi

echo "Formatting Linux partition ..."

mkfs.ext2 ${DEVICE}2
if [ $? -ne 0 ]; then
errdie "formatting failed"
fi

log 'Done'

exit 0
#end of script

#4 lore raw
Quoted 11 lines · Charles Manning
Quoted 9 lines · On Saturday 05 April 2014 09:47:02 Pavel Machek wrote:

Hi!

Quoted 3 lines

I'm trying to get custom preloader to work (on EBV Socrates)... I tried applying old patch from mail archives, but a) applying patch from mail archives is not fun and b) it did not seem to do the trick.

Just to make sure... right way to use the
socfpga-signed-preloader.bin is

Quoted 8 lines
Quoted 2 lines

dd if=socfpga-signed-preloader.bin of=/dev/mmcblk0p1 bs=64k seek=0 dd if=u-boot.img of=/dev/mmcblk0p1 bs=64K seek=4

Almost right.

It must be partition 3, which must be of type A2.

dd .....of=/dev/mmcblk0p3 ...

FYI: It's not strictly necessary that partition 3 is the raw partition of type A2. That's just a common practice or a previous default, but not the only valid setup. I'm aware of setups where the FAT partition was omitted, p1 is raw and p2 is Linux. These work equally fine.

virtually yours
Gerhard Sittig

Signature · 3 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de