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
1727ecbc
Commit
1727ecbc
authored
Oct 17, 2012
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flash-wrs: prepare filesystem for NAND flashing and use WRS_BASE_DIR
Signed-off-by:
Federico Vaga
<
federico.vaga@gmail.com
>
parent
ff4e8459
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
10 deletions
+55
-10
flash-wrs
build/flash-wrs
+45
-10
S99flash-from-kernel.sh
usb-loader/S99flash-from-kernel.sh
+10
-0
No files found.
build/flash-wrs
View file @
1727ecbc
...
...
@@ -79,16 +79,17 @@ modifyMAC()
}
# Go to the top directory
topdir
=
$(
dirname
$0
)
/..
dir
=
$(
dirname
$0
)
/..
WRS_BASE_DIR
=
$(
cd
$dir
&&
/bin/pwd
)
# Sanity checks
if
[
-d
${
topdir
}
/usb-loader
]
;
then
true
;
else
if
[
-d
${
WRS_BASE_DIR
}
/usb-loader
]
;
then
true
;
else
echo
"
$0
: usb-loader is not found"
>
& 2
exit
1
fi
# build flasher itself
if
CC
=
cc make
-s
-C
${
topdir
}
/usb-loader
;
then
true
;
else
if
CC
=
cc make
-s
-C
${
WRS_BASE_DIR
}
/usb-loader
;
then
true
;
else
echo
"
$0
: Error compiling usb-loader"
>
&2
;
exit
1
;
fi
...
...
@@ -104,8 +105,8 @@ MAC2=$MAC2_DEF
DEV
=
""
FLAGS
=
""
at91bs
=
"
${
topdir
}
/binaries/at91bootstrap.bin"
barebox
=
"
${
topdir
}
/binaries/barebox.bin"
at91bs
=
"
${
WRS_BASE_DIR
}
/binaries/at91bootstrap.bin"
barebox
=
"
${
WRS_BASE_DIR
}
/binaries/barebox.bin"
kernel
=
"
${
WRS_OUTPUT_DIR
}
/images/zImage"
rootfs
=
"
${
WRS_OUTPUT_DIR
}
/images/wrs-image.jffs2.img"
...
...
@@ -116,6 +117,7 @@ while [ $# -ge 1 ]; do
barebox
=
${
WRS_OUTPUT_DIR
}
/images/barebox.bin
kernel
=
${
WRS_OUTPUT_DIR
}
/images/zImage
rootfs
=
${
WRS_OUTPUT_DIR
}
/images/wrs-image.jffs2.img
rootfscpio
=
${
WRS_OUTPUT_DIR
}
/images/wrs-image.cpio.gz
shift
;;
*
.tar.gz
)
...
...
@@ -125,6 +127,7 @@ while [ $# -ge 1 ]; do
barebox
=
/tmp/barebox.bin
kernel
=
/tmp/zImage
rootfs
=
/tmp/wrs-image.jffs2.img
rootfscpio
=
${
WRS_OUTPUT_DIR
}
/images/wrs-image.cpio.gz
shift
;;
-h
|
--help
)
showhelp
;
shift
;;
...
...
@@ -219,23 +222,55 @@ modifyMAC ${barebox} ${Tbarebox}
## Flashing DataFlash
if
[
$df
]
;
then
checkExit
$at91bs
${
topdir
}
/usb-loader/mch_flasher
-m
df
$FLAGS
$DEV
${
at91bs
}
0
${
Tbarebox
}
33792
${
WRS_BASE_DIR
}
/usb-loader/mch_flasher
-m
df
$FLAGS
$DEV
${
at91bs
}
0
${
Tbarebox
}
33792
fi
## Prepare for the NAND flashing procedure
if
[
$nf
]
;
then
checkExit
$kernel
checkExit
$rootfs
${
topdir
}
/usb-loader/mch_flasher
-m
ddr
$FLAGS
$DEV
${
Tbarebox
}
0x0
${
kernel
}
0x1000000
${
rootfs
}
0x2000000
checkExit
$rootfscpio
TMPFS
=
$(
mktemp
-d
/tmp/wrsfs.XXXXXX
)
TMPCPIO
=
$(
mktemp
/tmp/wrsflash-cpio.XXXXXX.cpio.gz
)
TMPSCRIPT
=
$(
mktemp
/tmp/wrsrootfs-script.XXXXXX
)
cat
>
$TMPSCRIPT
<<
EOF
cd
$TMPFS
zcat
$rootfscpio
| cpio --extract
mkdir flashing
# Remove heavy and useless stuff to make a light file system to
# load in RAM
rm -rf
$TMPFS
/etc/init.d/S*
rm -rf
$TMPFS
/wr
rm -rf
$TMPFS
/usr/bin
rm -rf
$TMPFS
/usr/lib
rm -rf
$TMPFS
/usr/share
cp
${
rootfs
}
$TMPFS
/flashing/wrs-image.jffs2.img
cp
${
kernel
}
$TMPFS
/flashing/zImage
cp
${
WRS_BASE_DIR
}
/usb-loader/S99flash-from-kernel.sh
$TMPFS
/etc/init.d/
cd ..
(cd "
$TMPFS
" && find . | cpio -o -H newc | gzip) >
$TMPCPIO
EOF
fakeroot bash
$TMPSCRIPT
TMPSTRFILE
=
$(
mktemp
/tmp/natale.XXXXXX
)
echo
-e
"
\x
BA
\x
BB
\x
00
\x
BA
\x
BB
\x
00"
>
$TMPSTRFILE
${
WRS_BASE_DIR
}
/usb-loader/mch_flasher
-m
ddr
$FLAGS
$DEV
${
Tbarebox
}
0x0
${
kernel
}
0x1000000
${
TMPCPIO
}
0x2000000
rm
-rf
$TMPFS
rm
-rf
$TMPCPIO
rm
-rf
$TMPSCRIPT
rm
-rf
$TMPSTRFILE
fi
## Loading in DDR
if
[
$test
]
;
then
checkExit
$kernel
checkExit
$rootfs
${
topdir
}
/usb-loader/mch_flasher
-m
ddr
$FLAGS
$DEV
${
Tbarebox
}
0x0
${
kernel
}
0x1000000
${
rootfs
}
0x2000000
${
WRS_BASE_DIR
}
/usb-loader/mch_flasher
-m
ddr
$FLAGS
$DEV
${
Tbarebox
}
0x0
${
kernel
}
0x1000000
${
rootfs
}
0x2000000
fi
rm
$Tbarebox
echo
-e
"
\n\n
Done
\n
"
usb-loader/S99flash-from-kernel.sh
0 → 100644
View file @
1727ecbc
#!/bin/bash
# Write kernel and filesystem to NAND memory
echo
"FLASHING: flashing kernel to /dev/mtd0 ..."
nandwrite
-m
-p
-a
/dev/mtd0 /flashing/zImage
echo
"FLASHING: flashing file system to /dev/mtd1 ..."
nandwrite
-m
-p
-a
/dev/mtd1 /flashing/wrs-image.jffs2.img
echo
"FLASHING: complete!"
# Reboot immediatly because we have completed the flashing procedure
reboot
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