Messing up the SD card is part of the game when playing with the Embedded Linux board from Elektor.
Elektor's official way of restoring the image to the SD card is by use of the Ubuntu system you are meant to work on when following the tutorial.
you can find the SD image file zipped at the Elektor website
as explained in the README file within the zip archive, to transfer the gnublin.img to the SD card, you have to issue the following command from Ubuntu:
sudo dd if=PATH_TO_SD_CARD_IMG_FILE of=/dev/SD_CARD_ID
for me it was:
sudo dd if=gnublin.img of=/dev/sdb (note it is sdb not sdb1 or sdb2, the image is for the whole card to but written bit by bit)
My Ubuntu is a VM, I use Oracle Virtual Box and there is no problem connecting the SD card reader to it. I have noticed though that it takes a really, really, really long time before the image is transferred to the card.
dd if=gnublin.img of=/dev/sdb
3854336+0 records in
3854336+0 records out
1973420032 bytes (2.0 GB) copied, 4999.44 s, 395 kB/s
this is 1.38 hours!!! I admit there is something quite wrong here which I mean to investigate further. It would seem that all of the three USB 2 SD card readers are seen as USB 1.1 by the VM.
In the meantime though if you want to do this very quickly you can use the same tool that it is used with the Raspberry Pi images. You can easily find it at the official site or here. (Note: remember to run the tools with administrative right otherwise it might not be able to write on your card)
It is slightly cheating on the "Linux purism" that Elektor tries to impose but ...
Saturday, June 22
Wednesday, June 5
File transfer between a PC and an embedded system over the serial port
I was playing with the Elektor Linux board and needed to tranfer code compiled on a "host" system to the SD card of the embedded Linux board. Following the tutorial off the magazine I read:
"To test whether the above process has been successful, we can copy
the file ‘hello’ that the compiler has created to the Elektor Linux
board’s SD card. Make sure the board is off and remove the card.
Insert it into the PC’s card reader, and plug the reader into the PC."
I did not have a card reader with me and I did not like to halt the system, remove the card, etc. etc.
Back in the days of modems it was not unusual to transfer files over the serial ports.
This is what you need to do in order to transfer your files between your Linux PC and your Linux embedded system using the serial port.
Picocom can transfer files using several protocols that, whomever used to use modems, will be familiar with.
Specifically you can use ZModmem which is the best choice compared to XModem and YModem.
Enough with the yada yada, let's cut to the chase.
Let's say that you are either using Ubuntu or Mint for what matters.
You will need to install rz and sz. Check here for more.
apt-get install lrzsz
Your serial port is ttyUSB0.
Run: picocom -b 115200 /dev/ttyUSB0
Note the output especially:
send_cmd is : sz -vv
receive_cmd is : rz -vv
This means that your board can talk ZModem!
Hit ^a (ctrl+a) then ^s (ctrl+s). Read the man page for picocom to know more.
This will set picocom in file transfer mode. You will be prompted for a file name as follows:
*** file:
Write the full path of the file e.g. /root/hello (being the compiled version of hello.c)
Sure enough your next ls command should show the file now on your Elektor Linux board.
"To test whether the above process has been successful, we can copy
the file ‘hello’ that the compiler has created to the Elektor Linux
board’s SD card. Make sure the board is off and remove the card.
Insert it into the PC’s card reader, and plug the reader into the PC."
I did not have a card reader with me and I did not like to halt the system, remove the card, etc. etc.
Back in the days of modems it was not unusual to transfer files over the serial ports.
This is what you need to do in order to transfer your files between your Linux PC and your Linux embedded system using the serial port.
Picocom can transfer files using several protocols that, whomever used to use modems, will be familiar with.
Specifically you can use ZModmem which is the best choice compared to XModem and YModem.
Enough with the yada yada, let's cut to the chase.
Let's say that you are either using Ubuntu or Mint for what matters.
You will need to install rz and sz. Check here for more.
apt-get install lrzsz
Your serial port is ttyUSB0.
Run: picocom -b 115200 /dev/ttyUSB0
Note the output especially:
send_cmd is : sz -vv
receive_cmd is : rz -vv
This means that your board can talk ZModem!
Hit ^a (ctrl+a) then ^s (ctrl+s). Read the man page for picocom to know more.
This will set picocom in file transfer mode. You will be prompted for a file name as follows:
*** file:
Write the full path of the file e.g. /root/hello (being the compiled version of hello.c)
Sure enough your next ls command should show the file now on your Elektor Linux board.
Subscribe to:
Posts (Atom)