Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Switch - Software
Commits
9b8d0663
Commit
9b8d0663
authored
Jan 22, 2012
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
build/flash-wrs: new script
parent
2d13c3ca
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
+60
-0
flash-wrs
build/flash-wrs
+60
-0
No files found.
build/flash-wrs
0 → 100755
View file @
9b8d0663
#!/bin/sh
# A script to compile the usb loader, possibly changing the mac address
# Sanity checks
if
[
-d
./usb-loader
]
;
then
true
;
else
echo
"
$0
: Please run me from the top-level wr-switch-sw directory"
>
& 2
exit
1
fi
err
=
0
;
if
[
-f
./binaries/at91bootstrap.bin
]
;
then
true
;
else
err
=
1
;
fi
if
[
-f
./binaries/barebox.bin
]
;
then
true
;
else
err
=
1
;
fi
if
[
$err
-eq
1
]
;
then
echo
"
$0
: Can't find at91bootstrap or barebox binary"
>
& 2
exit
1
fi
# parse command line
DEV
=
"/dev/ttyACM0"
MAC
=
""
while
[
$#
-ge
1
]
;
do
case
$1
in
/
*
)
DEV
=
"
$1
"
;
shift
;;
*
:
*
)
MAC
=
"
$1
"
;
shift
;;
*
)
echo
"
$0
: Invalid argument
\"
$1
\"
"
>
&2
;
exit
1
;;
esac
done
# check mac address
if
[
"x
$MAC
"
!=
"x"
]
;
then
X
=
"[0-9a-fA-F][0-9a-fA-F]"
if
echo
$MAC
|
grep
"^
${
X
}
:
${
X
}
:
${
X
}
:
${
X
}
:
${
X
}
:
${
X
}
\$
"
>
/dev/null
;
then
true
else
echo
"
$0
: Invalid MAC address
\"
$MAC
\"
"
>
&2
;
exit
1
;
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)
T
=
$(
mktemp
/tmp/wrs-flash.XXXXXX
)
cat
binaries/at91bootstrap.bin /dev/zero |
dd
bs
=
1
count
=
33792
>
$T
\
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...)
(
cd
usb-loader
&&
./mch_flasher
$T
$DEV
)
#rm -f $T
\ No newline at end of file
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