38

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 ...


35

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


34

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: ...


29

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 ...


27

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

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 ...


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 ...


19

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 ...


18

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 ...


17

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


16

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.


15

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 ...


15

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 ...


14

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


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

U-Boot brings its own dumpimage tool (find it in the tools directory of your U-Boot tree) Of course it works with simple images, but it also supports the old-style multi images $ ~2/tools/dumpimage -l uMulti Image Name: Created: Thu Aug 31 19:54:29 2017 Image Type: ARM Linux Multi-File Image (uncompressed) Data Size: 5678650 Bytes = 5545.56 ...


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

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. ...


10

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 -v -e '1/1 "%02x"' "$1" Example use: ./bin2hex binary_file_1 | ./hex2bin - > binary_file_2 diff -s ...


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

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

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-...


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

The arch linux documentation Improving performance/Boot process may help you to learn how to improve the boot performance. Use systemd-analyze blame to check the timing for the enabled services, or systemd-analyze critical-chain to check the critical points then disable the unwanted services through systemctl disable service_name. or removing the un-...


7

It's taken a bit of time, but I thought I'd hold off answering until I had answers to all 3 of my sub-questions. Before I start though, I will mention that the correct term when it comes to "de-fragmenting" working memory is referred to "compacting" working memory. 1. Did rm not execute because there wasn't enough contiguous RAM? I was correct in my ...


7

As mentioned by 0andriy, you can use bind/unbind. I am doing something similar but this will be different as it depends on the hardware. To unbind my sdio wifi module I use: echo -n "2190000.usdhc" > /sys/devices/soc0/soc/2100000.aips-bus/2190000.usdhc/driver/unbind This will give you something like mmc1: card 0001 removed in dmesg. I then toggle a ...


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