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
0758ffc7
Commit
0758ffc7
authored
Mar 21, 2012
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc: document programming to NAND
parent
b61c70e2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
126 additions
and
0 deletions
+126
-0
wrs-build.in
doc/wrs-build.in
+126
-0
No files found.
doc/wrs-build.in
View file @
0758ffc7
...
@@ -957,6 +957,11 @@ Actually, I'm currently using the stanza shown above to boot my
...
@@ -957,6 +957,11 @@ Actually, I'm currently using the stanza shown above to boot my
switch
over
the
network
with
no
interaction
at
all
,
while
being
able
switch
over
the
network
with
no
interaction
at
all
,
while
being
able
to
change
the
boot
procedure
on
the
server
while
the
switch
is
off
.
to
change
the
boot
procedure
on
the
server
while
the
switch
is
off
.
To
have
a
self
-
hosting
switch
,
you
should
copy
your
filesystem
to
NAND
flash
.
See
@
ref
{
Installing
the
filesystem
to
NAND
},
for
a
quick
primer
(
the
production
procedure
is
not
finalized
at
this
point
).
@
c
##########################################################################
@
c
##########################################################################
@
node
Code
layout
in
a
production
switch
@
node
Code
layout
in
a
production
switch
@
chapter
Code
layout
in
a
production
switch
@
chapter
Code
layout
in
a
production
switch
...
@@ -1023,6 +1028,127 @@ Later releases of this document will include the complete recovery
...
@@ -1023,6 +1028,127 @@ Later releases of this document will include the complete recovery
procedures, as well as building rules for the production versions of
procedures, as well as building rules for the production versions of
@i{at91boot} and @i{barebox}.
@i{at91boot} and @i{barebox}.
@menu
* Installing the filesystem to NAND::
@end menu
@c ==========================================================================
@node Installing the filesystem to NAND
@section Installing the filesystem to NAND
This is an initial procedure to install the filesystem to NAND memory
and set up a self-hosted switch to keep in your pocket for
demonstration purposes. Pleae note this is not the production release,
as some shortcuts have been taken.
After a successful NFS-Root boot, you'
ll
notice
the
system
identified
two
flash
devices
,
for
a
total
of
3
partitions
.
Note
however
that
NAND
memory
may
have
bad
blocks
:
@
example
#
dmesg
|
grep
-
i
mtd
Creating
2
MTD
partitions
on
"atmel_nand"
:
mtd_dataflash
spi0
.0
:
AT45DB642x
(
8448
KBytes
)
pagesize
1056
bytes
(
OTP
)
#
cat
/
proc
/
mtd
dev
:
size
erasesize
name
mtd0
:
04000000
00020000
"Partition 1"
mtd1
:
1
c000000
00020000
"Partition 2"
mtd2
:
00840000
00000420
"spi0.0-AT45DB642x"
#
dmesg
|
grep
-
i
bad
Scanning
device
for
bad
blocks
Bad
eraseblock
2
at
0x000000040000
Bad
eraseblock
914
at
0x000007240000
Bad
eraseblock
2649
at
0x000014b20000
Bad
eraseblock
2944
at
0x000017000000
@
end
example
To
set
up
a
boot
procedure
that
doesn
't depend on the network,
we need to choose where the place the kernel and filesystem. To
avoid repartitioning the NAND memory let'
s
use
the
two
partitions
we
have
:
mtd0
to
fit
the
kernel
and
mtd1
for
the
filesystem
.
Please
note
that
the
environment
of
@
i
{
barebox
}
is
stored
in
NAND
memory
from
256
k
to
512
k
.
The
size
is
so
big
because
@
i
{
barebox
}
will
skip
badblocks
within
that
are
.
The
suggested
setup
,
thus
,
is
the
following
:
@
example
0x0000.0000
-
0x0004.0000
Empty
(
space
for
a
barebox
)
0x0004.0000
-
0x0008.0000
Barebox
environment
0x0008.0000
-
0x0010.0000
Empty
(
up
to
1
MB
)
0x0010.0000
-
0x0090.0000
Kernel
(
plenty
of
space
)
0x0090.0000
-
0x0400.0000
Empty
(
up
to
the
end
of
/
dev
/
mtd0
)
0x0400.0000
-
0x2000.0000
Filesystem
space
,
jffs2
@
end
example
With
this
in
mind
,
the
installation
procedure
is
as
follow
:
@
table
@
i
@
item
Erase
the
filesystem
partion
if
needed
@
code
{
flash_eraseall
-
j
/
dev
/
mtd1
}
@
item
Mount
as
@
i
{
jffs2
}
@
code
{
mount
-
t
jffs2
/
dev
/
mtdblock1
/
mnt
}
@
item
Copy
your
filesystem
data
,
possibly
from
the
cpio
archive
@
code
{
cd
/
mnt
;
zcat
/
tmp2
/
wrs
-
image
.
cpio
.
gz
|
cpio
--
extract
}
Here
,
you
may
want
to
copy
the
current
NFS
-
Root
filesystem
,
but
the
@
i
{
cp
}
command
we
have
on
the
target
lacks
the
@
code
{-
x
}
(@
code
{--
one
-
file
-
system
})
option
.
@
item
Umount
the
filesystem
@
code
{
cd
/;
umount
/
mnt
}
@
item
Erase
space
for
the
kernel
@
code
{
flash_erase
/
dev
/
mtd0
0x100000
0x40
}
Note
that
the
offset
is
in
bytes
(
1
MB
)
and
the
lenght
is
in
number
of
blocks
(
each
block
is
128
kB
@
item
Copy
the
kernel
to
nand
@
code
{
cat
/
path
/
to
/
zImage
/
dev
/
zero
|
cat
|
dd
bs
=
1
k
count
=
2048
>
/
tmp
/
k
}
@
code
{
dd
if
=/
tmp
/
k
bs
=
128
k
of
=/
dev
/
mtd0
seek
=
8
}
The
former
command
is
needed
to
pad
the
kernel
to
a
multiple
of
128
kB
,
as
the
flash
has
128
k
-
sized
blocks
.
The
size
here
is
2
MB
,
which
is
more
than
enough
for
our
current
kernel
.
The
latter
command
copies
to
@
code
{/
dev
/
mtd0
}
as
offset
1
MB
.
@
end
table
The
following
repeats
the
commands
in
a
format
that
is
simpler
to
cut
and
paste
to
your
serial
port
:
@
smallexample
flash_eraseall
-
j
/
dev
/
mtd1
mount
-
t
jffs2
/
dev
/
mtdblock1
/
mnt
cd
/
mnt
;
zcat
/
tmp2
/
wrs
-
image
.
cpio
.
gz
|
cpio
--
extract
cd
/;
umount
/
mnt
flash_erase
/
dev
/
mtd0
0x100000
0x40
cat
/
path
/
to
/
zImage
/
dev
/
zero
|
cat
|
dd
bs
=
1
k
count
=
2048
>
/
tmp
/
k
dd
if
=/
tmp
/
k
bs
=
128
k
of
=/
dev
/
mtd0
seek
=
8
@
end
smallexample
Now
,
we
need
to
go
to
@
i
{
barebox
}
and
change
the
default
boot
command
.
To
do
it
,
you
need
to
call
@
code
{
edit
/
env
/
config
}
and
later
@
code
{
saveenv
}.
The
internal
editor
of
@
i
{
barebox
}
is
pretty
basic
,
but
it
use
the
arrow
keys
(
it
is
not
like
@
i
{
vi
},
for
your
pleasure
but
not
for
mine
).
To
save
and
exit
use
@
i
{
ctrl
-
D
}.
@
c
##########################################################################
@
c
##########################################################################
@
node
Troubleshooting
@
node
Troubleshooting
@
chapter
Troubleshooting
@
chapter
Troubleshooting
...
...
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