I have a problem. My system is an embedded Linux plaform. I am connecting to my board using serial port and I can access U-Boot.
I need to extract the complete firmware residing in flash through the console or through Ethernet. It looks like downloading is easy using TFTP or serial (Kermit, etc), but uploading it to the host PC for backup isn't obvious.
Does anyone know how this can be done?
Assuming that you are using NAND flash and U-Boot 2013.07 or similar:
Use the nand info command to see the NAND device names, sizes and erase block sizes for each NAND device that U-Boot detects
Use the nand read command to read from the NAND into RAM. How much NAND to read into RAM depends on the RAM size
If you have an SD (MMC) drive you can write from RAM to SD using the mmc write command
If you have a USB device you can use start usb to scan the USB for a mass storage or "ethernet" (i.e. OTG) device
If start usb detects a mass storage device, you can write from RAM to the mass storage device using the usb write command
There is no way to transfer from RAM to a USB or Ethernet network connection
Use the md command to hex dump arbitrary size block of memory to the serial line, then use some program to translate the ASCII hex back into binary
If you're willing to rebuild uboot and reflash your board, you can enable the tftpput command with the CONFIG_CMD_TFTPPUT option. (Assuming a recent version of uboot.)
Assuming not, within the embedded Linux, you can access your flash through /dev/mtd* (cat /proc/mtd to see the partitions). You can use dd to copy a partition to a ramdisk file, then use cat to combine the files into a single image, and the use ftpput to send it to your host. (This assumes that your embedded busybox has been built with these commands.)
Related
I noticed for general USB storage device, as long as I have enough USB end points. The Kernel will recognize the device.
Another example is I noticed when I mount two cdc-acm devices(USB modem) on a board, the Kernel only recognized one of them.
And when I configured the Kernel, there's no option for the number of the device I can mount, but only the option to turn it on/off.
Is it possible to use the BB as Mass Storage Device?
I want it to be connected to an audio player that can read files from USB connectivity (such as USB flash drive) and act as data storage device containing one specific folder (and its sub-folders) from the file system (if possible, on a flash drive connected to the board.).
As the device specs says, it has connectivity of:
USB client for power & communications
USB host
Operating system will probably be Ubuntu but can be changed.
What drivers or configurations needs to be done in order to achieve this?
The latest images have already the mass storage usb gadget active, so a mass storage peripheral should be recognized by your system upon connection.
A quick google search reveals this discussion about a user trying to disable the USB MS gadget:
From the discussion, the files where the magic happens are:
Debian: /opt/scripts/boot/am335x_evm.sh
Ubuntu: /opt/scripts/boot/am335*
Armstrong: /usr/bin/g-ether-load.sh
In my Debian image the line you want to modify is:
modprobe g_multi file=${gadget_partition} cdrom=0 stall=0 removable=1 nofua=1 iSerialNumber=${SERIAL_NUMBER} iManufacturer=Circuitco iProduct=BeagleBone${BLACK} host_addr=${cpsw_1_mac}
and the corresponding $gadget_partition variable that is set just before that in order to customize the folder you want to expose.
Note that the g_multi gadget in its standard configuration presents 3 different devices: an ethernet interface, a mass storage peripheral and a serial interface. If you want to customize the parameters you can refer to the g_multi documentation (kernel.org)
I used to update firmware on embedded system through tools like tftp (with ethernet port or ethernet over usb), sd card or a simple usb stick.
I am currently working on a system without ethernet port, no usb port. Only a ttl/usb connexion to be able to access the console and a micro usb to supply it. I am currently building a linux image and a rootfs. The storage used on the board is emmc.
Is there a standard way to update linux/rootfs in Emmc, etc.. with u-boot by using a simple ttl/usb connexion ? I guess that I can part my flash in u-boot thanks to mmc command but I don't understand how to transfer my kernel image and my rootfs in emmc with a simple ttl/usb link.
Is there a standard way to update linux/rootfs in Emmc, etc.. with u-boot by using a simple ttl/usb connexion ?
Yes, when only the serial console connection is available, a binary transfer protocol can be employed. These methods are identical to what is used with phone modems.
A U-Boot command for one transfer method is loadb.
=> help loadb
loadb - load binary file over serial line (kermit mode)
Usage:
loadb [ off ] [ baud ]
- load binary file over serial line with offset 'off' and baudrate 'baud'
=>
Another U-Boot command for a transfer method is loads for binary data formatted as a Motorola S-record file:
=> help loads
loads - load S-Record file over serial line
Usage:
loads [ off ] [ baud ]
- load S-Record file over serial line with offset 'off' and baudrate 'baud'
=>
These methods of course require the appropriate sending program on the other end of the serial link, just like tftpboot requires a TFTP server. A decent terminal emulator program, such as Minicom or TeraTerm, can perform the PC side of these transfers. Note that it's the sender that determines the file to transfer; the U-Boot side cannot request the file by name but only receives it.
If these commands are not already available in your U-Boot, then you'll have to edit the configuration and rebuild U-Boot.
I have a special bespoke device with a USB interface. When plugging in the device to my laptop - Ubuntu 12.04 it mounts as a read only USB drive - with a file on it. This file is created by the device and writes to the file when the device scans stuff.
I however, want to be able to write to the drive so the device 'thinks' it has already scanned x amount of entries.
Basically I want to replace the file 'File1.txt' my version of 'File1.txt' however I cannot because the drive is mounting as Read only.
I have tried the following commands:
andy#andy-ThinkPad-W530:/media/iRead$ touch giveme.txt
touch: cannot touch `giveme.txt': Read-only file system
andy#andy-ThinkPad-W530:/media/iRead$ sudo mount -o remount,rw '/media/iRead'
[sudo] password for andy:
mount: cannot remount block device /dev/sdb read-write, is write-protected
andy#andy-ThinkPad-W530:/media/iRead$
Can anybody suggest anything I can try to mount this as writable drive?
I have a very strong feeling that the chip which is storing this data is the following:
ARM STM32F103 RBT6 22oUP _ 93 MLT22950
Hope this helps somebody to help me!
If processing write commands coming from USB wasn't part of the requirements, it's very unlikely that the device processes write commands.
A read-only USB mass storage device is not a read-write mass storage device with write-protection slapped on top. It's a USB device that doesn't have logic for understanding write requests at all.
After the device is finished and delivered is a little late for deciding
I want to be able to write to the drive so the device 'thinks' it has already scanned x amount of entries.
Of course the flash memory used inside the device is written during its operation. But the way data is stored inside might not look anything like its USB presentation, and the conversion is most likely one-way only.
Since the developer probably did not implement mass storage support from scratch, and the library they used probably has write support, they may be able to easily supply you with firmware modified to be writable and do something with the written data. But without changing the firmware, you get nowhere.
Is it possible to get a list of files from an SD card when it is connected as a USB Mass Storage device?
UMS provides the contents of the SD card as a raw storage device, much the same as a hard drive or CD driver. As such, it is up to the operating system's VFS to make sense of the partitioning, formatting, and directory structure contained on it.