Difference between revisions of "User:SamuelM"

From ArmadeusWiki
Jump to: navigation, search
m (A colored (and useful) prompt)
(tips: fix prompt, add my u-boot config)
Line 64: Line 64:
 
== Tips ==
 
== Tips ==
 
=== A colored (and useful) prompt ===
 
=== A colored (and useful) prompt ===
 +
''zsh and [http://www.ctaf.free.fr/dokuwiki/doku.php?id=ctafconf ctafconf] users won't be lost'' ;-)
 
<source lang="bash">
 
<source lang="bash">
 
##
 
##
Line 69: Line 70:
 
##
 
##
 
source /etc/profile
 
source /etc/profile
 
bldblk='\033[1;30m' # Black - Bold
 
bldred='\033[1;31m' # Red
 
bldgrn='\033[1;32m' # Green
 
bldylw='\033[1;33m' # Yellow
 
bldblu='\033[1;34m' # Blue
 
bldpur='\033[1;35m' # Purple
 
bldcyn='\033[1;36m' # Cyan
 
bldwht='\033[1;37m' # White
 
txtrst='\033[0m'    # Text Reset
 
  
 +
## Enhanced promt
 +
if [ -t 0 ]; then
 +
  bldblk='\033[1;30m' # Black - Bold
 +
  bldred='\033[1;31m' # Red
 +
  bldgrn='\033[1;32m' # Green
 +
  bldylw='\033[1;33m' # Yellow
 +
  bldblu='\033[1;34m' # Blue
 +
  bldpur='\033[1;35m' # Purple
 +
  bldcyn='\033[1;36m' # Cyan
 +
  bldwht='\033[1;37m' # White
 +
  txtrst='\033[0m'    # Text Reset
 +
  undred='\033[4;31m' # Red - Underlined
 +
  bgdred='\033[1;41m' # Red - Background
 +
  bgdblu='\033[1;44m' # Blue - Background
 +
fi;
 +
if [ $(id -u) -eq 0 ]; then
 +
  userbgd="${bgdred}"
 +
else
 +
  userbgd="${bgdblu}"
 +
fi
  
export PS1="${txtrst}\u${bldylw}@${bldgrn}\h ${bldpur}[\$(eval \"res=\$?\"; [ \${res} -eq 0 ] && echo -en \"\${bldwht}\${res}\" || echo -en \"\${bldred}err \${res}\")${bldpur}] [${bldblu}\w${bldpur}] ${txtrst}\n\${SHELL:5}${bldgrn}\$${txtrst} "
+
export PS1="${userbgd}\u${bldylw}@${bldgrn}\h${txtrst} ${bldpur}[\$(eval \"res=\$?\"; [ \${res}$
 
</source>
 
</source>
 +
 +
=== u-boot configuration ===
 +
 +
# ''nfs-boot'' (kernel and rootfs), if the nfs server is alive
 +
# ''boot from the NAND flash'', otherwise
 +
 +
==== u-boot environment ====
 +
 +
<pre class="apf">
 +
BIOS> setenv nfsboot 'setenv bootargs ${console} ${mtdparts}; \
 +
run addnfsargs addipargs; \
 +
setenv autostart yes; \
 +
nfs ${loadaddr} {serverip}:${rootpath}/${board_name}-linux.bin; \
 +
bootm'
 +
BIOS> setenv addnfsargs 'setenv bootargs ${bootargs} root=/dev/nfs rw nfsroot=${serverip}:${rootpath}'
 +
BIOS> setenv addipargs 'setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off'
 +
BIOS> setenv bootcmd 'if ping ${serverip}; then \
 +
  echo; \
 +
  echo Boot over NFS; \
 +
  echo; \
 +
  run nfsboot; \
 +
else \
 +
  echo; \
 +
  echo Boot from the board;  \
 +
  run jffsboot; \
 +
fi'
 +
BIOS> setenv board_name apf27
 +
BIOS> setenv netmask 255.255.255.0
 +
BIOS> setenv serverip 192.168.10.2
 +
BIOS> setenv gatewayip 192.168.10.1
 +
BIOS> setenv ipaddr 192.168.10.10
 +
BIOS> setenv rootpath /path/to/where/you/untar/your/rootfs
 +
BIOS> saveenv
 +
BIOS> boot
 +
</pre>
 +
 +
Adjust the <tt>bootdelay</tt> if needed.
 +
 +
Next boot will automatically try to boot over NFS, then fallback on the NAND flash
 +
 +
{{Warning|
 +
 +
If the '''NFS server is alive''', but neither the '''linux kernel image nor the rootfs'''
 +
are '''NOT at the expected location''' (<tt>/path/to/where/you/untar/your/rootfs</tt>),
 +
 +
the boot will hang up, '''booting will fail''' !}}
 +
 +
==== NFS server configuration ====
 +
 +
Refer to the [[Network File System configuration|NFS wiki page]] to setting the NFS server up.
 +
 +
Then:
 +
 +
* untar the rootfs tarball in <tt>/path/to/where/you/untar/your/rootfs</tt>
 +
* copy the linux kernel image to <tt>/path/to/where/you/untar/your/rootfs</tt>
 +
 +
<pre class="host">
 +
sudo tar xvf apf27-rootfs.tar -C /path/to/where/you/untar/your/rootfs
 +
sudo -fv cp apf27-linux.bin /path/to/where/you/untar/your/rootfs
 +
</pre>

Revision as of 11:23, 24 July 2011

<< Member list

<< User list

whoami

  • Name:
Samuel MARTIN
  • Background:
Student at ESEO (French engineering school), specialised in Embedded systeme and Automation /
Master student at l'University of Plymouth (UK), in Robotics.
Embedded and System Engineer (Paris, France)

Interests

  • Robotics
  • Computer Vision
  • Image & signal processing
  • Linux

Objectives

or, what I wanna do with the APF board (APF27 + Devfull)

  • Have fun!
  • Improve my skills in:
    • Hardware development (FPGA)
    • System and embedded OS
    • Electronic development
    • Software development for embedded (tiny) target
  • Share my experiments

Contributions

Cross-compile OpenCV for your APF

CMake

Tips

A colored (and useful) prompt

zsh and ctafconf users won't be lost ;-)

##
## ~/.profile
##
source /etc/profile

## Enhanced promt
if [ -t 0 ]; then
  bldblk='\033[1;30m' # Black - Bold
  bldred='\033[1;31m' # Red
  bldgrn='\033[1;32m' # Green
  bldylw='\033[1;33m' # Yellow
  bldblu='\033[1;34m' # Blue
  bldpur='\033[1;35m' # Purple
  bldcyn='\033[1;36m' # Cyan
  bldwht='\033[1;37m' # White
  txtrst='\033[0m'    # Text Reset
  undred='\033[4;31m' # Red - Underlined
  bgdred='\033[1;41m' # Red - Background
  bgdblu='\033[1;44m' # Blue - Background
fi;
if [ $(id -u) -eq 0 ]; then
  userbgd="${bgdred}"
else
  userbgd="${bgdblu}"
fi

export PS1="${userbgd}\u${bldylw}@${bldgrn}\h${txtrst} ${bldpur}[\$(eval \"res=\$?\"; [ \${res}$

u-boot configuration

  1. nfs-boot (kernel and rootfs), if the nfs server is alive
  2. boot from the NAND flash, otherwise

u-boot environment

BIOS> setenv nfsboot 'setenv bootargs ${console} ${mtdparts}; \
 run addnfsargs addipargs; \
 setenv autostart yes; \
 nfs ${loadaddr} {serverip}:${rootpath}/${board_name}-linux.bin; \
 bootm'
BIOS> setenv addnfsargs 'setenv bootargs ${bootargs} root=/dev/nfs rw nfsroot=${serverip}:${rootpath}'
BIOS> setenv addipargs 'setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off'
BIOS> setenv bootcmd 'if ping ${serverip}; then \
  echo; \
  echo Boot over NFS; \
  echo; \
  run nfsboot; \
 else \
  echo; \
  echo Boot from the board;  \
  run jffsboot; \
 fi'
BIOS> setenv board_name apf27
BIOS> setenv netmask 255.255.255.0
BIOS> setenv serverip 192.168.10.2
BIOS> setenv gatewayip 192.168.10.1
BIOS> setenv ipaddr 192.168.10.10
BIOS> setenv rootpath /path/to/where/you/untar/your/rootfs
BIOS> saveenv
BIOS> boot

Adjust the bootdelay if needed.

Next boot will automatically try to boot over NFS, then fallback on the NAND flash

Warning Warning:

If the NFS server is alive, but neither the linux kernel image nor the rootfs are NOT at the expected location (/path/to/where/you/untar/your/rootfs),

the boot will hang up, booting will fail !


NFS server configuration

Refer to the NFS wiki page to setting the NFS server up.

Then:

  • untar the rootfs tarball in /path/to/where/you/untar/your/rootfs
  • copy the linux kernel image to /path/to/where/you/untar/your/rootfs
sudo tar xvf apf27-rootfs.tar -C /path/to/where/you/untar/your/rootfs
sudo -fv cp apf27-linux.bin /path/to/where/you/untar/your/rootfs