Editing files on the target - FrankBau/meta-marsboard-bsp GitHub Wiki

When the target board is up and running, there are several possibilities to edit the files on the SD card:

  • text (terminal) based editors (available in nearly all images)
    • vi
    • nano
  • (available only in GUI based image)
    • GUI based editors of your choice
  • file transfer and editing on the build host

vi

You can start with very few commands:

vi myfile
  • use the i command to switch from default mode to insert mode.
  • then, use the keyboard keys to navigate around, insert text or delete text using the backspace key while in insert mode.
  • use the ESC key to switch back from insert mode to default mode. Especially:
  • use the key sequence ESC : w q to exit vi with saving your changes ("write quit")
  • or use the key sequence ESC : q ! to exit vi without saving your changes ("quit!")

Note: if the arrow keys don't work as expected in insert mode, use them in default mode only or fix that behaviour by using a search engine.

Use X11 copy (left mouse button drag) and paste (middle mouse button click) to copy larger portions of text between the target board and the build host when a X11 based build host like Ubuntu is used.

Search online for man vi and grab a good tutorial or cheat sheet.

In the early stages, make a copy of the file before editing or use the root file system in the build/tmp/work folder of the build host as a backup.

nano

Some people prefer GNU nano for whatsoever reason. Set the TERM variable correctly, before using nano. E.g. when connected via minicom you may set

export TERM=vt102

before editing, because vt102 is supported by minicom.