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
553d6a91
Commit
553d6a91
authored
Aug 07, 2012
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc: wrboot part is filled
parent
727fd046
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
138 deletions
+30
-138
wrs-build.in
doc/wrs-build.in
+30
-138
No files found.
doc/wrs-build.in
View file @
553d6a91
...
...
@@ -702,7 +702,10 @@ The individual menu items perform the following actions:
This
fires
the
editor
on
the
configuration
file
,
and
saves
it
to
flash
when
the
user
is
done
.
This
is
useful
to
change
the
MAC
address
of
the
ARM
network
port
.
change
the
MAC
address
of
the
ARM
network
port
.
Please
note
that
saving
save
the
whole
@
file
{/
env
}
file
tree
,
so
you
can
also
change
the
init
scripts
interactively
and
have
them
stored
persistently
on
the
flash
.
@
item
4
:
exit
to
shell
...
...
@@ -724,153 +727,42 @@ The individual menu items perform the following actions:
@node Using wrboot
@section Using wrboot
If you use the @i{wrboot} script option, you can for example run
an NFS-Root system using a script similar to the one included
in the @file{binaries} directory of this package. Even though
the directory is called @file{binaries} the file
is ASCII anyways).
@c FIXME: wrboot ``binary''
dhcpd: DHCPOFFER on 192.168.16.224 to 02:0b:ad:c0:ff:ee via eth0
atftpd[5623]: Serving wrboot-02:0B:AD:C0:FF:EE to 192.168.16.224:1029
atftpd[5623]: Serving 192.168.16.224/wrboot to 192.168.16.224:1030
atftpd[5623]: Serving wrboot to 192.168.16.224:1031
an NFS-Root system or do whatever customization and testing you want.
The provided procedure tries to load the script from TFTP under three
different names, from most specific to most generic, and the first
match will be used. The first name is MAC-address-based, the
second is IP-address-based and the third is just @file{wrboot}.
The boot loader tries to download three files, in this order:
``@code{wrboot-MA:CA:DD:RR:EE:SS}'',
``@code{192.168.from.dhcp/wrboot}'', ``@code{wrboot}''. If no such
file is found, the menu is re-entered.
This is for example what I see in my logs when only providing @file{wrboot}:
@smallexample
dhcpd: DHCPOFFER on 192.168.16.224 to 02:0b:ad:c0:ff:ee via eth0
atftpd[5623]: Serving wrboot-02:0B:AD:C0:FF:EE to 192.168.16.224:1029
atftpd[5623]: Serving 192.168.16.224/wrboot to 192.168.16.224:1030
atftpd[5623]: Serving wrboot to 192.168.16.224:1031
mountd[21014]: NFS mount of /tftpboot/192.168.16.9 attempted from 192.168.16.9
@end smallexample
Assuming you have a known-working NFS-Root installation, in the
usual directory of your server,
standard a TFTP
server and you don'
t
use
the
DHCP
server
;
you
can
write
a
@
file
{
wrboot
}
script
to
boot
the
Linux
kernel
loaded
with
TFTP
and
the
file
system
on
NFS
.
Following
an
example
of
a
@
file
{
wrboot
}
script
used
too
boot
from
NFS
.
@
example
eth0
.
ipaddr
=
192.168.16.9
eth0
.
serverip
=
192.168.16.1
addpart
/
dev
/
mem
0x400000
@@
0x71000000
(
kernel
)
tftp
zImage
/
dev
/
mem
.
kernel
bootargs
=
"$bootargs mem=64m root=nfs nfsroot=/opt/root/wrs,tcp "
bootargs
=
"$bootargs ip=192.168.16.9:192.168.16.1:255.255.255.0"
bootz
/
dev
/
mem
.
kernel
@
end
example
As
described
above
,
by
using
the
@
i
{
boot
from
script
}
option
,
barebox
automatically
load
your
@
file
{
wrboot
}
script
@
footnote
{
See
@
ref
{
Booting
with
Barebox
}
to
know
where
place
your
@
file
{
wrboot
}}.
@
c
FIXME
:
remove
this
one
@
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
.
We chose to place the IP-address-based name in a subdirectory because
this is the default place where the NFS-Root filesystem is mounted
from, as shown in the log excerpt above. So you'
ll
have
your
@
file
{
wrboot
}
in
the
same
place
The
suggested
setup
,
thus
,
is
the
following
:
The
@
file
{
binaries
}
subdirectory
of
this
package
includes
two
known
-
working
wrboot
scripts
as
examples
;
one
if
for
use
with
static
IP
addresses
and
the
other
relies
on
DHCP
.
If
you
want
to
override
the
default
NFS
-
Root
directory
mounted
from
the
server
(
which
is
@
code
{/
tftpboot
/<
ip
-
address
>})
you
can
add
something
like
the
following
line
to
your
@
file
{
wrboot
}
script
:
@
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
bootargs
=
"$bootargs nfsroot=/opt/root/wrs-3"
@
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
}.
IF
you
use
static
IP
addresses
,
please
note
that
you
should
fix
@
file
{/
etc
/
init
.
d
/
S40network
}
in
the
filesystem
for
your
switch
,
so
it
doesn
't run the DHCP client.
@c ##########################################################################
@node The Individual Build Steps
...
...
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