We’re rewarding the question askers & reputations are being recalculated! Read more.
32

mkimage -l uImage Will dump the information in the header. tail -c+65 < uImage > out Will get the content. tail -c+65 < uImage | gunzip > out will get it uncompressed if it was gzip-compressed. If that was an initramfs, you can do cpio -t < out or pax < out to list the content. If it's a ramdisk image, you can try and mount it with: ...


31

That entirely depends on what services you want to have on your device. Programs You can make Linux boot directly into a shell. It isn't very useful in production — who'd just want to have a shell sitting there — but it's useful as an intervention mechanism when you have an interactive bootloader: pass init=/bin/sh to the kernel command line. All Linux ...


27

If dtc is available on your platform (else, install the device-tree-compiler package), you can use: dtc -I fs /sys/firmware/devicetree/base


25

fuse-zip is an option and claims to be faster than the competition. # fuse-zip -r archivetest.zip /mnt archivemount is another: # archivemount -o readonly archivetest.zip /mnt Both will probably need to open the whole archive, therefore won't be particularly quick. Have you considered extracting the ZIP to a HDD or USB-stick beforehand and simply ...


24

Devices most likely get a file in /dev/input/ named eventN where N is the various devices like mouse, keyboard, jack, power-buttons etc. ls -l /dev/input/by-{path,id}/ should give you a hint. Also look at: cat /proc/bus/input/devices Where Sysfs value is path under /sys. You can test by e.g. cat /dev/input/event2 # if 2 is kbd. To implement use ...


19

squashfs is a read-only compressed file system. It has no provision to make modification to it once it's been created. So you couldn't write to it even if the underlying block device could be made writeable. You'd need to create a new squashfs image of the whole filesystem with your modifications and burn it to the storage device where that file system is ...


17

You don't need to modify the kernel to just it just once; you can override it. Unplug the device modprobe ftdi_sio echo 0403 6001 >/sys/bus/usb-serial/drivers/ftdi_sio/new_id Plug in the device And your device should work. Your other alternative is to use the bind sysfs interface; I suggest using lsusb -t to figure out the correct path+interface in ...


17

The best resistance against corruption on a single SD card would be offered by BTRFS in RAID1 mode with automatic scrub run every predefined period of time. The benefits: retaining ability to RW to the filesystem modern, fully featured filesystem with very useful options for an RPi, like transparent compression and snapshots designed with flash memory in ...


16

You can easily extract the encrypted password with awk. You then need to extract the prefix $algorithm$salt$ (assuming that this system isn't using the traditional DES, which is strongly deprecated because it can be brute-forced these days). correct=$(</etc/shadow awk -v user=bob -F : 'user == $1 {print $2}') prefix=${correct%"${correct#\$*\$*\$}"} For ...


14

Run this command in your target device export VALGRIND_LIB=~/valgrind/lib/valgrind/ where ./valgrind is installed directory path (given in ./configure)


14

If you have a watchdog on your system and a driver that uses /dev/watchdog, all you have to do is kill the process that is feeding it; if there is no such process, then you can touch /dev/watchdog once to turn it on, and if you don't touch it again, it will reset. You also might be interested in resetting the device using the "magic sysrq" way. If you have ...


13

If you know the physical address of the device, you can use devmem2. devmem2 <physical address> <size (b/h/w)> [value]


12

You don't need to modify the kernel, you can automate the process like this: Add the following single line to /etc/udev/rules.d/99-ftdi.rules ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", RUN+="/sbin/modprobe ftdi_sio" RUN+="/bin/sh -c 'echo 0403 6001 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id'" Either reboot or run sudo udevadm ...


12

Peripherals are connected to the main processor via a bus. Some bus protocols support enumeration (also called discovery), i.e. the main processor can ask “what devices are connected to this bus?” and the devices reply with some information about their type, manufacturer, model and configuration in a standardized format. With that information, the operating ...


11

On your question 2 (defragmenting memory), quoting from https://www.kernel.org/doc/Documentation/sysctl/vm.txt : compact_memory Available only when CONFIG_COMPACTION is set. When 1 is written to the file, all zones are compacted such that free memory is available in contiguous blocks where possible. This can be important for example in the ...


11

New answer (2015-03-22) (Note: This answer is simpler than previous, but not more secure. My first answer is stronger because you could keep files read-only by fs mount options before permission flags. So forcing to write a files without permission to write won't work at all.) Yes, under Debian, there is a package: fsprotect (homepage). It use aufs (by ...


11

As with all things pertaining to security, there aren't any guarantees, but you also need to balance risk (and cost) against probability. From experience (and I've been running dozens of *nix boxen since the dark ages), I've never really had significant power-caused filesystem corruption. Some of these machines were even running on non-journalled ...


10

I would use an initramfs. (http://www.kernel.org/doc/Documentation/filesystems/ramfs-rootfs-initramfs.txt) Many Linux distributions use an initramfs (not to be confused with an initrd, they are different) during the boot process, mostly to be able to start userspace programs very early in the boot process. However, you can use it for whatever you want. The ...


10

Well flash storage is more desirable than magnetic storage, for multiple reasons, but for this application I'll say mainly because there is no moving parts. That being said, I don't think there is a 'corruption proof' filesystem out there, but there are some robust filesystems (ext4 being one) out there, as well as some tactics to help mitigate corruption. ...


10

The device tree is exposed as a hierarchy of directories and files in /proc. You can cat the files, eg: find /proc/device-tree/ -type f -exec head {} + | less Beware, most file content ends with a null char, and some may contain other non-printing characters.


9

I think you should convert it to u-boot file like this and give it a try: mkimage -n 'Ramdisk Image' -A arm -O linux -T ramdisk -C gzip -d initramfs.cpio.gz initramfs.uImage This might be a valid format for u-boot.


9

If I understand your question this articled sounds like what you're looking for. The article is titled: Device drivers in user space. excerpt UIO drivers Linux provides a standard UIO (User I/O) framework for developing user-space-based device drivers. The UIO framework defines a small kernel-space component that performs two key tasks: a. ...


8

Wow, that has to be the first time this century that I've heard rx referred to as a "great little utility"! :-) Yet we can still dust the cobwebs off those old commands. XMODEM: rx for receiving, sx for sending. YMODEM: rb for receiving, sb for sending. ZMODEM: rz for reveiving, sz for sending.


8

As per this section of Bitbake manual ?= is: You can use the "?=" operator to achieve a "softer" assignment for a variable. This type of assignment allows you to define a variable if it is undefined when the statement is parsed, but to leave the value alone if the variable has a value. Here is an example: A ?= "aval" If A is set at the time this ...


8

Here's what I came up with (based on several online sources and some experimentation). Converting from hex to bin (hex2bin): #!/bin/sh sed 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI' "$1" | xargs printf Converting from bin to hex (bin2hex): #!/bin/sh hexdump -C "$1" | cut -b9- | cut -d"|" -f1 | tr -d ' \t\n\r' Example use: ./bin2hex binary_file_1 | ./hex2bin - &...


8

PCs actually do need a device tree. They just call it something else. It is not correct to say that operating systems for the descendents of PC/AT compatibles assume the existence of things such as a PCI bus. They do not. Nor do they probe. Probing for hardware, just poking some I/O or memory addresses to see whether they work, has not been necessary ...


7

Having a watchdog on an embedded system will dramatically improve the availability of the device. Instead of waiting for the user to see that the device is frozen or broken, it will reset if the software fails to update at some interval. Some examples: Linux System http://linux.die.net/man/8/watchdog VxWorks (RTOS) http://fixunix.com/vxworks/48664-about-...


7

If you think the watchdog is running OK, and want to test that it really is capable of recovering a crashed system, then you can do one better than Shawn's answer by using the "magic sysrq" to crash the system with a kernel panic. Syncing your file system first is a good idea, so do something like this as root: sync; sleep 2; sync; echo c > /proc/sysrq-...


Only top voted, non community-wiki answers of a minimum length are eligible