Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
wr-switch-sw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
white-rabbit
wr-switch-sw
Commits
85396212
Commit
85396212
authored
May 15, 2012
by
Benoit Rat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firmwares: correct bad flashing of barebox & add options of usb-loader
parent
a69b92b7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
18 deletions
+19
-18
flash-wrs
build/flash-wrs
+19
-18
No files found.
build/flash-wrs
View file @
85396212
...
@@ -26,43 +26,44 @@ if [ $err -eq 1 ]; then
...
@@ -26,43 +26,44 @@ if [ $err -eq 1 ]; then
fi
fi
# parse command line
# parse command line
DEV
=
"/dev/ttyACM0"
MAC
=
""
MAC
=
""
DEV
=
""
FLAGS
=
""
while
[
$#
-ge
1
]
;
do
while
[
$#
-ge
1
]
;
do
case
$1
in
case
$1
in
/
*
)
DEV
=
"
$1
"
;
shift
;;
--help
|
-h
)
echo
"Usage :
\t
$0
[options] MAC
\n
Options:
\t
same as mch_flasher
\n\n
"
;
echo
">
\$
usb-loader/mch_flasher -h"
;
usb-loader/mch_flasher
-h
;
exit
0
;;
/
*
)
DEV
=
"-s
$1
"
;
shift
;;
*
:
*
)
MAC
=
"
$1
"
;
shift
;;
*
:
*
)
MAC
=
"
$1
"
;
shift
;;
-
*
)
FLAGS
=
"
${
FLAGS
}
$1
"
;
shift
;;
*
)
echo
"
$0
: Invalid argument
\"
$1
\"
"
>
&2
;
exit
1
;;
*
)
echo
"
$0
: Invalid argument
\"
$1
\"
"
>
&2
;
exit
1
;;
esac
esac
done
done
# check mac address
# build flasher itself
if
CC
=
cc make
-s
-C
usb-loader
;
then
true
;
else
echo
"
$0
: Error compiling usb-loader"
>
&2
;
exit
1
;
fi
# check & change mac address
if
[
"x
$MAC
"
!=
"x"
]
;
then
if
[
"x
$MAC
"
!=
"x"
]
;
then
X
=
"[0-9a-fA-F][0-9a-fA-F]"
X
=
"[0-9a-fA-F][0-9a-fA-F]"
if
echo
$MAC
|
grep
"^
${
X
}
:
${
X
}
:
${
X
}
:
${
X
}
:
${
X
}
:
${
X
}
\$
"
>
/dev/null
;
then
if
echo
$MAC
|
grep
"^
${
X
}
:
${
X
}
:
${
X
}
:
${
X
}
:
${
X
}
:
${
X
}
\$
"
>
/dev/null
;
then
true
sed
-i
"s/02:0B:AD:C0:FF:EE/
$MAC
/"
$T
echo
"MAC is now:
$MAC
"
else
else
echo
"
$0
: Invalid MAC address
\"
$MAC
\"
"
>
&2
;
exit
1
;
echo
"
$0
: Invalid MAC address
\"
$MAC
\"
"
>
&2
;
exit
1
;
fi
fi
fi
fi
# build flasher itself
if
CC
=
cc make
-s
-C
usb-loader
;
then
true
;
else
echo
"
$0
: Error compiling usb-loader"
>
&2
;
exit
1
;
fi
# cat binaries to temp file. Increase size of at91boot (0x8400)
# cat binaries to temp file. Increase size of at91boot (0x8400)
T
=
$(
mktemp
/tmp/wrs-flash.XXXXXX
)
T
=
$(
mktemp
/tmp/wrs-flash.XXXXXX
)
cat
binaries/at91bootstrap.bin /dev/zero |
dd
bs
=
1
count
=
33792
>
$T
\
cp
./binaries/at91bootstrap.bin
$T
2> /dev/null
dd
if
=
./binaries/barebox.bin
of
=
$T
conv
=
notrunc
bs
=
1
seek
=
33792 2> /dev/null
cat
binaries/barebox.bin
>>
$T
# change the mac address if so requested
if
[
"
$MAC
"
!=
"x
$MAC
"
]
;
then
sed
-i
"s/02:0B:AD:C0:FF:EE/
$MAC
/"
$T
fi
# flash it (msc...)
# flash it (msc...)
(
cd
usb-loader
&&
./mch_flasher
$
T
$DEV
)
(
cd
usb-loader
&&
./mch_flasher
$
FLAGS
$DEV
$T
)
#rm -f $T
#rm -f $T
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment