date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,485,283,266,000
I'm trying to get the "Torobot" USB servo controller to work with Angstrom on a Beagle Board XM. The servo controller registers as a USB device. The device just takes simple text commands, but there is no TTY associated with it. So I'm not sure how to send commands to it. Can I just send data like this (assuming that 002/005 is the device): $ cat file.txt >> /dev/bus/usb/002/005 Or do I need to associate it with the generic USB device? If so, how do I do that?
Finally Success: I found that the Torobot USB board could be communicated with an Arduino serial driver. Conveniently this is available through opkg: opkg install kernel-module-cdc-acm When the board is plugged in, it comes up as /dev/ttyACM0 From here you can simply echo commands to the device. echo "#8P1500T100" > /dev/ttyACM0 This basically says "set servo 8 to position 1500 with speed 100"
How do I send text to a USB device?
1,485,283,266,000
I am having heavy problems similar to what discussed in this question. In my case though, I have a very recent kernel (5.3) for a small embedded processor (mips, mt7628) and boot process stops for over 6 minutes till I get the kprint: [ 402.804482] random: crng init done after that boot sequence continues normally: [ 403.807776] usbcore: registered new interface driver usbhid [ 403.813440] usbhid: USB HID core driver Starting kmsgd: OK Starting applicazione: stream.py OK ... Can someone explain what's going on (and, possibly, a workaround)? Of course I have no randomization hardware.
I have been directed to use haveged and it actually dramatically shortens startup time: [ 12.477886] random: crng init done I will leave this answer for whoever will stumble into the problem. I will wait for better answers before accepting this. Note: this source hints there could be some kind of kernel bug responsible for entropy pool exhaustion, but I found no precis references.
Linux embedded: boot stopped by "crng init" for LOOOOONG time
1,485,283,266,000
I am required to write some software to run on Linux installed on an x86 based embedded setup that has a 8GB compact flash drive for data storage. The critical requirements are logging measurement data to file every 30 seconds, and robustness to power loss (my system MUST be able to reboot successfully every time and logging data must not get corrupted). I have used buildroot to generate my kernel, crosstools and file system. Currently I have tried 2 things Booting up using only the .cpio file system provided by buildroot. Copying the file system to an ext3 partition and telling syslinux that the root file system is located there. If I use option 1. and have my root file system in RAM I will lose my data at power down. If I use option 2. then I run the risk of system files getting corrupted on power down. The answer to this question Is using a read only root file system a good idea for embedded setup? lead me to consider using a read only file system, but the only answer I have received is currently too advanced for my level of Linux expertise. This has lead me to consider using a RAM based file system. In the case of a RAM file system using the .cpio file to boot from, how could I possibly operate things so that I can ensure power down safety AND get persistent data storage for my data logging requirements ?
Run your system off RAM (faster, read only, will come up in known good state, etc.) Log your data to a separate partition on the USB stick. Might try mounting it with sync if your writes are not too frequent.
Using ramfs on embedded system
1,485,283,266,000
We are using beagle bone black based custom board, with kernel version 3.12. We are facing system hang during one of the init script,(Which brings up WiFi) this hang happens after random number of power cycle, Nothing works during this hang, it looks like system is frozen, It doesn't even respond to sysrq keys I assume this to be in the ISR code because of which none of the thing works. Unluckily When we enable 'Detect hung task(DETECT_HUNG_TASK)' we don't see the issue. :( Only thing works is if watchdog is enabled after watchdog timer expires it reboots the system and system recovers. However we want to find out where the issue is. Any suggestion? I thought of using softdog and repair script pair to print some messages but I assume external interrupt will have higher priority and when it executes and hangs in there, softdog timer will also not get a chance to execute right ? Randomness of the bug makes it much more difficult to debug :( Any help appreciated.
Well, We did code reading as it was being suggested in the comments and found the section of the patch where system may go into infinite loop(in irq) and won't come out of it. However when we put printk in that irq function issue was not getting reproduced. (timing issue you know!) So finally my colleague tried old school method of toggling GPIO and it helped. That was also difficult as more than two entries of GPIO toggle would prevent reproducing issue. inside function he used GPIO toggle as follows, func() { //set gpio high some doubtfull code.. .... //set gpio low } That's how he tracked the problematic code and its solution is available in linux-4.1 he fixed it and he is testing it. @ShankarSM:If you are reading this, all credit goes to you for tracking down it :-)
How to debug Linux hang?
1,435,702,788,000
I'm working in an embedded Linux system trying to get it booting its root file system in ram using initramfs. The system comes up for the most part but then has trouble in the init scripts. I've narrowed the problem down to the following. The system cannot recognize any relative paths. Let me explain more... Not only are symlinks that point to files in relative locations broken, but simply running a simple command like such doesn't work: $ pwd /etc/network $ cat ../inittab cat: can't open '../inittab': No such file or directory But this works fine: $ cat /etc/inittab <inittab output ...> Any idea what could be going on? UPDATE1 A standard ls .. command appears to function as expected. Also, the inode references look ok I believe? $ ls .. default/ inputrc moduli random-seed ssh_config sshd_config dhcp/ issue mtab@ resolv.conf@ ssh_host_dsa_key ssl/ fstab ld.so.conf network/ rsyslog.conf ssh_host_dsa_key.pub sysconfig/ fstab.bak ld.so.conf.d/ nsswitch.conf rsyslog.d/ ssh_host_ecdsa_key ts.conf group logrotate.conf os-release screenrc* ssh_host_ecdsa_key.pub udev/ hostname logrotate.d/ passwd securetty ssh_host_key hosts ltrace.conf passwd- services ssh_host_key.pub init.d/ memstat.conf profile shadow ssh_host_rsa_key inittab mke2fs.conf protocols shadow- ssh_host_rsa_key.pub $ cd / ; ls -lid /etc 1547 drwxr-xr-x 12 root root 0 Jan 1 00:49 /etc/ $ cd /etc ; ls -lid . 1547 drwxr-xr-x 12 root root 0 Jan 1 00:49 ./ $ cd /etc/network ; ls -lid .. 1547 drwxr-xr-x 12 root root 0 Jan 1 00:49 ../ With even more digging, I've discovered that relative paths work AS LONG AS you do not cross the "boundry" of the root of the file system: $ cd usr/ $ ls ../etc ls: ../etc: No such file or directory $ cd ../etc $ cd network/ $ ls .. default/ inputrc moduli random-seed ssh_config sshd_config dhcp/ issue mtab@ resolv.conf@ ssh_host_dsa_key ssl/ fstab ld.so.conf network/ rsyslog.conf ssh_host_dsa_key.pub sysconfig/ fstab.bak ld.so.conf.d/ nsswitch.conf rsyslog.d/ ssh_host_ecdsa_key ts.conf group logrotate.conf os-release screenrc* ssh_host_ecdsa_key.pub udev/ hostname logrotate.d/ passwd securetty ssh_host_key hosts ltrace.conf passwd- services ssh_host_key.pub init.d/ memstat.conf profile shadow ssh_host_rsa_key inittab mke2fs.conf protocols shadow- ssh_host_rsa_key.pub $ ls ../../usr ls: ../../usr: No such file or directory This leads me to believe that I have not properly mounted the root filesystem. Perhaps this output is the most telling of that? $ df Filesystem Size Used Available Use% Mounted on devtmpfs 204.2M 0 204.2M 0% /dev tmpfs 251.7M 0 251.7M 0% /dev/shm tmpfs 251.7M 76.0K 251.6M 0% /tmp UPDATE2 After additional searching, I believe the following best describes my scenario: 2) The newer initial ramfs image, initramfs. Here one populates a directory, and then creates a compressed cpio archive which is expanded into ramfs upon boot and becomes the root filesystem. The kernel must be configured with CONFIG_BLK_DEV_INITRD=y but one does not need to set CONFIG_BLK_DEV_RAM_SIZE, nor does one need to set CONFIG_TMPFS=y. When the system is up, "df" does not report the root filesystem and one cannot interact with it by doing things like "mount --bind / dir". Also the distinction between what RAM is set aside for the filesystem and what RAM is used for processes is blurred. "df" reports nothing and "free" reports total usage without distinction, ie. used RAM = RAM used for files (as reported by "du") plus RAM used for processes. However, I am a bit surprised by this. Does this imply I will not be able to interact around the root of the file system when using initramfs? UPDATE3 This post indicates that what I am trying to accomplish is not unreasonable: Now normally an initramfs is temporary, only used to run some programs extremely early in the boot process. After those programs run, control is turned over to the real filesystem running on a physical disk. However you do not have to do that. There is nothing stopping you from running out of the initramfs indefinitely How can I run out of the initramfs indefinitely but yet also be able to "traverse" across the root of the file system?
After reading this post, the problem is solved! I had noticed when running the mount command that two entries appeared for /: rootfs on / type rootfs (rw,relatime) devtmpfs on /dev type devtmpfs (rw,relatime,size=209064k,nr_inodes=52266,mode=755) proc on /proc type proc (rw,relatime) devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620) tmpfs on /dev/shm type tmpfs (rw,relatime,mode=777) tmpfs on /tmp type tmpfs (rw,relatime) sysfs on /sys type sysfs (rw,relatime) none on / type tmpfs (rw,relatime) I had added an entry to fstab that I needed to remove: # /etc/fstab: static file system information. # # <file system> <mount pt> <type> <options> <dump> <pass> none / tmpfs defaults 0 0 proc /proc proc defaults 0 0 devpts /dev/pts devpts defaults,gid=5,mode=620 0 0 tmpfs /dev/shm tmpfs mode=0777 0 0 tmpfs /tmp tmpfs defaults 0 0 sysfs /sys sysfs defaults 0 0 After removing the entry (and performing a reboot): none / tmpfs defaults 0 0 The problem goes away!
Relative path to anything not working (while running from initramfs)
1,435,702,788,000
I have spent some time getting my BeagleBoard XM computer up and running with the default Angstrom demo image after it has sat unopened for close to a year. I've been able to interact with it through the serial port, and then through putty. I can install packages such as Apache, and it seems to work fine. However, with the exception of writing test files to one specific mount point, all other mount points seem to be temporary. So when I install a new package and then reboot the computer, the package is no longer there. Is there a trick to opkg, or do I have to create a new image that builds the bulk of the file systems on the SD card? I am fine with adding packages and programming, but building images is tedious and daunting.
The answer was that the demo version is mounted to a ram disk. So YES - you must build the image. The way I went about it was to build a Linux system on an older laptop (which of course opens its own can of worms) and build the image from there. Once you have a working version of Angstrom that is NOT loading onto ramDisks the installation of packages is permanent and pleasantly straight-forward.
How do I install packages permanently on my Beagleboard?
1,435,702,788,000
I have an embedded system based on the Intel-Atom with PCH which we are busy developing. In the embedded environment I have: A Serial console through the PCH which means this doesn't work with the standard kernel. (as CONFIG_SERIAL_PCH_UART_CONSOLE is required) The SATA drive is only available in the embedded environment and can't be taken out for install. I can boot via USB drive. The system does have ethernet via the PCH which I have not yet confirmed to work. I have managed to build a custom Linux 3.16.7 kernel that can be booted with console=uartPCH0,115200 and then displays a console on the serial line. However, to move from here to an actual installation seems to be problematic. I am unable to convince debian-installer to be built using my custom kernel. My current theory is a double bootstrap process where I first bootstrap an installation into a usb-drive and then boot that and then bootstrap an installation into the SATA drive on the system? Any better suggestions? I'm not sure if there is some way to install via a network console? The system requires the e1000e driver which I assume will be built into the standard debian installer ISO's, however so far I was unable to find very clear documentation on how to convince the install system to boot and then open up ssh/telnet. Any hint ?
I managed to solve my problem with debootstrap, here is a quick run-down of the process I followed. unmount usb Partition the USB (4GB) Zap out GPT with gdisk, as my board didn't want to boot GPT. Created just one linux partition, nothing else. I had lots of problems getting a usb drive bootable on my embedded system. mkfs.ext4 /dev/sdb1 mount /dev/sdb1 /media/usb debootstrap jessie /media/usb http://my.mirror/debian I highly recommend setting up something like apt-cacher chroot /media/usb Mount all these: mount -t devtmpfs dev /dev mount -t devpts devpts /dev/pts mount -t proc proc /proc mount -t sysfs sysfs /sys Edit /etc/fstab : (I use nano for editing normally) proc /proc proc defaults 0 0 sysfs /sys sysfs defaults 0 0 UUID=xxxx / ext4 errors=remount-ro 0 1 to write UUID into file use: blkid -o value -s UUID /dev/sdb1 >> /etc/fstab house-keeping: apt-get install locales dpkg-reconfigure locales apt-get install console-setup dpkg-reconfigure keyboard-configuration (optional?) apt-get install console-data passwd root adduser linuxuser Install grub and kernel apt-get install grub-pc I installed grub into both /dev/sdb and /dev/sdb1 but you can use install-mbr for /dev/sdb I think apt-get install linux-image-686-pae now edit /etc/default/grub: uncomment GRUB_TERMINAL=console add GRUB_GFXPAYLOAD_LINUX=text to GRUB_CMDLINE_LINUX_DEFAULT add: console=tty0 console=ttyPCH0,115200 run upgrade-grub2 edit /etc/default/console-setup : CODESET="guess" FONTFACE= FONTSIZE= VIDEOMODE= create /etc/kernel-img.conf with this inside: image_dest = / do_symlinks = yes do_bootloader = yes do_bootfloppy = no do_initrd = yes link_in_boot = no Now install custom kernel with dpkg -i For me 2 options was important: CONFIG_SERIAL_PCH_UART=y CONFIG_SERIAL_PCH_UART_CONSOLE=y although I did highly customize the kernel after that. Currently I am compiling 3.14 with the rt-patch from linux-source-3.14 I downloaded out of wheezy-backports Other things to do before restarting (optional) edit /etc/modules to force drivers to load edit /etc/network/interfaces echo myHostName > /etc/hostname apt-get install telnetd apt-get install openssh-server At this stage I could boot the usb on my target embedded system and repeat the whole process again to install debian on the SATA drive. Obviously I needed to install things like debootstrap on the usb drive first to facilitate this but that was minor.
Installing Debian on Embedded system with serial console or network console (PCH)
1,435,702,788,000
I've heard that Android is based on linux (or unix?). That means, engineers at google modified linux code to run on android phones or tablets. I would like to become those engineers someday. Where should I start? Should I start looking at embedded linux?
Actually google did more writing an app platform / virtual machine system to run on top of linux than they did modifying linux. They basically just used it as a base to build off of, they hardly had to touch it. As for your question, just start doing things. Get yourself some linux distros, install them on your computers or in VM's, learn your way around them, then start poking at custom platforms like embeded once you already know the ropes. Find some devices to hack, code up some projects of your own, then find some open source projects to lend a hand with. Along the way you'll figure out how to answer your own question.
How to start customizing linux?
1,435,702,788,000
I notice that ncurses's terminfo database on /usr/share/terminfo is about 7MB (I compiled it myself). This is too large if I want to deploy it on an embedded Linux of 64MB disk space. Is there a way to reduce its size by deleting unneeded entries and keep the most-used ones? And what's is this actually for? EDIT: Is there any info or reference for commonly used terminfo for regular PCs or SSH clients?
With ansi, cygwin, linux, vt100, vt220, and xterm terminfo definitions, I expect you'd be able to hit 98% of the terminal emulations that you'll encounter in the wild. Even terminal emulators that have a different native mode can likely be directed to emulate vt100/vt220 modes, often without user intervention.
How to reduce ncurses terminfo size
1,435,702,788,000
I am working with an embedded Linux (ARM/busybox) system. It has systemd and the timedatectl system executable, but it does not have /etc/timezone, /usr/share/zoneinfo, nor the zic timezone data compiler program. I have plenty of system diskspace on this embedded system. Is it possible to copy the /usr/share/zoneinfo contents from an amd64 Linux implementation to my embedded ARM Linux implementation "as-is" to get access to the timezone functionality that timedatectl provides? Thanks for your help.
Yes, the binary timezone files are platform-agnostic. This is noted e.g. in the Wikipedia article "tz database": The tz database is published as a set of text files which list the rules and zone transitions in a human-readable format. For use, these text files are compiled into a set of platform-independent binary files—one per time zone. The reference source code includes such a compiler called zic (zone information compiler), as well as code to read those files and use them in standard APIs such as localtime() and mktime(). The binary format itself is documented in the manpage tzfile(5) and RFC 8536: The timezone information files used by tzset(3) are typically found under a directory with a name like /usr/share/zoneinfo. These files use the format described in Internet RFC 8536. Each file is a sequence of 8-bit bytes. In a file, a binary integer is represented by a sequence of one or more bytes in network order (bigendian, or high-order byte first), […] There might be some incompatibility if the reading library is much older than zic, depending on with which parameters zic was run: -b bloat Output backward-compatibility data as specified by bloat. If bloat is fat, generate additional data entries that work around potential bugs or incompatibilities in older software, such as software that mishandles the 64-bit generated data. If bloat is slim, keep the output files small; this can help check for the bugs and incompatibilities. Although the default is currently fat, this is intended to change in future zic versions, as software that mishandles the 64-bit data typically mishandles timestamps after the year 2038 anyway. Also see the -r option for another way to shrink output size.
Is Linux /usr/share/zoneinfo/ Platform Agnostic?
1,435,702,788,000
Running on a custom rockchip board with Ubuntu 14.04. I look at interfaces with ifconfig: ... wlan3 Link encap:Ethernet HWaddr 08:ea:40:d7:63:27 inet addr:192.168.12.1 Bcast:192.168.12.255 Mask:255.255.255.0 inet6 addr: fe80::aea:40ff:fed7:6327/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:64634 errors:0 dropped:3811 overruns:0 frame:0 TX packets:249 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:868 (868.0 B) TX bytes:89112 (89.1 KB) I see the wifi interface as the last result. I try running sudo iw dev wlan3 scan which returns command failed: No such device (-19). I came across people having a similar issue on the Pi (additional instance). Anyone know the cause of this issue or a way around it? lsusb: Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 003: ID 0bda:8179 Realtek Semiconductor Corp. RTL8188EUS 802.11n Wireless Network Adapter Bus 002 Device 002: ID 05e3:0608 Genesys Logic, Inc. Hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub uname -a: Linux ws1-dev-philip 3.0.36+ #12 SMP PREEMPT Wed Apr 5 13:22:57 EDT 2017 armv7l armv7l armv7l GNU/Linux
The nl80211 standard doesn't support the rtl8188eu driver , use wext the old driver. To connect use the following command as root (you don't need to configure anything); wpa_supplicant -B -Dwext -c <(wpa_passphrase "ESSID" PASSWORD) -i wlan3 dhclient wlan3 If you have already a wpa_supplicant.conf configuration file use it as follow: wpa_supplicant -iwlan3 -D wext -c/etc/wpa_supplicant/wpa_supplicant.conf -B dhclient wlan3 To manage the network from the command line you can use wicd_cli available on the universe repository after removing the network-manager. Install wicd then configure it to use wext driver. Using wext driver you should use the deprecated wireless-tools commands , such as iwlist , iwconfig ... Important note from arch linux wiki: iw — iw only supports the nl80211 (netlink) standard. It does not support the older WEXT (Wireless EXTentions) standard. If iw does not see your card, this may be the reason. wireless_tools — wireless_tools is deprecated but still widely supported. Use this for modules using the WEXT standard.
`iw dev $interface scan` not working on embedded device
1,435,702,788,000
Is UBoot able to boot via fatload/ext4load from an EMMC's General Purpose Partition or Boot Partition? I am able to show files from the User area, just not partitions created as hardware partitions. These partitions can be created by using UBoot's "mmc hwpartition" command. It seems odd UBoot can create these partitions, but doesn't seem to be able to use them. I am using the latest version (2016.4) of Xilinx's UBoot, which is based based on the UBoot Using UBoot's "mmc info" command, UBoot can definitely see the Boot Partition and General Purpose Partitions (GP 1/2/3/4): zynq-uboot> mmc info Device: sdhci@e0100000 Manufacturer ID: fe OEM: 14e Name: MMC04 Tran Speed: 52000000 Rd Block Len: 512 MMC version 4.4.1 High Capacity: Yes Capacity: 2.7 GiB Bus Width: 4-bit Erase Group Size: 4 MiB HC WP Group Size: 4 MiB User Capacity: 2.7 GiB Boot Capacity: 16 MiB ENH RPMB Capacity: 128 KiB ENH GP1 Capacity: 128 MiB GP2 Capacity: 64 MiB GP3 Capacity: 128 MiB GP4 Capacity: 512 MiB Normally, I am able to use the UBoot commands: fatload/fatls or ext4load/ext4ls in order to show contents of a given partition based on its filesystem type. Working example of fatls command - please note this is showing the contents of the User area (size 2.7GB from above). zynq-uboot> fatls mmc 0:1 17488 devicetree.dtb 962589 fpga.bit 54 uenv.txt 6709360 uimage 1555344 boot.bin 33 image.chk 83493724 image.tgz 7 file(s), 0 dir(s) The GP partitions, when mounted in linux, contain my root filesystem, kernel image, etc. I would like to be able to boot from a GP partition via fatload/ext4load commands and use the User area for other purposes that storing my boot files. I have found other posts about this topic, however, they don't seem to have been answered yet: https://lists.denx.de/pipermail/u-boot/2014-July/184731.html Any help would be appreciated!
Yes, you can access the GP partitions from uboot. As described here http://u-boot.10912.n7.nabble.com/How-to-access-GP-partitions-from-uboot-2015-04-td212394.html you can use the "mmc partconf" command's last argument to tell the eMMC to bring out different parts (e.g. the GP instead of the user area). After you run that command, and execute a "mmc read" command, you'll notice that you are reading from a different area. Take care though. At least in my u-boot version (2017), u-boot does not know that is has to re-read the partition table, and for optimization purposes, it won't. I had to do a small patch in part.c in blk_get_device_by_str to force part_init to execute each time. Then, when you do a "mmc part", you should see the GP partition table as well, and can do any file operation as you would normally do. Don't foget that doing an "mmc rescan" or any reset of the eMMC will loose the GP state, and you'll have to switch back to the GP again to read it.
How to load files from an EMMC's General Purpose Partition or Boot Partition, using Uboot
1,435,702,788,000
Using ssh from BusyBox, I cannot remove symlinks: after rebooting the device, symlinks re-appear. ls -la shows that symlinks have been removed, but after rebooting device they re-appear again. Those symlinks already existed beforehand, created at installing the firmware. $ rm uw_cert.cer I tried to remove uw_cert.cer and uw_key_prv.bin, but it reappears after reboot. The other files can be removed without problem. <root@fwre:/nvram/1/security> ls -la total 5 drwxr-xr-x 3 root 0 0 Jan 1 00:00 . drwxr-xr-x 5 root 0 0 Jan 1 00:05 .. -rwxrwxrwx 1 root 0 905 Jan 1 00:06 cm_cert.cer drwxr-xr-x 2 root 0 0 Jan 1 00:00 download lrwxrwxrwx 1 root 0 25 Jan 1 00:00 uw_cert.cer -> /nvram/fw/bpi/uw_cert.cer lrwxrwxrwx 1 root 0 28 Jan 1 00:00 uw_key_prv.bin -> /nvram/fw/bpi/uw_key_prv.bin -rwxrwxrwx 1 root 0 1052 Jan 1 00:06 mfg_cert.cer -rwxrwxrwx 1 root 0 140 Jan 1 00:02 mfg_key_pub.bin lrwxrwxrwx 1 root 0 37 Jan 1 00:00 root_pub_key.bin -> /etc/docsis/security/root_pub_key.bin mount output: <root@fware:/var/tmp> mount rootfs on / type rootfs (rw) /dev/root on / type squashfs (ro) proc on /proc type proc (rw) ramfs on /var type ramfs (rw) sysfs on /sys type sysfs (rw) tmpfs on /dev type tmpfs (rw) devpts on /dev/pts type devpts (rw) /dev/mtdblock4 on /nvram type jffs2 (rw) EDIT: df /nvram/1/security Filesystem 1K-blocks Used Available Use% Mounted on /dev/mtdblock4 320 256 64 80% /nvram cat /proc/mounts rootfs / rootfs rw 0 0 /dev/root / squashfs ro 0 0 proc /proc proc rw 0 0 ramfs /var ramfs rw 0 0 sysfs /sys sysfs rw 0 0 tmpfs /dev tmpfs rw 0 0 devpts /dev/pts devpts rw 0 0 /dev/mtdblock4 /nvram jffs2 rw 0 0
the filesystem you are trying to remove symlink from is probably an initramfs which is loaded on ram at boot, so the one you are modifying is the ram copy of the initial ram disk, which is discarded at shutdown. If you want to modify the ramdisk file, you need additional information. Which bootloader are you using? From which device? Can you access the kernel file and the ramdisk? Which kernel command line do you have? (use cat /proc/cmdline to discover)? I found this page that explains how to put a ramdisk image on a u-boot device. However I couldn't find a way to download the original ramdisk to your computer, so that you can edit. Please be careful that if you provide an invalid ramdisk your system could become unbootable. I don't know much about that specific architecture, so I can't suggest you a proven safe strategy. You would have your best chances if you ask another question about how to modify the initial ramdisk for a U-boot embedded modem (in this question you asked about symlinks so people who know about u-boot would probably overlook this completely)
Canot remove symlinks: after reboot, symlinks re-appear
1,435,702,788,000
After installing ssh server on my remote machine (which runs embedded Linux), I tried to connect to ssh server from host machine but it failed. This is because I could not specify user account when connecting to ssh-server (ssh connection requires to enter password of an account) since my target embedded Linux does not have /etc/passwd and /etc is not writable. Thus there are no user accounts on that system. Do we have alternative ways to connect to ssh-server on remote machine from host machine? I want to log in as the root user. This question is a follow-up to my previous question How to check my account on embedded linux without "/etc/passwd"?
Dropbear calls the getpwnam standard library function to get information about user accounts. On systems with GNU libc (the standard library for non-embedded Linux systems), this function can query several types of databases through the NSS mechanism, including /etc/passwd. Embedded systems may run a variety of libc (uClibc, dietlibc, …), and they tend to have the path /etc/passwd baked in. Short of patching and recompiling dropbear (or your libc), you're going to have to supply that /etc/passwd file somehow. There are ways to make extra files appear on top of a read-only filesystem, not by modifying the filesystem, but instead by instructing the kernel to supply files from a different filesystem at these locations. The generic mechanism is a union mount, but embedded Linux systems often lack a good union mount feature. A relatively simply way to override a filesystem location with different content is mount --bind. After running the command mount --bind /else/where /some/where, any access to a file/some/where/somefileactually accesses the file/else/where/somefile; any file in the “true”/else/whereis hidden. However, you cannot directly make a file appear this way: both/else/whereand/some/wherehave to exist (although they don't have to be directories). So you can't make/etc/passwdcome into existence, but you can override/etc`. Create a directory that will contain your replacement for /etc. Let's say it's /custom/etc. mkdir /custom/etc Create a mount point where you'll relocate the original /etc/. mkdir /custom/original-etc Create symbolic links in the replacement etc to files in the original. cd /etc for x in *; do ln -s "../original-etc/$x" "/custom/etc/$x"; done Create a passwd file in your replacement etc hierarchy. echo "root:x:0:0:root:/:/bin/sh" >/custom/etc/passwd At boot time, first perform a bind mount to create a view of the original /etc hierarchy at /custom/original-etc, then perform a bind mount to create a view of your replacement /etc at /etc. Put these commands in a script that is executed during startup (the same script where you start the dropbear server, obviously before starting dropbear). mount --bind /etc /custom/original-etc mount --bind /custom/etc /etc
How to connect to ssh-server running on embedded linux without /etc/passwd?
1,435,702,788,000
Im getting kernel oops because ppp driver is trying to access to unaligned address (there is a pointer pointing to unaligned address). Im not sure about the meaning of unaligned address. It means not multiple or 4 or out of RAM scope? If my system has a bus 32-bits wide, given an address how can i know if its aligned or unaligned?
In short an unaligned address is one of a simple type (e.g., integer or floating point variable) that is bigger than (usually) a byte and not evenly divisible by the size of the data type one tries to read. Address % Size != 0 Say you have this memory range and read 4 bytes: +---------- 8 % 4 = 0, OK | ______+______ | | ... 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ... --+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-- * | @ | @ | @ | @ | * | * | * | * | @ | @ | @ | @ | * | * | * --+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-- |_______.______| | +--- 10 % 4 = 2, Unaligned More on the matter in Documentation/unaligned-memory-access.txt.
Know when a memory address is aligned or unaligned
1,435,702,788,000
I'm struggling with the watchdog timer (wdt) for a while. I can't get it working. My microcontroller is a AriaG25, based on the AT91SAM925. I have used this tutorial to compile the kernel. The kernel settings related to the wdt looks like this: CONFIG_WATCHDOG=y CONFIG_AT91SAM9X_WATCHDOG=y The kernel has been compiled without problem and boots succesfully. I've installed the watchdog deamon software via apt-get. And now I'm stuck. How do I get the watchdog working? I read a lot about /dev/watchdog. I don't have that file. Do I have to put the driver for my hardware there? Is this a driver?
I've changed my kernel configuration to this: CONFIG_WATCHDOG=y CONFIG_SOFT_WATCHDOG=m CONFIG_AT91SAM9X_WATCHDOG=y Now my watchdog timer was running. I only had to edit /etc/watchdog.conf in order to set up tests.
How enable watchdog?
1,435,702,788,000
I got a beaglebone black which comes with u-boot linux preinstalled on the emmc. For the sake of learning I want to put u-boot on the flash myself and build linux from scratch. I have compiled u-boot, booted the board via UART and loaded u-boot via xmodem. As a result I can enter u-boot commands. From my understanding I need to store the MLO and u-boot.bin files on the emmc. I have loaded the files into RAM using xmodem but I am a little bit confused how/where to write them. I also don't see any existing MLO /u-boot files on the board which raises the question how the stock linux boots in the first place. Any hints? => mmcinfo Device: OMAP SD/MMC Manufacturer ID: 70 OEM: 100 Name: M6270 Tran Speed: 52000000 Rd Block Len: 512 MMC version 5.1 High Capacity: Yes Capacity: 3.6 GiB Bus Width: 4-bit Erase Group Size: 512 KiB HC WP Group Size: 4 MiB User Capacity: 3.6 GiB Boot Capacity: 2 MiB ENH RPMB Capacity: 512 KiB ENH => mmc part Partition Map for MMC device 1 -- Partition Type: DOS Part Start Sector Num Sectors UUID Type 1 2048 7469056 00000000-01 83 Boot
The README file for the board, which is found at board/ti/am335x/README in the source tree has a section on writing to the eMMC. It talks about Falcon Mode, which is having U-Boot run Linux, but covers flashing U-Boot itself as part of that.
Flashing U-boot on beaglebone black
1,435,702,788,000
I'm trying to use a compressed squashfs ubi volume as my root file system. The idea is to have two ubi volumes. Volume one contains a read-only squashfs file system. Volume two is re-sizable and uses the remaining flash space. It contains a writable ubifs file system. These two ubi volumes are to be overlayed using overlayfs after booting so that I have a writable file system with the ability to restore to factory state by formatting the second (ubifs) volume. I know squashfs works only on block devices, so I'm using gluebi driver to emulate them on top of ubi volumes (this creates mtdx and mtdblockx for each ubi volume): CONFIG_SQUASHFS=y CONFIG_SQUASHFS_LZO=y CONFIG_MTD=y CONFIG_MTD_BLOCK=y CONFIG_MTD_UBI=y CONFIG_MTD_UBI_GLUEBI=y CONFIG_UBIFS_FS=y Here's my ubinize.conf file to create the ubi image: [rom] mode=ubi image=rootfs.squashfs-lzo vol_id=0 vol_type=static vol_name=ubi_vol_rom [overlay] mode=ubi vol_id=1 vol_type=dynamic vol_name=ubi_vol_overlay vol_size=1KiB vol_flags=autoresize I'm using these MTD partitions for testing: mtd18: 03a00000 00040000 "sys_back" mtd19: 058c0000 00040000 "system" I flashed the ubi image to mtd18 (sys_back), attached it to ubi, mounted the resulting mtdblock and everything worked as intended, so I presume my ubi volume and squashfs file system are correct. # ubiattach -m 18 # mount /dev/mtdblock23 /mnt/ # mount /dev/mtdblock23 on /mnt type squashfs (ro,relatime) So, I wanted to try the final configuration. I flashed the ubi image to mtd19 (system) and modified my kernel parameters to contain this: ubi.mtd=system root=mtd:ubi_vol_rom rootfstype=squashfs However, mounting the root file system failed: [ 3.334908] ubi0: attaching mtd19 [ 3.725841] ubi0: scanning is finished [ 3.751239] gluebi (pid 1): gluebi_resized: got update notification for unknown UBI device 0 volume 1 [ 3.759465] ubi0: volume 1 ("ubi_vol_overlay") re-sized from 1 to 203 LEBs [ 3.767111] ubi0: attached mtd19 (name "system", size 88 MiB) [ 3.772007] ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 253952 bytes [ 3.778938] ubi0: min./max. I/O unit sizes: 4096/4096, sub-page size 4096 [ 3.785670] ubi0: VID header offset: 4096 (aligned 4096), data offset: 8192 [ 3.792583] ubi0: good PEBs: 355, bad PEBs: 0, corrupted PEBs: 0 [ 3.798604] ubi0: user volume: 2, internal volumes: 1, max. volumes count: 128 [ 3.805807] ubi0: max/mean erase counter: 3/1, WL threshold: 4096, image sequence number: 1328192 [ 3.814929] ubi0: available PEBs: 0, total reserved PEBs: 355, PEBs reserved for bad PEB handling: 40 [ 3.823843] ubi0: background thread "ubi_bgt0d" started, PID 148 [ 4.639909] UBIFS error (pid: 1): cannot open "mtd:ubi_vol_rom", error -22 List of all partitions: [ 4.647770] 1f00 2560 mtdblock0 (driver?) [ 4.652783] 1f01 2560 mtdblock1 (driver?) [ 4.657822] 1f02 22528 mtdblock2 (driver?) [ 4.662851] 1f03 5120 mtdblock3 (driver?) [ 4.667886] 1f04 3072 mtdblock4 (driver?) [ 4.672925] 1f05 1280 mtdblock5 (driver?) [ 4.677956] 1f06 1536 mtdblock6 (driver?) [ 4.682994] 1f07 1280 mtdblock7 (driver?) [ 4.688030] 1f08 9216 mtdblock8 (driver?) [ 4.693059] 1f09 9216 mtdblock9 (driver?) [ 4.698094] 1f0a 6400 mtdblock10 (driver?) [ 4.703214] 1f0b 14336 mtdblock11 (driver?) [ 4.708339] 1f0c 16896 mtdblock12 (driver?) [ 4.713458] 1f0d 61440 mtdblock13 (driver?) [ 4.718582] 1f0e 1280 mtdblock14 (driver?) [ 4.723701] 1f0f 30720 mtdblock15 (driver?) [ 4.728826] 1f10 57344 mtdblock16 (driver?) [ 4.733945] 1f11 127232 mtdblock17 (driver?) [ 4.739069] 1f12 59392 mtdblock18 (driver?) [ 4.744228] 1f13 90880 mtdblock19 (driver?) [ 4.749313] 1f14 26676 mtdblock20 (driver?) [ 4.754471] 1f15 50344 mtdblock21 (driver?) [ 4.759552] No filesystem could mount root, tried: ubifs [ 4.764942] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) [ 5.837944] Rebooting in 5 seconds.. So from the log I can tell that ubi attached to mtd19 as expected, resized the second partition (ubi_vol_overlay), created two mtd partitions from the ubi volumes (mtd20 and mtd21), and created two block devices on top of these (mtdblock20 and mtdblock21), great. However, mounting the squashfs filesystem (mtdblock20) failed. The log says it tried mounting with as ubifs even though I explicitly said to use squashfs via the rootfstype argument. At first I thought that maybe the name of the device wasn't resolving correctly in the root= parameter, so I've tried using /dev/mtdblock20 but it resulted in the same. How can I force the kernel to mount it with squashfs instead of ubifs?
Squashfs needs a block device to run, thus you need the block emulation over UBI. First make sure it is enabled in your kernel. You can test this by using the ubiblock command on a running system. For example, running ubiblock -c /dev/ubi0_0 will create the devnode /dev/ubiblock0_0. Once you have the dependency, you can enable the UBI block on the cmdline like this: ubi.mtd=2 ubi.block=0,ubi_vol_rom root=/dev/ubiblock0_0 This will use the UBI volume named ubi_vol_rom and create an emulated block device. Then you can use it to mount your root.
Using squashfs on top of ubi as root file system
1,435,702,788,000
I'm running linux on the beaglebone black. My system is running directly from the sdcard. To change the IO scheduler I need to configure /sys/block/xxx/queue/scheduler where xxx is the mounted drive. However there are only entries for mmc and ram in the /sys/block folder. How do I change the IO scheduler for my system mounted on sdcard?
You have 2 ways to setup the IO scheduler on Linux. You defined a default IO scheduler for all block devices. You can do this by adding the parameter elevator=<scheduler> (e.g. elevator=deadline) to your boot prompt (if you use a recent Grub version, like v1.99 or 2.0, you can add this in the file /etc/default/grub, look for the parameter GRUB_CMDLINE_LINUX which should be a list of parameters separated by spaces, and add the mentionned parameter). If you want the IO scheduler to be specific to your SD Card, look for the corresponding mmc* block device and set it during boot using your init system. E.g. echo "deadline" > /sys/block/mmcblk0/queue/scheduler (which is btw the default value on my Raspberry Pi running Raspbian for my Micro SD Card)
Selecting IO scheduler on external drives
1,435,702,788,000
I have enabled CONFIG_CMD_TFTPPUT in U-Boot, but I am not able to use it. I have set the serverip and ipaddr environment variables. When I use it as follows, it times out: u-boot# tftpput link up on port 0, speed 100, full duplex Using cpsw device TFTP to server 192.168.1.3; our IP address is 192.168.1.106 Filename 'uImage'. Save address: 0x0 Save size: 0x0 Saving: ##T ###T #### If I set the bootfile name to temp, it gives the following error: u-boot# tftpput link up on port 0, speed 100, full duplex Using cpsw device TFTP to server 192.168.1.3; our IP address is 192.168.1.106 Filename 'temp'. Save address: 0x0 Save size: 0x0 Saving: * TFTP error: 'Access violation' (2) Not retrying... Wireshark capture: Any help/pointers/suggestion?
As "wmill' rightly commented in his answer that most tftp servers will write to file only if it exists. In my case also it was the same problem. tftpput from u-boot works fine. I installed tftpd-hpa and configured it as follows to create a file. edit /etc/default/tftpd-hpa as follows, # /etc/default/tftpd-hpa TFTP_USERNAME="root" TFTP_DIRECTORY="/home/ankur/tftpboot" TFTP_ADDRESS="0.0.0.0:69" TFTP_OPTIONS="-c --secure" And then tftp configuration in /etc/xinet.d/tftp should be as follows, service tftp { protocol = udp port = 69 socket_type = dgram wait = yes user = root server = /usr/sbin/in.tftpd server_args = -c -s /home/ankur/tftpboot disable = no } Withe above configuration when i ran command tftpput 0x80200000 0x500000 192.168.1.3:uImage I am able to send file to host PC.
tftpput in U-Boot: error: 'Access violation' (2)
1,435,702,788,000
Suppose a process, among other things, is posting https requests, for example with curl. Assuming I have root privileges, is there a way to intercept such requests and respond with an http error or, even better with acknowledgment? I am using an embedded device, so I have limited access to software libraries.
What you are asking for is called a proxy http server. The software receives http requests and passes them on or rejects them (logging too) It needn't sit on your embeded device, however your device would need to be configured to access the proxy instead of going directly to the internet. apache nginx are two examples of web servers that can act as proxy servers. squid is a sophisticated proxy server which can handle many protocols. charles is another, but paid for program (although there is a free trial period). If you need to ensure that all requests are via the proxy then you would also want to set up your network to prevent direct requests from the device going directly to the internet. (you can't do that if your device hosts the proxy).
catch http requests from another process
1,435,702,788,000
I have two PC Engines Alix 2d2 which I've been given and I'm trying to install an (BSD or Linux based) OS on. Currently one has a version of openWRT (the other had openWRT until I formatted the CF card and put on a version of FreeDOS (I don't know if this works because no console)). Both boards were in working order before I began, allbeit working as openWRT systems. I did not test either of their serial ports before I started (although i have changed nothing about the second system so...) In addition to the alix boards I have: a Windows desktop without a built in serial port a USB to serial adapter which I have been using with the Windows desktop a Linux box which has a serial port on the motherboard one serial cable (Startech branded, described as straight through) I have connected each alix board to both computers 1 at a time trying to get, well, anything to come though the serial connection. I've read several articles and how-tos on the internet about the alix boards noting that the speeds mentioned either seem to be 9600 or 38400 so I've tried both. On Windows I was using PuTTY's serial mode to connect (I double checked which com port I was using) and on Linux I was using minicom with the -D 9600/38400 -p /dev/ttyS0 (I also have ttyS1-3 but minicom would not connect to them). I'm at a loss as to what I should try next.
You need a null modem cable (or a null modem adapter attached to your serial cable) if both ends of the connection are implementing the DTE side of the RS-232 protocol. Typically computers are DTE and peripherals like modems are DCE. Your embedded board is halfway is kind of a hybrid (runs OSes that also run on PCs, but intended for use as a peripheral possibly) so it's hard to be sure what kind of serial port they'd put on it. The gender of the connectors would be a strong indicator. If you had to use a gender-changing adapter to get your cable plugged in, chances are good that what you really needed was a null modem. DCE ports are usually female, and DTE ports are usually male, so a straight-through cable will have one of each connector and a null-modem cable will have 2 female ends. If RJ-45 connectors are involved, things get tougher. There are more cable configurations to choose from, and gender is no longer a guide.
Using serial console and trying to log into embedded system
1,435,702,788,000
I got an embedded device with RPM on (no Yum). The way I install packages now is by downloading the proper .rpm file from rpmfind.net and running rpm -i package.rpm. This process repeats for every missing library until the program finally runs. There must be a better way to do it. Can I automatically solve the dependencies on my desktop computer, copy .rpm files on the embedded device and install everything with a command like rpm -i *?
You may want to try new project MicroDNF https://github.com/rpm-software-management/microdnf This is just small binary and will resolve the dependecies and install them.
Installing rpm packages and resolving dependencies on an embedded device
1,435,702,788,000
On some embedded linux systems, there is no /etc/passwd file and /etc directory is not writable (which means I cannot set user account and password?). Then what is my (default) account name and password, or how to set account and password? I need to get account and password on embedded linux to run ssh server, which requires user account and password for ssh login.
If there is no /etc/passwd, then your embedded system is not running what is usually known as the Linux system, but rather a different operating system which is also based on the Linux kernel. A famous example of an operating system which uses on the Linux kernel but is not Linux is Android. Android doesn't have user accounts (at least not in its basic usage) and repurposes users to isolate applications rather than accounts. Such embedded systems are generally not meant to have user accounts. They have at most a control console, which is solely intended for administration and allows running commands as root. There may be authentication in some form, or the fact that you have physical access may be considered sufficient authentication. There's no general rule there, you have to know (or find out) how your system is designed. If you want to connect with SSH, you'll have to supply credentials to the SSH servers.
How to check my account on embedded linux without "/etc/passwd"?
1,435,702,788,000
I'm testing a CDMA modem on my Debian embedded Linux system. I'm doing some wgets of large files and am seeing the connection drop now and then. Looking at the ifconfig output for the PPP interface I see the count for errors seems to be pretty high (353 errors). Is there any easy way of determining what those errors actually are? ppp0 Link encap:Point-to-Point Protocol inet addr:166.248.251.38 P-t-P:66.174.217.80 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 RX packets:6490 errors:353 dropped:0 overruns:0 frame:0 TX packets:5901 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:3 RX bytes:7712851 (7.3 MiB) TX bytes:568635 (555.3 KiB)
I believe you can use Wireshark to determine why these packets are being retransmitted. Excerpted from this thread in the Wireshark forum, titled: Wireshark-users: Re: [Wireshark-users] tcp errors detection. excerpt #1 On Sun, Apr 18, 2010 at 4:17 PM, Victor lyamtsev wrote: Hi, how can i locate retransmission error for TCP sequence in wireshark capture ? Should I look for ACK with repeated sequence number ? For example: [ACK] Seq = 1355 Ack = 13409 ... [ACK] Seq = 1355 Ack = 13500 How can i detect checksum errors from the capture ? Thanks, -vvv excerpt #2 Also just go to the menu item Analyze>Expert Info. Click on a, for example, Retransmission row inside the Expert Infos box and it will take you to the exact location within the pcap. On 4/18/10, Abhik Sarkar <sarkar.abhik@xxxxxxxxx> wrote: > Hi Victor, > > Have a look at this page: http://www.wireshark.org/docs/dfref/t/tcp.html > > You can use display filter on the following fields: > tcp.analysis.retransmission > tcp.analysis.fast_retransmission > tcp.checksum_bad > > For TCP checksums, please also refer to this page: > http://wiki.wireshark.org/TCP_Checksum_Verification > For retransmissions, also refer to this page: > http://wiki.wireshark.org/PacketLoss > > HTH > Abhik. > > On Sun, Apr 18, 2010 at 4:17 PM, Victor lyamtsev <vlyamtsev@xxxxxxxxx>wrote: > >> Hi, >> >> how can i locate retransmission error for TCP sequence in wireshark >> capture ? >> Should I look for ACK with repeated sequence number ? >> For example: >> >> [ACK] Seq = 1355 Ack = 13409 ... >> [ACK] Seq = 1355 Ack = 13500 >> >> How can i detect checksum errors from the capture ? >> >> Thanks, >> -vvv The key resources from that thread: TCP checksums retransmissions You'll want to go under "Expert Info" under the Analyze pulldown, from there if you're capturing packets, you should see several re-transmissions when that'll correlate to your errors.
High RX packet error count with modem - how to analyze?
1,392,205,979,000
I recently attended an embedded Linux course that stated that uClibc does not support the use of pthreads and that it only supports linuxthreads. Furthermore, the course instructor implied that linuxthreads were next to useless. However, when reading a number of online articles, the implication is that they are in fact supported. Furthermore, when building a root file system and kernel image for a target embedded device using buildroot, I can see that I have libpthread-0.9.33.2.so and libpthread.so.0 files in the /lib directory of my target root file system. I am really confused about the nature of the conflicting information I have received and would be very grateful if anyone could actually clarify the situation for me.
Starting with version 0.9.32 (released 8 june 2011), uClibc is supporting NPTL for the following architectures: arm, i386, mips, powerpc, sh, sh64, x86_64. Actually, both are an implementation of pthreads and will provide libpthread.so.
Does uClibc support using pthreads?
1,392,205,979,000
I have a D-Link DI-624 rev. D2 Router. It is based around an Atheros AR2316A-001 chipset, and has 8MB RAM. I opened the device to check for actual parts use in it, and I can confirm, it is indeed the AR2316A-001 chipset with PSC A2V64S40CTP (8MB RAM). I couldn't locate the flash chip, the original firmware is 1MB in size, I don't know if anything larger can be loaded onto the device. I was wondering, If I could load OpenWrt on it, so I compiled OpenWrt with the AR231x chipset as Target. Now, the compile process yielded those squashfs images: openwrt-atheros-np25g-squashfs.bin openwrt-atheros-ubnt2-pico2-squashfs.bin openwrt-atheros-ubnt2-squashfs.bin openwrt-atheros-ubnt5-squashfs.bin openwrt-atheros-wpe53g-squashfs.bin All those files are around 2.4MB to 2.5MB in size, which is far more, than the firmware available from D-Link (di624revD_firmware_404.bin is around 1MB). I was wondering which file I should try to upload if any. On the DD-WRT page for supported devices this router is listed, revision C, which uses the same chipset. The DI-624 has an interesting emergency feature comparable to other D-Link products, like the DIR-600: When holding down the reset button while connecting power to the device, the router goes into an emergency restore mode. Then, when going to 192.168.0.1 with a browser, you can upload another firmware, no matter how badly bricked the router is. In case anyone succeeded with flashing an alternative OS onto a DI-624, I'd very much like to know how. There was some guy at the OpenWrt forums that claimed he could boot Linux on the DI-624, but he didn't really explain how he did it. I wasn't sure whether this question belongs here or electronics.SE
Until you determine, what type and size of Flash ROM is used in the device, you should not risk flashing it with anything other than dedicated firmware. Atheros chipsets are very common across a wide range of wireless devices and the sole fact of using a particular chip does not guarantee that the entire device will work correctly with your firmware. The chipset is like a coputer CPU + some peripherals, but not necessarily all. And the system storage must be supported. Edit: If you'd read carefully, you'd see that the page you linked to presents a list of incompatible devices. Since DI-624 is listed there, it is definitely not supported by dd-wrt. This makes it almost certain, that your custom OpenWrt image would not work either.
D-Link DI-624 H/W ver. D: Flashing OpenWrt
1,392,205,979,000
I am developing an embedded Linux system. The system is usually installed by creating a ISO file which is written to a USB stick the board can boot from. To make the installation possible to do automatically (say, over night) I would like to be able to do the installation on the board while the old system is running. My installation has two parts: An initrd file which contains busybox and install scripts, and a .tar.gz archive that has the rest of the root file system to install. The bootloader loads the kernel and points it to the initrd, and boots the kernel. The initrd install scripts mounts the target drive /dev/sda, formats it, installs the bootloader, and finally copies the root file system from .tar.gz and initrd. Now I instead want to Copy install.iso from host computer to target device. (No problem) Do the installation steps as above. My problem is that I don't know how I should go about replacing the currently running system with my new one. I assume that the currently mounted root (/) would have to be unmounted and replaced by the initrd. But I can't seem to figure out how!
I can think of different ways to do what you want. All of which carry a level of risk and difficulty. The main risk being that if the install goes wrong/breaks you will end up with an unbootable system that needs installing manually. My main thought (which depends on your boot loader and similar) would be to use exactly the procedure that you have now. Basically copy the new install image onto your USB stick which is permanently left in the machine. Then just reboot and let it boot from that and install normally. It relies on the following Hands-off install. I'm assuming that you have that otherwise an overnight reinstall would not be a problem. Your boot loader being able to choose between USB or local filesystem boot automatically (or via an application level command before rebooting) At the end you need to configure your boot loader to boot from the local board rather than the USB device or just erase the contents of the USB device/make it unbootable so that the bootloader falls over An alternative to that would be to have two boot/root partitions on your board and just install into the one that you aren't using and at the end of the reboot force your bootloader to boot into the other. You could use a chroot environment to force your installer to think that it was booting from scratch. That is probably a big change in your environment though and would not be a quick win.
Swap root at runtime
1,392,205,979,000
I am currently working on an embedded board with a WM8776 which uses the MCASP1 of the AM335x. This works as expected and has expected behaviour. What I now want to do is make a driver which can switch frequencies. I have two clocks which go in into the MCASP via a clock mux via a GPIO. If this GPIO is high I have an 24,576 clock, for 32/48/64/96/196, and so on audio and a 11,960 clock for 44.1/88.2/174 and so on audio. My goal is now to be able to change this clock in kernel space. What I did so far was put some code to print out the current sample rate. Which went OK. I saw the sample rate which was currently transponded. However, when I disabled the resampling of ALSA in .asoundrc I got the following error when trying to play a 96khz song one the 44.1khz (11,960mhz) clock. alsa_open:303 unable to get period size: Invalid argument This of course is logical since there is not Integer which can achieve this perfect bitrate without resampling on this clock. The problem with this is the earlier mentioned print comment I put in the kernel did not anymore put any information about the current bitrate. So it did not reach this function, as I think ALSA already did catch this. So, I tried to trace where this error was coming from so I could program the kernel to say: we are playing this bitrate, so we want to change to this clock when we are using this specific soundcard, whenever changing a song. But I could not find this error anywhere when spitting through the kernel sound code. In short the use case is as followed: Start-up frequency is 11.960Mhz. -> we now are playing a 44.1 Khz song. -> Changing to 96Khz song -> Put GPIO high (clock now at 24,512Mhz) -> Inform ALSA and MCASP clock has changed. I know how to change MCASP from kernel space. So my question now is: What is the first function called whenever a new playback is started(e.g. a song is changed)? Where can I find the origin of this error? And is there a better approach to do what I want to.
Ok two things: between the application playing back a stream of PCM samples and the kernel side of ALSA, there's the userland alsalib with its optional internal resampling. If the application did not disable that but requested a device as is, the kernel had no way of knowing what the original sapling rate was. It's simply not visible to the kernel in any way. This is doubly true if the application doesn't use ALSA as pure hardware interface, but uses a userland soundserver like Pulseaudio, pipe wire, esound or JACK, which might also offer userland-implemented ALSA devices, and do the mixing/resampling internally. This is the norm for modern Linux desktops. If the application wants the hardware to sample at a specific rate, it will call snd_pcm_hw_patams from alsalib, which will do the necessary syscalls to tell your kernel driver what rate was requested. Write a minimal program that does nothing but that and strace that to see which these were! Generally, since it's pretty common that multiple streams of potentially different rates are to be played back at the same time, it feels natural that most applications would not try to fiddle with the hardware parameters themselves - they request a correctly set up device, and that will usually include resampling-in-userland being opted in.
Change clock bitrate (ALSA, PCM) at runtime AM335x
1,392,205,979,000
I have a custom embedded linux board with a lan7500i-ABZJ connected over USB. So I compiled the linux kernel (using buildroot) with the smsc75xx module built in. The startup kernel messages indeed show: [ 5.315124] usb 1-1: New USB device found, idVendor=0424, idProduct=7500, bcdDevice= 2.00 [ 5.324072] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 5.340746] smsc75xx v1.0.0 [ 5.539195] smsc75xx 1-1:1.0 eth1: register 'smsc75xx' at usb-ci_hdrc.0-1, smsc75xx USB 2.0 Gigabit Ethernet, 8e:64:f6:eb:5e:65 Now I add an IP address: ifconfig eth1 192.168.1.44 netmask 255.255.255.0 up But once I try to ping an address on the local network, all packets are lost: # ping 192.168.1.40 PING 192.168.1.40 (192.168.1.40): 56 data bytes ^C --- 192.168.1.40 ping statistics --- 3 packets transmitted, 0 packets received, 100% packet loss # arp ? (192.168.1.40) at <incomplete> on eth1 And no packages are transmitted over the interface: eth1 Link encap:Ethernet HWaddr 8E:64:F6:EB:5E:65 inet addr:192.168.1.44 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) No other network interfaces are active. A ping to localhost works, so I assume everything is OK on TCP/IP level. Why can't I use my ethernet interface?
ifconfig (or here probably busybox ifconfig) displays RUNNING in addition to UP for a NIC which is both administratively UP and has detected a carrier (ie: a remote NIC, switch etc.). The lack of RUNNING means the NIC is not connected or couldn't be set in such a way as to properly detect the NIC on the other side of the wire. ip link (or busybox ip link), which on Linux should always be preferred (along with ip address) over ifconfig, would have displayed the unmistakable NO-CARRIER flag in this case. So you'll have to check why there is no carrier. Usually the ethtool command comes in handy here, to see if auto negotiation failed, or must not be used etc. If not already present, you should add it to the build.
USB to ethernet: fail to transmit any packages
1,392,205,979,000
From my understanding, in systems without bus support for discovery/enumeration (mostly embedded systems), the dtb files are used to describe the hardware and allow the kernel to use it once it has been loaded into to memory. So, assuming we just want to update the kernel for such a system, do we need to also update the dtb? Since it only describes the hardware and the hardware is unchanged, couldn't it be simply reused? I came to this question while installing a newer kernel in my raspberrypi, the official build documentation and also every other tutorial I could find makes an explicit mention about compiling and copying the dtb files, so I was wondering if this step is really necessary since the hardware wont change.
Mainly, kernel and device tree are supposed to be independent from each other, so yes: Usually you can use a freshly compiled kernel along with the old dtb and vice versa. Of course, this stops being true if the device tree relies on certain versions of device drivers or the new kernel expects different device tree attributes. Now considering that building a new dtb with dtc is a question of milliseconds and authors of tutorials do not know whether some patch did change any dts or dtsi file, it's saver to recommend including building and deploying the dtb along with the kernel.
with a static hardware, do I need to recompile the dtb every time I update the kernel?
1,392,205,979,000
I plan to run an Electron app on my UDOO Neo i.MX6 board with the official st1232 7'' touchscreen kit for UDOO Neo. I created a custom Linux distro with Poky (thud branch) to be able to build a "ready to boot" image. I enabled the "x11-base" image feature to have all the Xorg packages and I have the meta-freescale layer that provides patches in order to have a fully compatible distro with the hardware (Vivante). However, at the end of the boot process, I get a seg fault error message from xinit. Here is my /etc/X11/xorg.conf file: Section "Device" Identifier "i.MX Accelerated Framebuffer Device" Driver "vivante" Option "fbdev" "/dev/fb0" Option "vivante_fbdev" "/dev/fb0" Option "HWcursor" "false" Option "DisplayEngine" "pxp" EndSection Section "ServerFlags" Option "BlankTime" "0" Option "StandbyTime" "0" Option "SuspendTime" "0" Option "OffTime" "0" EndSection Section "InputClass" Identifier "Touchscreen" MatchProduct "st1232-touchscreen" Driver "evdev" Option "Calibration" "3 794 476 0" EndSection It's added by the meta-freescale layer and I've appended the st1232 touchscreen InputClass manually. The output of the /var/log/Xorg.0.log file: X.Org X Server 1.20.1 X Protocol Version 11, Revision 0 [ 63.243] Build Operating System: Linux 4.15.0-72-generic x86_64 [ 63.244] Current Operating System: Linux 4.1.15+2.0.x-udoo+g34f88fa2766c #1 SMP PREEMPT Mon Jan 6 14:51:20 UTC 2020 armv7l [ 63.244] Kernel command line: console=ttymxc0,115200,115200 root=/dev/mmcblk0p1 rootwait rw rootfstype=ext4 uart_from_osc clk_ignore_unused cpuidle.off=1 consoleblank=0 [ 63.257] Build Date: 07 January 2020 10:34:32AM [ 63.257] [ 63.258] Current version of pixman: 0.34.0 [ 63.258] Before reporting problems, check http://wiki.x.org to make sure that you have the latest version. [ 63.258] Markers: (--) probed, (**) from config file, (==) default setting, (++) from command line, (!!) notice, (II) informational, (WW) warning, (EE) error, (NI) not implemented, (??) unknown. [ 63.260] (==) Log file: "/var/log/Xorg.0.log", Time: Tue Jan 7 11:51:16 2020 [ 63.288] (==) Using config file: "/etc/X11/xorg.conf" [ 63.288] (==) Using system config directory "/usr/share/X11/xorg.conf.d" [ 63.297] (==) No Layout section. Using the first Screen section. [ 63.297] (==) No screen section available. Using defaults. [ 63.297] (**) |-->Screen "Default Screen Section" (0) [ 63.297] (**) | |-->Monitor "<default monitor>" [ 63.298] (==) No device specified for screen "Default Screen Section". Using the first device section listed. [ 63.298] (**) | |-->Device "i.MX Accelerated Framebuffer Device" [ 63.298] (==) No monitor specified for screen "Default Screen Section". Using a default monitor configuration. [ 63.298] (**) Option "BlankTime" "0" [ 63.298] (**) Option "StandbyTime" "0" [ 63.298] (**) Option "SuspendTime" "0" [ 63.298] (**) Option "OffTime" "0" [ 63.298] (==) Automatically adding devices [ 63.298] (==) Automatically enabling devices [ 63.298] (==) Automatically adding GPU devices [ 63.298] (==) Max clients allowed: 256, resource mask: 0x1fffff [ 63.299] (WW) The directory "/usr/share/fonts/X11/misc/" does not exist. [ 63.299] Entry deleted from font path. [ 63.299] (WW) The directory "/usr/share/fonts/X11/TTF/" does not exist. [ 63.299] Entry deleted from font path. [ 63.299] (WW) The directory "/usr/share/fonts/X11/OTF/" does not exist. [ 63.299] Entry deleted from font path. [ 63.299] (WW) The directory "/usr/share/fonts/X11/Type1/" does not exist. [ 63.299] Entry deleted from font path. [ 63.299] (WW) The directory "/usr/share/fonts/X11/100dpi/" does not exist. [ 63.299] Entry deleted from font path. [ 63.299] (WW) The directory "/usr/share/fonts/X11/75dpi/" does not exist. [ 63.299] Entry deleted from font path. [ 63.299] (==) FontPath set to: [ 63.299] (==) ModulePath set to "/usr/lib/xorg/modules" [ 63.299] (II) The server relies on udev to provide the list of input devices. If no devices become available, reconfigure udev or disable AutoAddDevices. [ 63.299] (II) Loader magic: 0x54cd6d78 [ 63.300] (II) Module ABI versions: [ 63.300] X.Org ANSI C Emulation: 0.4 [ 63.300] X.Org Video Driver: 24.0 [ 63.300] X.Org XInput driver : 24.1 [ 63.300] X.Org Server Extension : 10.0 [ 63.301] (II) xfree86: Adding drm device (/dev/dri/card0) [ 63.301] (II) no primary bus or device found [ 63.301] falling back to /sys/devices/platform/Vivante GCCore/drm/card0 [ 63.301] (II) LoadModule: "glx" [ 63.326] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so [ 63.463] (II) Module glx: vendor="X.Org Foundation" [ 63.463] compiled for 1.20.1, module version = 1.0.0 [ 63.463] ABI class: X.Org Server Extension, version 10.0 [ 63.463] (II) LoadModule: "vivante" [ 63.467] (II) Loading /usr/lib/xorg/modules/drivers/vivante_drv.so [ 63.478] (II) Module vivante: vendor="X.Org Foundation" [ 63.478] compiled for 1.20.1, module version = 1.0.0 [ 63.478] ABI class: X.Org Video Driver, version 24.0 [ 63.478] (II) VIVANTE: fb driver for vivante: VivanteGC500, VivanteGC2100, VivanteGCCORE [ 63.479] (--) using VT number 1 [ 63.482] (WW) Falling back to old probe method for vivante [ 63.482] (II) Loading sub module "fbdevhw" [ 63.482] (II) LoadModule: "fbdevhw" [ 63.482] (II) Loading /usr/lib/xorg/modules/libfbdevhw.so [ 63.484] (II) Module fbdevhw: vendor="X.Org Foundation" [ 63.484] compiled for 1.20.1, module version = 0.0.2 [ 63.484] ABI class: X.Org Video Driver, version 24.0 [ 63.484] (II) VIVANTE(0): using default device [ 63.484] (WW) VGA arbiter: cannot open kernel arbiter, no multi-card support [ 63.485] (WW) VIVANTE(0): Cannot get device preferred mode '/sys/class/graphics/fb0/mode (Not a directory)' [ 63.485] (II) VIVANTE(0): Creating default Display subsection in Screen section "Default Screen Section" for depth/fbbpp 16/16 [ 63.485] (==) VIVANTE(0): Depth 16, (==) framebuffer bpp 16 [ 63.485] (==) VIVANTE(0): RGB weight 565 [ 63.485] (==) VIVANTE(0): Default visual is TrueColor [ 63.485] (==) VIVANTE(0): Using gamma correction (1.0, 1.0, 1.0) [ 63.485] (DB) xf86MergeOutputClassOptions unsupported bus type 0 [ 63.485] (**) VIVANTE(0): mExaHwType:1 [ 63.485] (II) VIVANTE(0): checking modes against framebuffer device... [ 63.485] (II) VIVANTE(0): checking modes against monitor... [ 63.485] (II) VIVANTE(0): Virtual size is 0x0 (pitch 0) [ 63.485] (==) VIVANTE(0): DPI set to (96, 96) [ 63.485] (II) Loading sub module "fb" [ 63.485] (II) LoadModule: "fb" [ 63.485] (II) Loading /usr/lib/xorg/modules/libfb.so [ 63.493] (II) Module fb: vendor="X.Org Foundation" [ 63.493] compiled for 1.20.1, module version = 1.0.0 [ 63.493] ABI class: X.Org ANSI C Emulation, version 0.4 [ 63.493] (II) Loading sub module "exa" [ 63.493] (II) LoadModule: "exa" [ 63.495] (II) Loading /usr/lib/xorg/modules/libexa.so [ 63.499] (II) Module exa: vendor="X.Org Foundation" [ 63.499] compiled for 1.20.1, module version = 2.6.0 [ 63.499] ABI class: X.Org Video Driver, version 24.0 [ 63.500] (II) VIVANTE(0): printing discovered frame buffer 'fb0' supported modes: [ 63.501] (II) VIVANTE(0): Modeline "U:800x480p-60"x0.0 33.66 800 850 1000 1056 480 500 502 525 -hsync -vsync -csync (31.9 kHz e) [ 63.501] (II) VIVANTE(0): Output mxs-lcdif1 has no monitor section [ 63.501] (II) VIVANTE(0): Printing probed modes for output mxs-lcdif1 [ 63.501] (II) VIVANTE(0): Modeline "U:800x480p-60"x60.7 33.66 800 850 1000 1056 480 500 502 525 -hsync -vsync -csync (31.9 kHz e) [ 63.501] (II) VIVANTE(0): Output mxs-lcdif1 connected [ 63.502] (II) VIVANTE(0): Using sloppy heuristic for initial modes [ 63.502] (II) VIVANTE(0): Output mxs-lcdif1 using initial mode U:800x480p-60 +0+0 [ 63.502] (II) VIVANTE(0): imxDisplayPreInit: virtual set 800 x 480, display width 0 [ 63.502] (II) VIVANTE(0): VivPreInit: adjust display width 800 [ 63.502] (II) VIVANTE(0): reserve 4177920 bytes for on screen frame buffer; total fb memory size 33554432 bytes; offset of shadow buffer 4177920 [ 63.504] (II) VIVANTE(0): hardware: mxs-lcdif1 (video memory: 32768kB) [ 63.512] (II) VIVANTE(0): FB Start = 0x7458d000 FB Base = 0x7458d000 FB Offset = (nil) [ 63.513] (II) VIVANTE(0): test Initializing EXA [ 63.817] (II) EXA(0): Driver allocated offscreen pixmaps [ 63.817] (II) EXA(0): Driver registered support for the following operations: [ 63.817] (II) Solid [ 63.817] (II) Copy [ 63.817] (II) Composite (RENDER acceleration) [ 63.817] (II) UploadToScreen [ 63.817] (==) VIVANTE(0): Backing store enabled [ 63.818] (==) VIVANTE(0): DPMS enabled [ 63.820] drmOpenDevice: node name is /dev/dri/card0 [ 63.821] drmOpenDevice: open result is 11, (OK) [ 63.821] drmOpenDevice: node name is /dev/dri/card0 [ 63.821] drmOpenDevice: open result is 11, (OK) [ 63.821] drmOpenByBusid: Searching for BusID platform:Vivante GCCore:00 [ 63.821] drmOpenDevice: node name is /dev/dri/card0 [ 63.821] drmOpenDevice: open result is 11, (OK) [ 63.821] drmOpenByBusid: drmOpenMinor returns 11 [ 63.821] drmOpenByBusid: drmGetBusid reports platform:Vivante GCCore:00 [ 63.821] (II) [drm] DRM interface version 1.4 [ 63.821] (II) [drm] DRM open master succeeded. [ 63.821] (II) VIVANTE(0): [drm] Using the DRM lock SAREA also for drawables. [ 63.821] (II) VIVANTE(0): [drm] framebuffer handle = 0xac100000 [ 63.821] (II) VIVANTE(0): [drm] added 1 reserved context for kernel [ 63.821] (II) VIVANTE(0): X context handle = 0x1 [ 63.821] (EE) VIVANTE(0): [drm] failed to setup DRM signal handler [ 63.821] (EE) VIVANTE(0): [dri] DRIScreenInit failed. Disabling DRI. [ 63.822] (II) Initializing extension Generic Event Extension [ 63.822] (II) Initializing extension SHAPE [ 63.822] (II) Initializing extension MIT-SHM [ 63.822] (II) Initializing extension XInputExtension [ 63.825] (II) Initializing extension XTEST [ 63.825] (II) Initializing extension BIG-REQUESTS [ 63.825] (II) Initializing extension SYNC [ 63.825] (II) Initializing extension XKEYBOARD [ 63.825] (II) Initializing extension XC-MISC [ 63.825] (II) Initializing extension XFIXES [ 63.825] (II) Initializing extension RENDER [ 63.825] (II) Initializing extension RANDR [ 63.825] (II) Initializing extension COMPOSITE [ 63.825] (II) Initializing extension DAMAGE [ 63.825] (II) Initializing extension MIT-SCREEN-SAVER [ 63.825] (II) Initializing extension DOUBLE-BUFFER [ 63.825] (II) Initializing extension DPMS [ 63.825] (II) Initializing extension Present [ 63.825] (II) Initializing extension DRI3 [ 63.825] (II) Initializing extension X-Resource [ 63.826] (II) Initializing extension XVideo [ 63.826] (II) Initializing extension XVideo-MotionCompensation [ 63.826] (II) Initializing extension GLX [ 63.826] (II) AIGLX: Screen 0 is not DRI2 capable [ 63.974] (II) IGLX: Loaded and initialized swrast [ 63.974] (II) GLX: Initialized DRISWRAST GL provider for screen 0 [ 63.974] (II) Initializing extension XFree86-VidModeExtension [ 63.974] (II) Initializing extension XFree86-DGA [ 63.974] (II) Initializing extension XFree86-DRI [ 63.974] (II) Initializing extension DRI2 [ 63.974] (II) Initializing extension vivext [ 63.974] (II) VIVANTE(0): Setting screen physical size to 211 x 127 [ 64.295] (II) config/udev: Adding input device 20cc000.snvs:snvs-powerkey (/dev/input/event0) [ 64.295] (**) 20cc000.snvs:snvs-powerkey: Applying InputClass "evdev keyboard catchall" [ 64.296] (**) 20cc000.snvs:snvs-powerkey: Applying InputClass "libinput keyboard catchall" [ 64.296] (II) LoadModule: "libinput" [ 64.297] (II) Loading /usr/lib/xorg/modules/input/libinput_drv.so [ 64.323] (II) Module libinput: vendor="X.Org Foundation" [ 64.323] compiled for 1.20.1, module version = 0.28.0 [ 64.323] Module class: X.Org XInput Driver [ 64.323] ABI class: X.Org XInput driver, version 24.1 [ 64.323] (II) Using input driver 'libinput' for '20cc000.snvs:snvs-powerkey' [ 64.323] (**) 20cc000.snvs:snvs-powerkey: always reports core events [ 64.323] (**) Option "Device" "/dev/input/event0" [ 64.323] (**) Option "_source" "server/udev" [ 64.324] (II) event0 - 20cc000.snvs:snvs-powerkey: is tagged by udev as: Keyboard [ 64.324] (II) event0 - 20cc000.snvs:snvs-powerkey: device is a keyboard [ 64.325] (II) event0 - 20cc000.snvs:snvs-powerkey: device removed [ 64.360] (**) Option "config_info" "udev:/sys/devices/soc0/soc/2000000.aips-bus/20cc000.snvs/20cc000.snvs:snvs-powerkey/input/input0/event0" [ 64.360] (II) XINPUT: Adding extended input device "20cc000.snvs:snvs-powerkey" (type: KEYBOARD, id 6) [ 64.362] (II) event0 - 20cc000.snvs:snvs-powerkey: is tagged by udev as: Keyboard [ 64.362] (II) event0 - 20cc000.snvs:snvs-powerkey: device is a keyboard [ 64.365] (II) config/udev: Adding input device st1232-touchscreen (/dev/input/event1) [ 64.365] (**) st1232-touchscreen: Applying InputClass "Touchscreen" [ 64.365] (II) LoadModule: "evdev" [ 64.366] (II) Loading /usr/lib/xorg/modules/input/evdev_drv.so [ 64.372] (II) Module evdev: vendor="X.Org Foundation" [ 64.372] compiled for 1.20.1, module version = 2.10.6 [ 64.372] Module class: X.Org XInput Driver [ 64.372] ABI class: X.Org XInput driver, version 24.1 [ 64.372] (II) Using input driver 'evdev' for 'st1232-touchscreen' [ 64.372] (**) st1232-touchscreen: always reports core events [ 64.372] (**) evdev: st1232-touchscreen: Device: "/dev/input/event1" [ 64.373] (II) evdev: st1232-touchscreen: Using mtdev for this device [ 64.373] (--) evdev: st1232-touchscreen: Vendor 0 Product 0 [ 64.378] (--) evdev: st1232-touchscreen: Found absolute axes [ 64.378] (--) evdev: st1232-touchscreen: Found absolute multitouch axes [ 64.378] (II) evdev: st1232-touchscreen: No buttons found, faking one. [ 64.378] (II) evdev: st1232-touchscreen: Forcing relative x/y axes to exist. [ 64.379] (II) evdev: st1232-touchscreen: Configuring as mouse [ 64.379] (**) evdev: st1232-touchscreen: YAxisMapping: buttons 4 and 5 [ 64.379] (**) evdev: st1232-touchscreen: EmulateWheelButton: 4, EmulateWheelInertia: 10, EmulateWheelTimeout: 200 [ 64.379] (**) Option "config_info" "udev:/sys/devices/soc0/soc/2100000.aips-bus/21a0000.i2c/i2c-0/0-0055/input/input1/event1" [ 64.379] (II) XINPUT: Adding extended input device "st1232-touchscreen" (type: MOUSE, id 7) [ 64.379] (II) evdev: st1232-touchscreen: initialized for relative axes. [ 64.379] (WW) evdev: st1232-touchscreen: ignoring absolute axes. [ 64.381] (**) st1232-touchscreen: (accel) keeping acceleration scheme 1 [ 64.381] (**) st1232-touchscreen: (accel) acceleration profile 0 [ 64.381] (**) st1232-touchscreen: (accel) acceleration factor: 2.000 [ 64.381] (**) st1232-touchscreen: (accel) acceleration threshold: 4 [ 64.384] (II) config/udev: Adding input device FreescaleGyroscope (/dev/input/event2) [ 64.384] (II) No input driver specified, ignoring this device. [ 64.384] (II) This device may have been added with another device file. [ 64.385] (II) config/udev: Adding input device FreescaleAccelerometer (/dev/input/event3) [ 64.385] (II) No input driver specified, ignoring this device. [ 64.385] (II) This device may have been added with another device file. [ 64.386] (II) config/udev: Adding input device FreescaleMagnetometer (/dev/input/event4) [ 64.386] (II) No input driver specified, ignoring this device. [ 64.386] (II) This device may have been added with another device file. [ 64.431] (EE) [ 64.432] (EE) Backtrace: [ 64.432] (EE) [ 64.433] (EE) Segmentation fault at address 0x4 [ 64.434] (EE) Fatal server error: [ 64.440] (EE) Caught signal 11 (Segmentation fault). Server aborting [ 64.440] (EE) [ 64.441] (EE) Please consult the The X.Org Foundation support at http://wiki.x.org for help. [ 64.442] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information. [ 64.442] (EE) [ 64.447] (EE) Server terminated with error (1). Closing log file. Is my Xorg configration right? What's important in order to make Xorg work? I've heard about export DISPLAY=:0 a lot but running it doesn't solve my problem.
I simply added this patch to my layer and now it works.
How to configure X11 for embedded i.MX6 board with touchscreen?
1,392,205,979,000
I'm using busybox in an embedded device. The built-in busybox is rather limited. So I want try to replace busybox in place with new, more complete version. I find some info about replacing Busybox on device use serial communication and command line, this also requireds to a http server on LAN. The part of commands route add -net 192.168.15.0/24 eth0 mount -t tmpfs -o size=2M,mode=0755 tmpfs /mnt cd /mnt wget http://192.168.15.10/busybox-armv5l chmod +x busybox-armv5l Two points isn't clear here: new busybox does not replace the existing version, instead it's added into another location as an additional busybox? Second, the new busybox is placed into tmpfs in RAM: so its not saved permanently in the partition, and deleted after a reboot? Am I correct?
Yes - this method is suitable for embedded devices with tight resources and/or no writable filesystems (readonly or no free space). Grabbing additional binaries (not just busybox) into RAM is pretty much the only way to go if no write permissions anywhere (and you don't want to risk bricking by flashing the firmware itself). It's also a good way to test things out first. After all, this is in RAM only, so - reset power and everything should be back to normal. Less useful if you want the modification to be permanent and independent of network situation. this also requires to a http server on LAN This is mostly convenience... netcat works too, or telnet even (with some encoding quirks). But as long as wget is available, a quick http grab is easier.
Replacing busybox in an embedded device
1,392,205,979,000
I have an embedded device which runs linux(arm). I am trying to update the executable through ethernet using scp command. But I got to know that sshd is not running in the device . I need to install the ssh library in device. But I have only access to a serial port (debug) and ethernet.I have compiled ssh library using cross compiler toolchain but how can i install this on my device? Do I need to configure rfs again ?
Just copy the sshd to the embedded device with tftp. For e.g. at /usr/bin/sshd and execute it. Then try connecting to the embedded device.
SSH demon not installed in linux embedded device
1,392,205,979,000
I'm making a special "installer" for an embedded system where I'd like the kernel to boot up, execute a set of things very late in the process where the peripherals have been set up and then reboot the system without the login prompt ever happening. I'm vaguely familiar with init and runlevels, I presume at this point that this is how I'll most easily achieve this. Can I put a script (then where/how?) in the init sequence that runs my stuff and then puts the machine to a reboot afterwards ? If it matters the rootfs is debian.
For Debian 7 and earlier, the easiest option is to put your code in /etc/rc.local. This runs at the very end of the boot sequence, just before the login screen is displayed when you boot into console mode, or just before X is started otherwise. Until this script exits, nothing else happens, so if you reboot the system at the end, you may not see a login screen. If you do, it should disappear quickly. I specified the Debian version above because Debian will be moving from SysV init to systemd in the next major version. While it is likely that this future version of Debian will still allow rc.local and such for backwards compatibility, you'd really want to do it a different way for systemd. That's out of scope for this question, though. More broadly, embedded Linuxes don't have to follow the rules established by desktop Linuxes. Dedicated embedded Linux distros allow you to customize things like how the boot sequence works, specifically to cope with issues like the one you're facing.
Late running of scripts during bootup, ending with a reboot without the login prompt
1,392,205,979,000
Im using a private IP address and I want to keep alive SNAT entries in my Router (Gateway) for at least two hours (some windows apps of my network are using TCP keepalive set to 2 hours). Gateway is a Linux machine so i set nf_conntrack_tcp_timeout_established and nf_conntrack_generic_timeout values to 7400 seconds: echo 7400 > /proc/sys/net/netfilter/nf_conntrack_tcp_timeout_established echo 7400 > /proc/sys/net/netfilter/nf_conntrack_generic_timeout Now, when a TCP connection is stablished shortly after i can see the new value: # cat /proc/net/ip_conntrack tcp 6 7399 ESTABLISHED src=192.168.0.192 dst=108.168.176.194 sport=51826 dport=5222 src=108.168.176.194 dst=95.63.14.117 sport=5222 dport=51826 [ASSURED] use=1 But few seconds later i read the value again and now the value has returned to 60 seconds: tcp 6 39 ESTABLISHED src=192.168.0.192 dst=108.168.176.194 sport=51826 dport=5222 src=108.168.176.194 dst=95.63.14.117 sport=5222 dport=51826 [ASSURED] use=1
The root cause was that the conntrack code in the kernel has been modified. As we are using a embedded linux distribution modified by our provider, the function that refresh the timeout for the SNAT entry was pointing to a special function used for provide one of the our provider new 'features'. I have fixed it and now it is working as expected.
Conntrack TCP Timeout for state stablished not working
1,392,205,979,000
I'm installing a Angstrom (custom build, not the default build) on a Beagleboard XM. I can scan for wireless networks using iwlist and see the neighborhood wireless devices. I have set my SSID and Key (a 10-digit hex code using lowercase) in /etc/network/interfaces When I do a ifup wlan0, it goes through the process of DHCPDISCOVER and then says No DHCPOFFERS received. The device is an Alfa USB with a Realtek rtl8187 chipset. (which works fine when used under Debian on my laptop). Why isn't my SSID displayed properly under iwconfig, and why won't the interface get an IP via DHCP?
Thanks to @slm for sending me to the how-to reference. It appears the biggest issue was that NetworkManager was running and because I have no GUI (the BeagleBoard version of nmcli does not have the "connect" feature allowing for the creating of new interfaces on the command-line, and I am only connecting to the beagleboard via a serial port (no GUI)) I had no means to setup new connections. Further, NetworkManager may have been killing connections which I was finally able to see proof of in /var/log/syslog. So the solution was to prevent NetworkManager from running and run and setup manually the necessary configuration for wpa_supplicant. With wpa_supplicant running and NetworkManager not running (and bringing the interface up/down several times) I was finally able to get a DHCP assigned, and the Internet is now reachable through a wireless connection on the Beagleboard. I'll have to continue to fiddle and experiment to ensure this connection comes up smoothly at boot-time (and to ensure that the Ethernet port will continue to work) but at least I've overcome the immediate road-block.
Why is my wlan0 interface on Angstrom (Beagleboard) "Not Associated"?
1,392,205,979,000
I have an alix board on which I have installed debian4alix (sqeeze). After using it for a while I noticed that the write performance of the board was pretty low. I ran the following test: dd count=100 bs=1M if=/dev/urandom of=/var/www/cgrid/test This yielded the following: 100+0 records in 100+0 records out 104857600 bytes (105 MB) copied, 328.903 s, 319 kB/s This is the same speed I get when running the test on the compact flash card that the OS is installed on or on a flash disk. I had tested the flash disk performance on a linux desktop PC and achieved speeds around 15.3 MB/s using the same tests. My read speed on the alix board is around 9MB/s (tested with hdparm -t) I would like to know if the slow write speeds I am receiving is a result of the operating system ( since it is not running directly off the compact flash card but off a ramdisk) or from the embedded hardware solution being really slow.
I am quite certain the board is slower then desktop in terms hardware. But urandom make it worse. The board is using a 500MHz CPU vs 2-3GHz desktop CPU. With if=/dev/urandom, your test is more about how fast the system can handle urandom. You are comparing CPU performance, not I/O. Additionally, if the board only have 256M of ram, the OS may start swapping when creating 100M ram disk file. If that happen, it will have a big hit on test result. Maybe test with 50M file. Use if=/dev/zero Don't use if=/dev/urandom. It is a very costly call for this test. Instead use if=/dev/zero. Test 1 - Write 100M to disk Following is my test result from a virtual machine, also writing 100M. if=/dev/zero john@U64D211:~$ time dd count=100 bs=1M if=/dev/zero of=test 100+0 records in 100+0 records out 104857600 bytes (105 MB) copied, 0.493612 s, 212 MB/s real 0m0.540s user 0m0.020s sys 0m0.516s if=/dev/urandom john@U64D211:~$ rm test john@U64D211:~$ time dd count=100 bs=1M if=/dev/urandom of=test 100+0 records in 100+0 records out 104857600 bytes (105 MB) copied, 10.8723 s, 9.6 MB/s real 0m10.909s user 0m0.004s sys 0m10.893s john@U64D211:~$ Test 2 - Write 100M to /dev/null To show how costly is urandom, lets write to /dev/null, so no writing to disk. if=/dev/zero john@U64D211:~$ time dd count=100 bs=1M if=/dev/zero of=/dev/null 100+0 records in 100+0 records out 104857600 bytes (105 MB) copied, 0.0240906 s, 4.4 GB/s real 0m0.061s user 0m0.012s sys 0m0.052s if=/dev/urandom john@U64D211:~$ time dd count=100 bs=1M if=/dev/urandom of=/dev/null 100+0 records in 100+0 records out 104857600 bytes (105 MB) copied, 10.4979 s, 10.0 MB/s real 0m10.555s user 0m0.024s sys 0m10.513s So when writing to /dev/null, almost 99% of time is spent by urandom system call. PS1: VM has 4G of ram. PS2: File caching do/may have affect the test result to some extend, but the difference between the if option is so huge that it is safe to ignore caching factor. And the effect should apply to both cases anyway. PS3: I did not average out the test results. But I did run each multiple times with very similar result.
Alix Board write performance
1,392,205,979,000
I build my own linux distribution using Yocto for Rpi CM4. I would like to have a possibility to update it remotely, without using Balena Etcher, just upload the built image and call some commands via SSH. How can I do that? I found swupdate yocto layer but I cannot confirm that it will work with CM4 Thanks!
So I used RAUC. It has support for RPI CM4/4B. Just add those layers to yocto: https://github.com/rauc/meta-rauc https://github.com/rauc/meta-rauc-community/tree/master/meta-rauc-raspberrypi Then follow the instruction from readme.md from the second URL. Works without any struggle.
Embedded linux remote update
1,392,205,979,000
I'm unable to successfully set the bDeviceClass, bDeviceProtocol, or bDeviceSubClass when configuring a device as an RNDIS gadget in /sys/kernel/config/usb_gadget/g1. I'm configuring the gadget with the following values and can read them back successfully in Linux: echo 0xef > bDeviceClass echo 0x02 > bDeviceSubClass echo 0x01 > bDeviceProtocol But when I plug the device into my Windows machine and observe the USB device descriptor the I get the following: bDeviceClass: 0x02 bDeviceSubClass: 0x00 bDeviceProtocol: 0x00 On a different device running the 4.9 kernel this same procedure works correctly and Windows reads the correct values from the device. My current device is running 4.14.53. I'm not sure why the previous method no longer works. I'm not sure if it's related or not, but in order to pass along product, manufacturer and serialnumber information on my current device I had to pass in those values as arguments when modprobing g_ether, rather than populating the fields in strings/0x409. I have tried do the same thing with bDeviceClass, bDeviceSubclass, and bDeviceProtocol but haven't had any luck. Does anyone have any idea as to what I'm doing wrong?
The solution was to modprobe the libcomposite module instead of g_ether directly. That allowed the USB device descriptors to bet set as expected. This also requires the script to bind the gadget to UDC before exiting. I've included an admittedly maximal example, but it's what I'm using and it's what works for me. VENDORID=0x0430 PRODUCTID=0xa4a2 BCDDEVICE=0x100 BCDUSB=0x200 modprobe libcomposite # Set up the USB Device cd /sys/kernel/config/usb_gadget mkdir g1 cd g1 # Make the necessary directories. mkdir functions/rndis.usb0 mkdir configs/c.1 mkdir strings/0x409 mkdir configs/c.1/strings/0x409 echo 64 > bMaxPacketSize0 echo $BCDUSB > bcdUSB echo $BCDDEVICE > bcdDevice echo $VENDORID > idVendor echo $PRODUCTID > idProduct echo 0xef > bDeviceClass echo 0x02 > bDeviceSubClass echo 0x01 > bDeviceProtocol echo $MANUFACTURER > strings/0x409/manufacturer echo $PRODUCT > strings/0x409/product echo $CONF > configs/c.1/strings/0x409/configuration echo $SERNO > strings/0x409/serialnumber echo 1 > os_desc/use echo 0xcd > os_desc/b_vendor_code echo MSFT100 > os_desc/qw_sign echo RNDIS > functions/rndis.usb0/os_desc/interface.rndis/compatible_id echo 5162001 > functions/rndis.usb0/os_desc/interface.rndis/sub_compatible_id mkdir functions/rndis.usb0/os_desc/interface.rndis/Icons echo 2 > functions/rndis.usb0/os_desc/interface.rndis/Icons/type echo "%SystemRoot%\system32\ddores.dll,-134" > functions/rndis.usb0/os_desc/interface.rndis/Icons/data mkdir functions/rndis.usb0/os_desc/interface.rndis/Label echo 1 > functions/rndis.usb0/os_desc/interface.rndis/Label/type echo $PRODUCT > functions/rndis.usb0/os_desc/interface.rndis/Label/data ln -s configs/c.1 os_desc ln -s functions/rndis.usb0 configs/c.1 echo 7600000.dwc3 > UDC
Unable to set USB gadget device class and protocol
1,490,658,563,000
How to use dd command to download mtd block from embedded Linux-based device? # cat /proc/mtd dev: size erasesize name ... mtd3: 003a0000 00010000 "DRTI2" I need download mtd3 block, so dd if=/dev/mtdblock3 bs=BYTES count=BLOCKS | nc 192.168.1.30 5555 What should be correct bs and count values and how to calculate it? Size is '003a0000' and erasesize (erase block size) is '00010000' in hex values.
dd and cat are equal if you want to read full mtdblock3. With dd it will be: dd if=/dev/mtdblock3 | nc 192.168.1.30 5555. Just omit optional bs= and count=.
Using dd command to download mtd block
1,490,658,563,000
I am following CLFS book (GIT-20140613-arm version), and I have a issue when building GCC with armv7 and neon combination. Target info here. My host is a clean Debian 8 with gawk, build-essential, texinfo and libncurses5-dev packages. More details can be found here. I made this patch to build binutils with gcc-4.9. Following the instructions, when it comes to compile GCC for the very first time it claims not to be possible to these arm combination. checking for suffix of object files... configure: error: in `/mnt/clfs/sources/gcc-build/arm-linux-musleabihf/libgcc': configure: error: cannot compute suffix of object files: cannot compile See `config.log' for more details. On config.log we can see: conftest.c:1:0: error: target CPU does not support ARM mode I linked the complete error here. In my research I found this question which sounds to be the same, but the OP was following a very old version of CLFS book, I managed to surpass this bug by appending --with-mode=thumb to ./configure, but then musl fails: arm-linux-musleabihf-gcc -std=c99 -nostdinc -ffreestanding -fexcess-precision=standard -frounding-math -D_XOPEN_SOURCE=700 -I./arch/arm -I./src/internal -I./include -Os -pipe -fomit-frame-pointer -fno-unwind-tables -fno-asynchronous-unwind-tables -Wa,--noexecstack -Werror=implicit-function-declaration -Werror=implicit-int -Werror=pointer-sign -Werror=pointer-arith -fno-stack-protector -c -o crt/crt1.o crt/arm/crt1.s crt/arm/crt1.s: Assembler messages: crt/arm/crt1.s:6: Error: only lo regs allowed with immediate -- `mov fp,#0' crt/arm/crt1.s:7: Error: only lo regs allowed with immediate -- `mov lr,#0' crt/arm/crt1.s:8: Error: Thumb does not support this addressing mode -- `ldr a2,[sp],#4' crt/arm/crt1.s:11: Error: lo register required -- `str fp,[sp,#-4]!' crt/arm/crt1.s:12: Error: Thumb does not support this addressing mode -- `str a1,[sp,#-4]!' crt/arm/crt1.s:13: Error: Thumb does not support this addressing mode -- `str a4,[sp,#-4]!' Makefile:112: recipe for target 'crt/crt1.o' failed make: *** [crt/crt1.o] Error 1 I have also tried vfp and vfpv3 combinations, and I have also tried to use Linaro GCC instead of GNU one, no luck at all. Once I made this book successfully till the end for Raspberry Pi One (hard, vfp and armv6), but I am in trouble with the Beaglebone combination. What am I missing? Is my environment correct? If so, what could I do to overcome this issue?
For BeagleBone Black, the correct environment settings is armv7-a, as we can see here and here, and we need to pick up the kernel settings from here with bb.org_defconfig, and use headers from here, and patches for gcc from here, and remember to build final gcc with --disable-libsanitizer. I used the following command before build musl: sed -i 's/\/dev\/null\/utmp/\/var\/run\/utmp/g;s/\/dev\/null\/wtmp/\/var\/log\/wtmp/g' include/paths.h include/utmp.h And the following before build busybox to solve wtmp issues: sed -i 's/\(CONFIG_\)\(.*\)\(INETD\)\(.*\)=y/# \1\2\3\4 is not set/g;s/\(CONFIG_IFPLUGD\|CONFIG_ASH_HELP\|CONFIG_FEATURE_VERBOSE\|CONFIG_UEVENT\)=y/# \1 is not set/' .config sed -i '/utmpx\.h/,/endif/s/__UCLIBC__/LIBBB_H/' include/libbb.h Complete package list: wget -cO bootscripts-embedded-HEAD.tar.gz -c 'http://git.clfs.org/?p=bootscripts-embedded.git;a=snapshot;h=HEAD;sf=tgz' wget -cO gcc-5.2.0-musl-1.patch 'https://raw.githubusercontent.com/GregorR/musl-cross/master/patches/gcc-5.2.0-musl.diff' wget -c \ 'http://ftp.gnu.org/gnu/binutils/binutils-2.25.1.tar.bz2' \ 'http://busybox.net/downloads/busybox-1.24.0.tar.bz2' \ 'ftp://gcc.gnu.org/pub/gcc/releases/gcc-5.2.0/gcc-5.2.0.tar.bz2' \ 'http://ftp.gnu.org/gnu/gmp/gmp-5.1.3.tar.xz' \ 'http://sethwklein.net/iana-etc-2.30.tar.bz2' \ 'http://ftp.barfooze.de/pub/sabotage/tarballs/kernel-headers-3.12.6-5.tar.xz' \ 'https://github.com/beagleboard/linux/archive/4.1.tar.gz' \ 'ftp://ftp.denx.de/pub/u-boot/u-boot-2015.10.tar.bz2' \ 'ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz' \ 'ftp://ftp.gnu.org/gnu/mpfr/mpfr-3.1.3.tar.xz' \ 'http://www.musl-libc.org/releases/musl-1.1.9.tar.gz' \ 'https://matt.ucc.asn.au/dropbear/releases/dropbear-2015.68.tar.bz2' \ 'http://www.red-bean.com/~bos/netplug/netplug-1.2.9.2.tar.bz2' \ 'http://downloads.sourceforge.net/libpng/zlib-1.2.9.tar.gz' \ 'http://patches.clfs.org/embedded-dev/iana-etc-2.30-update-2.patch' \ 'http://patches.clfs.org/embedded-dev/netplug-1.2.9.2-fixes-1.patch' \ 'http://downloads.sourceforge.net/libpng/zlib-1.2.8.tar.gz' That solves all issues.
CLFS for ARMv7 neon
1,490,658,563,000
Many routers run a Linux OS and abrupt power failure can happen. Considering this - how do they handle the possibility of file system corruption caused by a power failure? If they make the system read only, how are you able to change settings?
Routers and other small linux devices do not use hard drives. They use different types of RAM: DDR RAM as working storage ROM for system image (Kernel + OS) Non Volatile RAM for Settings (/dev/nvram) In case of an crash they boot again and reinitialize the OS, so nothing get's lost.
Embedded Linux Power Failure Issues
1,490,658,563,000
I am running on Linux 2.6.30.9 and have been trying to setup a transparent ethernet over GRE tunnel. The network topology used is as follows: I want to bridge PC1 and PC2 using Transparent Ethernet over GRE. RouterA is connected to internet via ppp0 as RouterB. Both internet connections are PPPOE (PPPoEoA PVCs). So I do: In RouterA (Linux 2.6.30.9): ip link add testgre type gretap remote 193.152.243.206 local 95.121.205.77 ttl 255 brctl addif br0 testgre ip link set testgre up In RouterB (Linux 2.6.30.9): ip link add testgre type gretap remote 95.121.205.77 local 193.152.243.206 ttl 255 brctl addif br0 testgre ip link set testgre up Some commands output: In RouterA (similar output in RouterB): # ip link show testgre 36: testgre: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1442 qdisc pfifo_fast state UNKNOWN qlen 1000 link/ether 5f:79:cd:4d:c6:57 brd c1:98:f3:ce:ff:ff # brctl show bridge name bridge id STP enabled interfaces br0 8000.5f79cd4dc657 no eth0.5 eth0.4 eth0.3 eth0.2 wlan0 testgre Then I do PING request from PC1 to PC2: ping 192.168.1.33 I run tcpdump in RouterA and I see the ARP Request frame over ppp0 (pcap file opened with Wirehark): I run tcpdump in RouterB attached to ppp1 and I see that the ARP Request has arrived, but its not forwarded at L2 to PC2. I don't see the ARP request in PC2. I try with statics ARP entries but the ICMP Request has the same problem, it is not forwarded to PC2. There are not ebtables rules. Nor iptables rules (Default action is ACCEPT for ebtables and iptables). Should I add ppp0 to bridge interface or something like that?
The problem was related with the question I asked on ServerFault, IP/GRE compiled in kernel but gre0 interface doesn't exist. I solved the first question by letting GRE demultiplexer driver in gre.c to register the GRE protocol handler in kernel. But I have found that when a GRE packet arrives GRE handler is not pointing to any ip_gre.c function (GRE demultiplexer driver is supposed to check GRE version in packet and pass the bucket to the right protocol handler but in my case it points NULL). I commented the piece of code where gre.c registers GRE protocol handler and I have uncommented the piece of code where ip_gre.c registers GRE protocol handler. Now when a GRE packet arrives it is well decapsulated and commited to next layer, now I can ping from PC1 to PC2 without any problem. I think this issue is happening to many people in their embedded devices because I searched with google for the error message, "ipgre init: can't add protocol" when IP GRE driver can not start because GRE demultiplexer driver had yet registered a GRE handler and I have found several devices with this error.
Transparent Ethernet over GRE not forwarding traffic
1,490,658,563,000
Hi I recently run an application or an app and now I want to know the cpu status info so i need the PID of the application i have run recently. But i have so many PIDs in the /proc directory so how can i know the PID of the particular application for example "my-example" application binary i recently executed.
There are some command line tools for process management you can check: You can use pidof <name>, e.g. pidof bash, to get the PID of a process given the program name You can use ps -aux to get a listing of currently running programs with their starting time and PID. You may look for your program in the listing. You can use ps -eafx to get a listing of running programs showing all the command line options. May be you can find your program looking for some command-line option or parameter. You can use pgrep [options] <patterns> to look for a process using multiple criteria. You can run pgrep --help to review all the options.
How to find pid of an application recently run on linux?
1,490,658,563,000
Is it possible to check free disk size in Linux without using command lines such as df? Since my host machine is embedded Linux, there are no direct command lines that show free disk size.
The information that df produces comes from the statvfs() system call. If your embedded system does not have the df command installed, perhaps it has one of the common scripting languages, using which you can write a one-liner to access the same system call? python -c 'import os; print os.statvfs("/")' If it doesn't have anything like that installed already then your best bet is robably to write a small C program that calls statvfs() and install that.
How to know free disk size witout df command? [closed]
1,490,658,563,000
I have to prepare a computer to give away, and I do not know who is going to use it. The computer has Debian installed, and the HDD is entirely encrypted. All users have their storage on the server. I have been believing that if it meet some conditions below this will safe huge works for all computer departments: Anyone can power on/off computer as they wish Only permitted users can use installed applications Permitted Users can not view any configuration files, modify, store data and copy the HDD content even when they remove it to another computer The HDD only works with the given computer. When it stolen or tap, it is automatic destroy all data inside. How can I go about doing that?
It's not really possible. You simply can not prevent someone powering on/off a computer, or indeed them doing whatever they want with it once they have hands on access. I've done something similar, for a server. It uses full disk encryption and produces its key based on hardware data such as CPU type, Mac Address, amount of memory installed, etc. If someone just took the disk out and placed it in another machine, a different key would be produced and as such the system would not reveal its data. It's meant as a protection when someone exchanges the disk in the data center and puts it in someone else's server without wiping it first. Still you have to be aware that it does not really protect against someone who wants to mess with your stuff.
Secure the content of a hard disk
1,490,658,563,000
I wish to install Xenomai which works on Linux providing a kind of hard real time environment. x86/64 architectures are supposed to contain the "System Management Mode" which prevents them from being used for hard real time systems. By "System Management Mode" I mean this: http://en.wikipedia.org/wiki/System_Management_Mode Do embedded boards like ARM also have this "System Management Mode"? Answers with references will be appreciated.
System Management Mode is not the only thing that makes x86 bad at hard real time. The unpredictability of the execution speed due to caches, pipelines and so on makes x86, and any other high-end processor, bad at real time. All these features that make a processor fast on average also make the worst case difficult to manage. The current generation of ARM chips is divided in three series: Cortex A for high-end microprocessors (the closest thing to x86), Cortex-R for real-time applications, and Cortex-M in a microcontroller profile. The Cortex-R does not have an MMU (some have an MPU) but may have a cache. It is used in many real-time applications (ARM tries to compete with DSPs, fairly successfully). The ARM architecture itself does not define anything like SMM. It's possible that chip manufacturers add something like it, you'd have to look at the manufacturer's documentation.
System Management Mode in embedded systems
1,490,658,563,000
For a linux kernel with virtual memory and disk storage, pages are swapped back and forth into swap area. But embedded systems generally use NAND flash instead of disk. A NAND flash has a limited number of writes allowed, as guaranteed by its manufacturer (although the limit is high in most cases). How the wear out in this page swapping case is handled in kernel ? Or the Linux based embedded systems generally turn off the virtual memory page swap to avoid NAND flash wear and tear ?
Embedded systems running on flash don't use swap. Please don't confuse that with virtual memory though - virtual memory has many more usages then just swapping to disk.
NAND flash memory wear & virtual memory page swap
1,490,658,563,000
In a small embedded Linux Busybox based system, by default inetd is being started at boot but inetd.conf has every service commented out as none of them are being used. Does this mean we can just remove the call to start inetd or could it be required by some system process down the line?
There's no need to run inetd unless it's being used. If you were really cautious you could look for uncommented non-blank lines in /etc/inetd.conf and only start the daemon if one or more was found. This implies that you would be changing your system configuration at some point in the future. If you're not doing that then you can consider the situation right now, and simply discard inetd.
Can we kill inetd if there's nothing using it / no config?
1,490,658,563,000
Here I read: $ cd /media/mmcblk1p2 $ tar xf /media/sda1/mfg_images/st-image-bootfs-openstlinux-weston-stm32mp1-som.tar.xz but as source file I don't have a compressed file, instead I have an ext4 image for that partition. Should I use dd with of=/dev/mmcblk1p2 or I need to use another approach?
You can mount the filesystem image directly into your filesystem: mkdir -p /mnt/img mount -o ro,noload imagefile.img /mnt/img and then you can retrieve the file directly from the appropriate place underneath /mnt/img. (The ro,noload options mount the filesystem read-only. Omit them both if you want read/write access.) Unmount the file afterwards with umount /mnt/img
Extract file from ext4 image and copy file to device
1,490,658,563,000
Recently Debian Wheezy LTS released a new version of a package, e.g. wget 1.13.4-3+deb7u4 (see announcement here), on my system I still have an old version e.g. wget 1.13.4-3+deb7u3 installed. My sources.list only have one line: deb http://security.debian.org/ wheezy/updates main My preferences file is not exiting at all. I've used another sources.list file for regular security upgrades. When doing an apt-get -o Dir::Etc::SourceList=security-sources.list update it looks fine: Hit http://security.debian.org wheezy/updates Release.gpg Hit http://security.debian.org wheezy/updates Release Hit http://security.debian.org wheezy/updates/main armel Packages Reading package lists... Done But when doing an apt-get upgrade or dist-upgrade it doesn't install newest package versions: Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Also an apt-cache policy wget doesn't list the newest version: wget: Installed: 1.13.4-3+deb7u3 Candidate: 1.13.4-3+deb7u3 The problem is reproducible. Why apt-get upgrade doesn't find and install newest version of the released packages, e.g wget deb7u4?
I found the solution: in the command apt-get update there was another sources.list file used with -o Dir::Etc::SourceList=/etc/apt/security-sources.list But apt-get upgrade was called without this other source.list file - I assumed it is not needed anymore - but it is. Once I've used the same sources.list file for update and upgrade everything works fine. Thanks for any help
apt-get upgrade doesn't find newest packages
1,490,658,563,000
what is proper command compress mtdblock with 'tar' before sending it via TFTP? tftp -l /dev/mtdblock3 -p 192.168.100.40
tar is not a compression tool, just use gzip to compress a single file. You can pipe gzip -c to tftp -l /dev/stdin on the busybox shell. For example: gzip -c /dev/mtdblock3 | tftp -l /dev/stdin -r mtdblock3.gz -p 192.168.100.40 If there's no /dev/stdin, try with /proc/self/fd/0 instead.
Compress mtdblock with 'tar' before sending it via TFTP
1,490,658,563,000
I am developing for an embedded Linux application using friendlyARM's micro2440. It runs on a Samsung s3c2440 ARM processor and uses squashfs in its NAND flash. Recently, some flash blocks went bad. u-Boot correctly finds them and creates a bad block table with the offsets given by the nand bad command: Device 0 bad blocks: 01340000 0abc0000 0f080000 0ff80000 0ffa0000 0ffc0000 0ffe0000 When I try to boot the kernel, it correctly scans the bad blocks and creates its bad block table, as seen in the following messages: Scanning device for bad blocks Bad eraseblock 154 at 0x000001340000 Bad eraseblock 1374 at 0x00000abc0000 Bad eraseblock 1924 at 0x00000f080000 But when it comes the time for the kernel to mount the filesystem in the partition where the bad block at 0x000001340000 happens, it seems unable to skip the bad blocks and then it panics. The error messages given were: SQUASHFS error: squashfs_read_data failed to read block 0xd0e24b SQUASHFS error: Unable to read metadata cache entry [d0e24b] SQUASHFS error: Unable to read inode 0x3d1d0f68 ------------[ cut here ]------------ WARNING: at fs/inode.c:712 unlock_new_inode+0x20/0x3c() Modules linked in: [<c0037750>] (unwind_backtrace+0x0/0xcc) from [<c0044994>] (warn_slowpath_null+0x34/0x4c) [<c0044994>] (warn_slowpath_null+0x34/0x4c) from [<c00a42c8>] (unlock_new_inode+0x20/0x3c) [<c00a42c8>] (unlock_new_inode+0x20/0x3c) from [<c00a61b8>] (iget_failed+0x14/0x20) [<c00a61b8>] (iget_failed+0x14/0x20) from [<c00f75cc>] (squashfs_fill_super+0x3c8/0x508) [<c00f75cc>] (squashfs_fill_super+0x3c8/0x508) from [<c0095990>] (get_sb_bdev+0x110/0x16c) [<c0095990>] (get_sb_bdev+0x110/0x16c) from [<c00f7164>] (squashfs_get_sb+0x18/0x20) [<c00f7164>] (squashfs_get_sb+0x18/0x20) from [<c0095008>] (vfs_kern_mount+0x44/0xd8) [<c0095008>] (vfs_kern_mount+0x44/0xd8) from [<c00950e0>] (do_kern_mount+0x34/0xe0) [<c00950e0>] (do_kern_mount+0x34/0xe0) from [<c00a9084>] (do_mount+0x5d8/0x658) [<c00a9084>] (do_mount+0x5d8/0x658) from [<c00a9330>] (sys_mount+0x84/0xc4) [<c00a9330>] (sys_mount+0x84/0xc4) from [<c0008c60>] (mount_block_root+0xe4/0x20c) [<c0008c60>] (mount_block_root+0xe4/0x20c) from [<c00090fc>] (prepare_namespace+0x160/0x1c0) [<c00090fc>] (prepare_namespace+0x160/0x1c0) from [<c00089c8>] (kernel_init+0xd8/0x104) [<c00089c8>] (kernel_init+0xd8/0x104) from [<c0033738>] (kernel_thread_exit+0x0/0x8) ---[ end trace c21b44698de8995c ]--- VFS: Cannot open root device "mtdblock5" or unknown-block(31,5) Please append a correct "root=" boot option; here are the available partitions: 1f00 256 mtdblock0 (driver?) 1f01 128 mtdblock1 (driver?) 1f02 640 mtdblock2 (driver?) 1f03 5120 mtdblock3 (driver?) 1f04 5120 mtdblock4 (driver?) 1f05 40960 mtdblock5 (driver?) 1f06 40960 mtdblock6 (driver?) 1f07 167936 mtdblock7 (driver?) 1f08 1024 mtdblock8 (driver?) Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,5) [<c0037750>] (unwind_backtrace+0x0/0xcc) from [<c02fdd40>] (panic+0x3c/0x114) [<c02fdd40>] (panic+0x3c/0x114) from [<c0008d44>] (mount_block_root+0x1c8/0x20c) [<c0008d44>] (mount_block_root+0x1c8/0x20c) from [<c00090fc>] (prepare_namespace+0x160/0x1c0) [<c00090fc>] (prepare_namespace+0x160/0x1c0) from [<c00089c8>] (kernel_init+0xd8/0x104) [<c00089c8>] (kernel_init+0xd8/0x104) from [<c0033738>] (kernel_thread_exit+0x0/0x8) I tried mounting the filesystem in mtdblock6 partition and everywhing worked as expected, as there are no badblocks in that part of the memory. I investigated the mtd source files responsible for the bad block management, but I couldn't find something useful about how the kernel skips the bad blocks.
We've figured out that the problem is with squashfs itself. It has no support for bad block detection, as stated here: http://elinux.org/Support_read-only_block_filesystems_on_MTD_flash So the possible solution is to use another filesystem or use UBI to manage the bad blocks and then keep using squashfs.
Kernel does not skip bad blocks when mounting filesystem
1,490,658,563,000
I have a custom written application that runs on a embedded setup (buildroot). My application has to run every time the target device boots up and so I wrote an init script to do this and it works fine. However, part of the application has a very basic 'GUI' written with ncurses. The problem I have is that it works fine when I log onto directly or over ssh, but when the binary starts through init, I am unable to access the functionality of the ncurses code. I presume that this is because the console I am logged into is not the same as the console that starts the binary. So my question is do applications/daemons have an associated console, and if so, is there any way to transfer it to another console? If not are there any other ways I could go about solving this problem? I was thinking perhaps enforcing an automated login and then getting the application to start through the login console so that when a monitor is attached to the device at least the GUI will be accessible. Or is there a better way?
I'm no quite sure I've understood your problem. I assume that your application starts some kind of curses GUI and you want to log in remotely and the - somehow - connect to that GUI (but the application is already running). I suggest to use screen (http://www.gnu.org/software/screen/) to start the application on a detached 'screen' (actually a pseudo tty with a simple terminal emulator). Then after logging in, your user(s) can use 'screen -D -r' or variations thereof to attach to virtual screen. That would be what you called "to transfer it to another console" PS: Another way to do that "right" would possibly be to separate service (the part that is always running) and UI into 2 separate processes. Might be too much hassle, though, since it requires to invent some kind of IPC between those two processes.
Using ncurses for basic GUI on a process started inside an init script
1,490,658,563,000
I could find the ip address of my board by using ifconfig but I need the port number as well to set Linux TCF agent. I tried netstat with several options but could not find as it returns too many and cannot scroll the screen to the top. So is there a way to find the port number given the ip address?
Prefer using ss netstat is deprecated (no update since 2011), as said in the man page, in the NOTE section. So you probably should use ss, which is part of the iproute2 package. You can use the following command: ss -nltp -n will prevent names resolution -l displays listening sockets -t is used for TCP transport (if you have UDP instead, use -u, or you may even use both at same time) -p will show you the process name which uses this socket You may still use netstat Note that if you can't use ss for any reasons, the command line arguments are exactly the same for netstat, eg.: netstat -nltp Filter the output To look for a specific program or port numbers, you can apply filter on the output using grep: ss -nltp | grep "<process_name or port_number>" Or as said by @davidt930 in the comments, use less to easily browse the output: ss -nltp | less Other tool that may help you Just in case someone needs this, I wanted to say that you can also use tools for ports scan. So you can even run the command from outside the system. The most famous one is probably Nmap. I know it's a bit overkill in this situation ^^, but I add that just in case someone is in trouble and needs a different solution.
How to find the port number given the ip address
1,490,658,563,000
I need to calculate how long linux takes to shutdown. I am running an embedded busybox linux on ARM i.MX7. I looked in /var/volatile/log/messages but that only shows the last startup. I need to know how long the system takes to shutdown after eg shutdown -h -P now. How can I get a reasonably precise measurement?
There is an obvious problem: Shutting down the system requires at some point to close filesystems, so log files can never catch the last bit. Typically, you have some serial console on such a system and if you enable kernel logging to the console, you have all output with time stamp until immediately before the kernel stops. On the other hand, the last action of most embedded systems I know is to »pull the plug« by switching off the PMIC to make sure the system is really powered off, so the linux is not really completely driven down. If the cause of your question is to optimize system shutdown, it's neither easy nor necessary to cleanly stop all system components. After closing network connections and unmounting and syncing file systems, simply switch off the power. Cleanly unmounting all drivers and the like is very likely superfluous. Finally, if you really have no serial console for some strange reason, I recommend to use an oscillograph on the power supply: Do something to change the current immediately before shutting down, like changing backlight intensity, then you should be able to calculate the time between this change and the final breath of the system.
How to measure how long linux takes to shutdown
1,611,532,540,000
I would like to specify mount options for my rootfs as per instructed here however I am unsure where this should be done. I've looked through the genimage docs and there was no generic option to pass a mount option to a generic partition. I found a similar thread here but the answer was somewhat inconclusive.
For context I'm working on a Raspberry Pi 0. Using @A.B 's comment, I added rootflags=fastboot to cmdline.txt which is passed to the kernel on boot. This solved my issue.
Specify rootfs mount options
1,611,532,540,000
I have been trying to locate ARMv8 32bit package repository since yesterday to download packages that I would make use to carry out some analysis with radare. I had found repositories from archlinux and centos but unfortunately all these packages are aarch64 (ARMv8-64bit) which radare is having issues with analyzing. I do not know exact reason for that issue but what my question is I want to find repositories like the above mentioned two for 32bit variant of ARMv8. I did find termux distribution of 32 bit ARM, but unfortunately it was ARMv7 instead of ARMv8. In general following are my questions: Is there a package repositories for ARMv8 32bit? Or ARMv8 is just 64bit? Is there any general way of finding such repositories? (I did had a great difficulty in locating above mentioned repositories too, and knowing the way to finding such repositories would be really great) When we mention ARMv8, is it generally referes to aarch64? Thank you very much for your time.
Technically ARMv8 consists of both a 64-bit architecture called Aarch64 and a 32-bit architecture called Aarch32. Some ARMv8 chips only have the 32-bit architecture. But in practice “ARMv8” is usually used to mean Aarch64. Aarch32 is backward compatible with ARMv7 and adds very few extensions to it. So I guess there isn't much call for ARMv8 optimized 32-bit binaries. The only Aarch32 feature that isn't in ARMv7 that I can name without research is cryptographic acceleration (for AES, SHA-1, SHA-2 and GCM), but this is an observation bias on my part and as far as I recall there are a few other minor extensions (maybe some new SIMD instructions?). Also some optional features of ARMv7 are always present on Aarch32, such as the floating-point/SIMD registers. In practice, armhf binaries (for ARMv7 with floating point and SIMD) work well for Aarch32. If you want to analyze existing binaries, you'll want tools that support whatever features those binaries use. In practice, most of the 32-bit arm binaries you'll find only use instructions from the set targeted by armhf. By the way, there's another widespread use of imprecise terminology that doesn't matter if you're considering Unix distributions, but it might appear when looking at architecture names in tools such as compiler flags. The full names of ARMv7 and ARMv8 are “ARMv7-A” and “ARMv8-A”. The suffix “-A” indicates “high-end” processors with an MMU. In a Unix context, they're the only relevant Arm processors, since the others don't have an MMU. But there are two other classes of Arm architectures that don't have an MMU (but might have an MPU): R (real-time) and M (microcontroller). They have different characteristics; for example ARMv8-M is only a 32-bit architecture.
Unable to locate DEBIAN ARMv8 32-bit packages from Internet
1,611,532,540,000
I'm trying to set up a u-boot on an imx8 board to load environment variables from a uEnv.txt file on the first partition. I've got it working so that it loads the file, and now I'm trying to import that data with env import. However, the u-boot version built with the BSP from the vendor doesn't seem to have env import as an option. This is what I get when I try and run it: u-boot=> env import -t ${loadaddr} $(filesize} env - environment handling commands Usage: env default [-f] -a - [forcibly] reset default environment env default [-f] var [...] - [forcibly] reset variable(s) to their default values env delete [-f] var [...] - [forcibly] delete variable(s) env edit name - edit environment variable env exists name - tests for existence of variable env print [-a | name ...] - print environment env run var [...] - run commands in an environment variable env save - save environment env set [-f] name [arg ...] I've also noticed some other missing commands that I'm used to like loadfat. Is env import something optional that needs to be configured before compiling? If so, can anyone provide information on how that is done? For reference, I'm using Yocto Sumo to build u-boot, and the u-boot version number shows as: U-Boot SPL 2018.03-imx_v2018.03_4.14.78_1.0.0_ga_var01+g5c48b6c (Oct 29 2019 - 13:16:16 +0000) Edit: I actually can't find reference to env import being an official command, but I've seen reference to it in several places. If it's not a command, how can I take environment variables that I've loaded from a file in to memory, and apply them?
You need to enable CONFIG_CMD_IMPORTENV.
How can I add missing "env import" to u-boot?
1,611,532,540,000
Board with ARM926EJ CPU, running embedded Linux v2.6.26.5, on NAND Flash device, NAND 32MiB. Linux is on MTD partitions on NAND device. How can I backup Linux kernel image (SP2Xcybertan_rom_bin) from serial interface? Since there is no TFTP option to transfer file from board to host PC via tftp. Can I read nand to some memory address, dump output to terminal and save, then convert hex to binary: nand read 0x20000000 0x80000 0x0017FF80 md.b 0x20000000 0x0017FF80 From boot process log: U-Boot 2009.03 (Oct 06 2011 - 20:04:03) Stack:->21F1EC74 U-Boot code: 21FC4D00->21FF9454 BSS:->21FFFF3B CPU: PNX8181-2B OM6xxx-ARM926EJ-S(ARMv5TEJ) @ 221MHz(armclk), 110MHz(hclk) Board: Vega_PNX8181_BaseStation Platform IV (LC) I2C: ready RAM Configuration: Bank #0: 20000000 32 MB NAND: 32 MiB In: serial Out: serial Err: serial Use Full Image's Kernel Net: VLAN Mode L2 switch present ETN1 Hit any key to stop autoboot: 0 Loading from NAND 32MiB 3,3V 8-bit, offset 0x80000 Image Name: SP2Xcybertan_rom_bin Created: 1970-01-01 0:00:-1 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 1572736 Bytes = 1.5 MB Load Address: 20008000 Entry Point: 20008000 ## Booting kernel from Legacy Image at 20200000 ... Image Name: SP2Xcybertan_rom_bin Created: 1970-01-01 0:00:-1 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 1572736 Bytes = 1.5 MB Load Address: 20008000 Entry Point: 20008000 Verifying Checksum ... OK Loading Kernel Image ... OK OK Starting kernel ... Uncompressing Linux......... The environment variables firetux # printenv baudrate=115200 ethaddr=FF:FF:FF:FF:FF:FF netmask=255.255.255.0 ipaddr=192.168.1.1 serverip=192.168.1.100 bootfile=firetux.kernel bootcmd1=setenv bootargs ${bootargs} && nboot 0x20200000 0 ${image_addr} && bootm 0x20200000 bootcmd2=setenv bootargs ${bootargs} && tftpboot 20200000 firetux.kernel && bootm 20200000 phymode=auto mtdids=nand0=gen_nand unlock=yes verify=y update.uboot=echo Update u-boot && tftpboot 0x20000000 nandboot.flash && nand erase 0x0 0x03ffff && nand write.jffs2 0x20000000 0x0 ${filesize} update.kernel=echo Update kernel && tftpboot 0x20000000 uImage && nand erase 0x80000 0x180000 && nand write.jffs2 20000000 0x80000 0x180000 update.romimg=echo Update RomImage && tftpboot 0x20000000 romimage.img && nand erase 0x80000 0x13e0000&& nand write.jffs2 20000000 0x80000 ${filesize} update.halfimg=echo Update HalfImage && tftpboot 0x20000000 recovery.img && nand erase 0x1460000 0x700000&& nand write.jffs2 20000000 0x1460000 ${filesize} eraseenv=echo Erase Environment && nand erase 0x60000 0x20000 HwModel=Hw_Model=SPA122 bootcmd=run bootcmd1 halfImage=half_image=0 cy_boot_code_ver=1.0.1 (Oct 6 2011 - 20:04:00) RouterMode=Router_Mode=0 stdin=serial stdout=serial stderr=serial bootcmd=run bootcmd1 image_addr=0x80000 bootargs=console=ttyS1,115200n8 rootfstype=squashfs noalign half_image=0 verify=y Hw_Model=SPA122 Router_Mode=0 ethact=ETN1 bootdelay=3 What are the difference between kernel(uImage) and romimage (romimg.img) in terms of boot process?
The steps to do this would be as follows: First assuming the update uImage is correct update.kernel=echo Update kernel && tftpboot 0x20000000 uImage && nand erase 0x80000 0x180000 && nand write.jffs2 20000000 0x80000 0x180000 then: nand read <memory offset> <nand start offset> <size> md <memory offset> <size> so: nand read 0x20000000 0x80000 0x180000 md 0x20000000 0x180000 Then you'd need to find a way to record the input on your serial and parse it with a script to take the hex bytes and output them in binary into a file.
How can I backup Linux kernel image
1,611,532,540,000
Embedded device, Linux version 2.6.26.5, U-Boot 2009.03 bootloader. ARM Linux Kernel Image on NAND flash, loading from NAND. How to access the filesystem as the root user, and to reset the root password? Is it possible to get this by supplying single boot argument (single-user mode) to Linux kernel via U-boot parameters? Or by adding init=/bin/bash argument to the end of the boot parameters. The output of bootargs and bootcmd environment variables: Kernel command line: console=ttyS1,115200n8 rootfstype=squashfs noalign half_image=0 verify=y Hw_Model=RZU017 Router_Mode=0
The correct command for this board is: setenv bootargs ${bootargs} single init=/bin/sh (there is no bash installed)
Access the filesystem as the root user
1,611,532,540,000
I'm working on an existing embedded Linux device and am having trouble editing the partitions using fdisk. My goal is to create a partition for testing purposes on /dev/sda. I am using the fdisk bundled with BusyBox v1.23.2. Please see below for my conundrum: # cat /proc/partitions major minor #blocks name 8 0 56582144 sda 8 1 8 sda1 8 2 32768 sda2 8 3 262144 sda3 8 4 1024 sda4 8 5 512 sda5 8 6 512 sda6 8 7 56285132 sda7 Notice that there are 7 partitions listed for sda # fdisk -l /dev/sda Note: sector size is 4096 (not 512) Disk /dev/sda: 57.9 GB, 57940115456 bytes 256 heads, 63 sectors/track, 877 cylinders Units = cylinders of 16128 * 4096 = 66060288 bytes Device Boot Start End Blocks Id System /dev/sda1 1 266306 4294967292 ee EFI GPT Partition 1 has different physical/logical beginnings (non-Linux?): phys=(0,0,1) logical=(0,0,2) Partition 1 has different physical/logical endings: phys=(1023, 255, 63) logical=(266305, 4, 4) No information is shown regarding the remaining 6 partitions sda2 - sda7. Let's look at what is actually mounted right now # mount | grep '^/dev' /dev/root on / type ext4 (rw,relatime,data=ordered) /dev/block/bootdevice/by-name/userdata on /data type ext4 (rw,relatime,discard,noauto_da_alloc,data=ordered) /dev/block/bootdevice/by-name/modem on /firmware type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro) /dev/block/bootdevice/by-name/dsp on /dsp type ext4 (rw,relatime,discard,noauto_da_alloc,data=ordered) /dev/block/bootdevice/by-name/bluetooth on /bt_firmware type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro) Pay special attention to /dev/block/bootdevice/by-name/userdata being mounted on /data here. Let's check what partition userdata refers to: # ls -alh /dev/block/bootdevice/by-name | grep userdata lrwxrwxrwx 1 root root 9 Jan 12 20:34 userdata -> /dev/sda7 We can see here that /dev/sda7 is being used, as it is mounted at /data. Is there anything I might be able to do so that fdisk properly recognizes all the partitions and allows me to edit them?
You have a GUID Partition Table (GPT) on /dev/sda, and fdisk, especially early versions or small embedded versions don't work with GPTs. What you see is a sort of "compatibility" output that doesn't show you the real structure, and you won't be able to change partition data with fdisk. Options: (1) Take out harddisk, connect it to some other computer, use gparted etc. to manipulate GPT partition table. (2) Look through the binaries (non-busybox) on your embedded device to see if you have something that can modify GPTs, e.g. gdisk/cgdisk/sgdisk. (3) Cross-compile gdisk/cgdisk/sgdisk or a similar program, or maybe even gparted, so it works on your embedded device. (4) Put in old-style MBR partition table on the harddisk instead of the GPT, and try to keep the partitions you want to keep (if you want to make a new partition, at least one of the old partitions has to go, anyway). This can destroy data if you are not careful, so make a backup first.
Fdisk does not match /proc/partitions or mount points (embedded)
1,611,532,540,000
I'm currently working on an embedded linux device, i'm trying to make the file system read only which is fairly easy to do, but the application requires read/write access to files in /etc folder (mainly passwd and shadow) those cannot be moved out to the persist partition and linked back to /etc. I came up with a "solution" not sure if it is a good thing or not and that is why I'm posting here. Basically what I'm planning to do is make the whole file system read only (including /etc), then add a file /etc/rw-files which will hold paths to files that require read/write privileges for the device to work properly. on each boot I will have a script go through that list of files and folder and remount them as read/write using something like this : mount --bind directory directory mount -o remount,rw directory directory i tested this, it is working and device is behaving as it should but i'm still not quite sure of the quality of it.
You could look at using the overlayfs filesystem. In a single mount you can superimpose a small readwrite /etc on top of your large readonly /etc, and present a merged filesystem where any changes will be preserved in the upper readwrite layer directory. It is all automatic so you don't need to identify which files need readwrite.
Embedded linux read only
1,611,532,540,000
I am prototyping a new embedded system that uses ext4 on Flash memory. These systems will be remotely deployed with no local sysadmin, so any diagnostics must also be done remotely via a network. The default mount option for ext4 is to set the FS to read only when it encounters an error. I think this is too severe for my case, as it can cause many operations to cease working and prevent remote logins. I would prefer to keep the system running (and tolerate some FS errors). So for my case the mount option "errors=continue" seems more appropriate. However, I would like my application to be notified when any FS errors occur so it can log these as high priority problems and send that info. back to our servers. Does anyone know if this can be done with the stock Linux kernel (4.8.1 on x86_64)?
I would prefer to keep the system running (and tolerate some FS errors) This is a contradiction in terms. When you get FS errors, your system won't be running for long. In fact, running with errors=continue is very likely to further damage a corrupt filesystem until there is not even any hope of sensible recovery. If you want your application to make a best stab at continuing operation even if there are FS errors, it should have a script that detects when / has gone read-only, and reboot with a forced fsck. At some point everything goes bust. It's the law of increase of entropy. There isn't anything you can really do about it, other than adhere to solid engineering principles and get high-quality parts for mission-critical use cases.
Any way to be notified of EXT4 errors when mounted with "errors=continue"
1,611,532,540,000
I have some trouble with a U-Boot mmc hwpartition of an eMMC storage soldered on an i.MX6 embedded module: TX6UL U-Boot > mmc info Device: FSL_SDHC Manufacturer ID: 11 OEM: 100 Name: 004G6 Tran Speed: 52000000 Rd Block Len: 512 MMC version 5.0 High Capacity: Yes Capacity: 8 MiB Bus Width: 4-bit Erase Group Size: 4 MiB HC WP Group Size: 4 MiB User Capacity: 8 MiB WRREL Boot Capacity: 2 MiB ENH RPMB Capacity: 512 KiB ENH GP1 Capacity: 8 MiB WRREL GP2 Capacity: 1.8 GiB ENH WRREL TX6UL U-Boot > mmc hwpartition set user wrrel on complete Partition configuration: No enhanced user data area User partition write reliability: on No GP1 partition No GP2 partition No GP3 partition No GP4 partition Card already partitioned Failed! So it looks like the mmc was already hardware partitioned before. According the patch once it is hardware partitioned, it is not reversible. Is there really no way to repartition the soldered eMMC again? Do I have to throw the whole i.MX6 module away and buy a new one if I need other hardware partitioning?
Yes — the hardware partitioning is a permanent operation that can only be performed once. You will need to replace your eMMC or get a new board if you want to redo the hardware partitioning. Hardware partitioning (not to be confused with "normal" partitioning using programs like fdisk) includes: Going into enhanced mode (MLC->SLC) Partitioning the GPP (General Purpose Partitions) Enabling Write Reliability Mode. These settings are stored in the ECSD (Extended CSD) register in the eMMC, which is where uBoot is reading those settings from. From the 4.51 JEDEC Standard (page 19): Boot and RPMB Area Partitions' sizes and attributes are defined by the memory manufacturer (read-only), while General Purpose Area Partitions' sizes and attributes can be programmed by the host only once in the device life-cycle (one-time programmable). Looking at your output, it appears the write reliability has already been set, so it makes sense that it cannot be re-partitioned.
uboot mmc card already partitioned
1,611,532,540,000
I am trying to test the NAPI functionalities on embedded linux environment. I used 'pktgen' to generate the large number of packets and tried to verify the interrupt count of my network interface at /proc/interrupts. I found out that interrupt count is comparatively less than the packets generated. Also I am trying to tune the 'netdev_budget' value from 1 to 1000(default is 300) so that I can observe the reduction in interrupt count when netdev_budget is increased. However increasing the netdev_budget doesn't seems to help. The interrupt is similar to that of interrupt count observed with netdev_budget set to 300. So here are my queries: What is the effect of 'netdev_budget' on NAPI? What other parameters I can/should tune to observe the changes in interrupt count? Is there any other way I can use to test the NAPI functionality on Linux?(Apart from directly looking at the network driver code) Any help is much appreciated. Thanks in advance.
I wrote a comprehensive blog post about Linux network tuning which explains everything about monitoring, tuning, and optimizing the Linux network stack (including the NAPI weight). Take a look. Keep in mind: some drivers do not disable IRQs from the NIC when NAPI starts. They are supposed to, but some simply do not. You can verify this by examining the hard IRQ handler in the driver to see if hard IRQs are being disabled. Note that hard IRQs are re-enabled in some cases as mentioned in the blog post and below. As far as your questions: Increasing netdev_budget increases the number of packets that the NET_RX softirq can process. The number of packaets that can be processed is also limited by a time limit, which is not tunable. This is to prevent the NET_RX softirq from eating 100% of CPU usage. If the device does not receive enough packets to process during its time allocation, hardirqs are reneabled and NAPI is disabled. You can also try modifying your IRQ coalescing settings for the NIC, if it is supported. See the blog post above for more information on how to do this and what this means, exactly. You should add monitoring to your /proc/net/softnet_stat file. The fields in this file can help you figure out how many packets are being processed, whether you are running out of time, etc. A question for you to consider, if I may: Why does your hardirq rate matter? It probably doesn't matter, directly. The hardirq handler in your NIC driver should do as little work as possible, so it executing a lot is probably not a problem for your system. If it is, you should carefully measure that as it seems very unlikely. Nevertheless, you can adjust IRQ coalescing settings and IRQ CPU affinity to distribute processing to alter the number of hardirqs generated by the NIC and processed by a particular CPU, respectively. You should consider whether you probably are more interested in packet processing throughput or packet processing latency. Depending on which is the concern, you can tune your network stack appropriately. Remember: to completely tune and optimize your Linux networking stack, you have to monitor and tune each component. They are all intertwined and it is difficult (and often incorrect) to monitor and tune just a single aspect of the stack.
How to test linux NAPI feature?
1,611,532,540,000
I have little Linux system with 256MB RAM. I'm little bit confused, where the RAM may be lost? It is running old linux kernel 2.6.38 and I'm not able to ubgrade it (some specific ARM board). SHM and all tmpfs mounted filesystems are almost empty shmem:448kB Everyhing is consumed by active_anon pages but running processes does not correspond wih this. Sum of total_vm is just 90MB and there are duplicates, shared memory, unallocated memory... But active_anon is reported as 235MB. Why? How can I resolve this problem? Is there some memory leak in the kernel? Here is relevant dmesg Mem-info: Normal per-cpu: CPU 0: hi: 90, btch: 15 usd: 14 active_anon:60256 inactive_anon:67 isolated_anon:0 active_file:0 inactive_file:185 isolated_file:0 unevictable:0 dirty:0 writeback:0 unstable:0 free:507 slab_reclaimable:120 slab_unreclaimable:463 mapped:108 shmem:112 pagetables:217 bounce:0 Normal free:2028kB min:2036kB low:2544kB high:3052kB active_anon:241024kB inactive_anon:268kB active_file:0kB inactive_file:740kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:260096kB mlocked:0k lowmem_reserve[]: 0 0 Normal: 37*4kB 139*8kB 42*16kB 1*32kB 1*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 2028kB 305 total pagecache pages 65536 pages of RAM 622 free pages 1976 reserved pages 404 slab pages 393 pages shared 0 pages swap cached [ pid ] uid tgid total_vm rss cpu oom_adj oom_score_adj name [ 713] 0 713 666 40 0 0 0 busybox [ 719] 0 719 634 18 0 0 0 busybox [ 725] 0 725 634 15 0 0 0 busybox [ 740] 0 740 654 19 0 0 0 inetd [ 752] 0 752 634 17 0 0 0 ifplugd [ 761] 0 761 634 21 0 0 0 busybox [ 790] 0 790 4297 110 0 0 0 app [ 792] 0 792 635 15 0 0 0 getty [ 812] 0 812 634 16 0 0 0 exe [ 849] 101 849 630 57 0 0 0 lighttpd [ 850] 101 850 3005 218 0 0 0 php-cgi [ 851] 101 851 3005 218 0 0 0 php-cgi [ 3172] 0 3172 72156 59739 0 0 0 app [ 3193] 0 3193 675 23 0 0 0 ntpd [ 4003] 0 4003 634 15 0 0 0 ntpd_prog [ 4004] 0 4004 634 15 0 0 0 hwclock [ 4005] 0 4005 634 20 0 0 0 hwclock Out of memory: Kill process 3172 (app) score 912 or sacrifice child Killed process 3172 (app) total-vm:288624kB, anon-rss:238684kB, file-rss:272kB Here is a list of mounted filesystems. Root filesystem is r/w YAFFS2 on MTD flash. rootfs on / type rootfs (rw) /dev/root on / type yaffs2 (rw,relatime) none on /proc type proc (rw,relatime) none on /sys type sysfs (rw,relatime) mdev on /dev type tmpfs (rw,nosuid,relatime,size=10240k,mode=755) none on /proc/bus/usb type usbfs (rw,relatime) none on /dev/pts type devpts (rw,relatime,mode=622) shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime) none on /tmp type tmpfs (rw,relatime,size=102400k,mode=777) none on /run type tmpfs (rw,relatime,size=10240k,mode=755)
Total_vm was badly calculated by me and the OOM report is correct. app has allocated 59739 pages which is 233MB. So, this is the correct reason of OOM.
Embedded Linux OOM - help with lost RAM
1,611,532,540,000
I'm working on a IMX6 based board, and I need some advice to handle my modem. I've successfully configure the modem, and mounted the ppp. The modem is working fine and everything's great, but now I want to send him some AT command while running. Here is the content of my option file : /dev/ttyACM0 115200 persist maxfail 0 defaultroute noipdefault noauth updetach noccp debug usepeerdns novj connect "/usr/sbin/chat -v -f /etc/ppp/connect" The modem is on /dev/ttyACM0, and of course, when ppp is mounted, the file is locked. I have not put 'lock' in the /etc/ppp/option file. I have tried to put nolock in it too, but the file is still locked :( Is there a way to send command to the modem without unmount the ppp ? How ? Thanks.
It is not generally possible to send AT commands to a modem while a call is in progress. This applies to all AT-compatible modems, "regular" dial-up modems and mobile phone modems alike, and it has nothing to do with PPP. By the way, a point of terminology: PPP sessions are not mounted. Mouting and umounting are terms that apply to filesystems. There are two ways that commands can be sent to a modem while a call is in progress: Using the +++ escape sequence. You must sent the three characters +++ surrounded by one second of idle (no transmission) before and after. The modem will return to command mode. The call is suspended following execution of the escape sequence (which means that your PPP session will probably time out and break if you are not fast). Use ATO to return to the call. Note that the +++ escape sequence is often disabled (unavailable), and sometimes even if it is enabled it will drop the call unstead of suspending it. The +++ escape sequence is a very old standard is is not commonly used today. If the modem has more than one serial port connecting it to the computer, then you can send commands on one serial port while a call is in progress on the other one. Traditional dial-up or ISDN modems never have this feature, but I believe modern mobile phone modems might.
Sending command to an already mounted modem
1,611,532,540,000
I am using an embedded board, a FOX G20 V with an ATMEL AT91SAM9G20 processor. I would like to know first of all, which specific linux version I am using on this board, but also, how to remove it. What commands do I type through the terminal to do so? Also, once that is done and the linux is removed, I would like to install a compatible compiler with the processor. Does anyone know how I can go about in doing so? Or does anyone have any available links in how I can install a compatible compiler for this board? I'm very new to embedded development and I'm stuck on these two steps at the moment.
There's is not a standardized method to determine the OS and distribution. The uname -a command is pretty common and works for quite a few Unix like operating systems and often has hints to the actual OS. Linux specific are the /proc/version file and the common lsb_release -a command. Red Hat and derivative distributions like CentOS will have a file /etc/redhat-release. IIRC Debian and derivatives like Ubuntu have an equivalent /etc/debian_version file. A quick look at the specs suggest that the Fox G20 comes pre-installed with a Debian version. The Fox G20 getting started guide seems to have quite a bit of useful instructions as well.
Uninstall Linux on an embedded board
1,611,532,540,000
I'm using Buildroot to generate an embedded Linux with a kernel v. 2.6.39, which in the end starts busybox. Everything works fine when building with Initramfs as "rootfs". But Initramfs isn't the best for my needs, so i want to switch to other fs like SquashFS or even better not compressing it at all. Anyways i can't figure out how to tell the kernel it shall boot for instance the SquashFS file. What i do know, is that this is done by some kernel command line parameters. Unfortunately i can't find more about this with different search engines or here. And so it doesn't work. It always ends, as expected, with a kernelpanic. And how is it done if I haven't got it compressed and therefor it just has to be copied from Flash to RAM ?
Make sure you build what ever file system you want directly into the kernel and not as a module. SquashFS is readonly so you can't use that alone. You may be better off booting from initramfs then loading root from an image, but that's your call.
Change the root filesystem on an embedded system
1,611,532,540,000
I have a simple embedded setup as follows: x86 target, kernel and root file system built using buildroot. Syslinux is the bootloader configured to boot with an initramfs which points to a .cpio file generated from the buildroot generated root file system. My system boots and works as I am expecting, but I am confused as to what happens with the entries contained in /etc/fstab. I would like my system to be able to mount the /var directory as a partition on an attached compact flash device for various reasons (mainly because I want to be able to store and run an application on the compact flash and additionally store log data here). Is it possible to use an initramfs and yet mount /var on device outside of RAM? If that is the case, is /etc/fstab the correct place to configure this?
Any directory path can have any (valid) volume mounted to it. Whether or not /etc/fstab is the correct place to put it depends on whether or not your embedded setup even uses it.
What happens with /etc/fstab when using an initramfs?
1,611,532,540,000
I am writing an update utility for an embedded Linux device for which I am responsible. I'm creating a basic side-by-side setup, where updates are applied to a staging partition and then the bootloader is switched to the staging partition, changing the primary partition into the new staging one. However, the embedded device uses a CF card, which are known for sometimes writing data out of order, etc. For this reason, if I mount a file system as read/write, there's a chance of corruption. Therefore, I cannot mount my bootloader partition RW in order to point to the new partition. Is there a location on disk to which I can safely write a single byte, where the byte represents a 0 for the first partition or a 1 for the second? Even a CF card can't screw up a single byte write, which should happen atomically. I'm using a plain-old DOS MBR format disk.
Create a third, tiny, partition to hold your data. Any other location on your disk will sooner or later bring trouble if indeed you cannot rely on the filesytems. Sometimes the last few clusters of a disk cannot be addressed in the FAT entry, that may be an option but it heavily depends on exact size of the device. Does the embedded CPU / device have EEPROM? That would be an ideal place for a single byte.
Location on disk to write a byte-flag?
1,611,532,540,000
I have a systemd service running on a Raspberry Pi that reads the configuration from EEPROM and converts it into the .env format. This allows other programs to easily parse the configuration later on. I assume that the EEPROM variable has to be read and parsed every time the system boots and that the .env file needs to be removed every time the system is shut down. My problem is where to put the .env file. I considered using the /tmp directory, but it is intended for files to be present only as long as the application is running. Next, I thought of using /run, but from what I have read, it is meant for locks and PID. This is also the case for all the variations of /var/tmp. Finally, I am thinking of storing it in /etc/my_app and then using the tmpfiles.d routine to clean it every time the system boots up. The file serves the purpose for both systemd routines and later for user applications.
/run or previously /var/run would be the most appropriate location. Systemd itself follows the model of generating temporary configs in /run, specifically under /run/systemd (which would override those in /lib/systemd). For example, your entire /etc/fstab is converted to .mount units under /run/systemd/generator on every system boot. (It was actually systemd development that relocated it to /run from /var/run, and it was done specifically to provide a place for all kinds of "runtime data" – not just "PIDs and locks"; systemd doesn't even use PID files anyway.)
Where to place config file created by systemd
1,611,532,540,000
As suggested by Zac Anger, i copy this question over here: I have a yocto recipe in which I copy/install some stuff to an image. After that, I want to add a line to the /etc/ld.so.conf file like this, so that the dynamic loader finds my library files: do_install(){ # install some stuff... echo /opt/myStuff/lib >> /etc/ld.so.conf ldconfig } During the build process I get the following error which aborts the build process: ... | DEBUG: Python function extend_recipe_sysroot finished | DEBUG: Executing shell function do_install | /home/debian/Devel/myYocto/build/tmp/work/myTarget/myRecipe/1.0-r0/temp/run.do_install.3176: 203: cannot create /etc/ld.so.conf: Permission denied | WARNING: exit code 2 from a shell command. ERROR: Task (/home/debian/Devel/myYocto/poky/meta-myLayer/myRecipe/myRecipe.bb:do_install) failed with exit code '1' Now to my question: How do I add a custom path to the dynamic loader by adding a line or editing the /etc/ld.so.conf file in a yocto recipe?
I suppose you want that addition in the /etc/ld.so.conf of your target system, but echo /opt/myStuff/lib >> /etc/ld.so.conf would change that file on your build host. Fortunally, this gives an error. Your target rootfs is $D, so your file would be unter $D/etc/ld.so.conf, but more generally, the file doesn't need to be located in /etc, so you would use ${D}${sysconfdir}/ld.so.conf. But then you experienced the problem that you can't do that in do_install(), because different receipes would generate separate ld.so.conf, leading to conflicts. Thus, better work with a ld.so.conf.d: install -d ${D}${sysconfdir}/ld.so.conf.d/ echo /opt/myStuff/lib >> ${D}${sysconfdir}/ld.so.conf.d/myStuff.conf Or, even better, put that file in your recipe and do install -m 0755 ${WORKDIR}/myStuff.conf ${D}${sysconfdir}/ld.so.conf.d/ Also, don't run ldconfig on your host. Some Yocto magic will update your library cache anyhow.
How do I edit '/etc/ld.so.conf' in a yocto recipe?
1,611,532,540,000
I need some pointers on how to debug this further. My setup looks like this: Hardware: CM3 Pi Firmware boots u-boot, u-boot loads FIT image and is supposed to boot it. FIT image contains the kernel (uncompressed, ~7MB), device-tree, ramdisk (~2.5MB) Kernel is 5.15, u-boot is 2022.01 The FIT image loads and verifies fine, my bootargs are set and from what I can tell, all should be valid. The issue happened after updating the kernel from 4.19 to 5.15 (via a Yocto update, image size increased roughly 3 MB). I tried enabling earlyprintk, but that either did nothing or we don't even come far enough for that. Relevant part of the boot script (there's some bunch of hopefully unrelated stuff in there): load mmc 0:2 $ramdisk_addr_r "/boot"$kernel_image # "ramdisk_addr_r" is 0x02700000 # "fit_conf" is #conf-bcm2710-rpi-cm3.dtb#conf-overlays_i2c-ds1307.dtbo#conf-overlays_audio-on.dtbo#conf-overlays_gpio43-reset.dtbo#conf-overlays_mmc-non-removable.dtbo#conf-overlays_spi.dtbo bootm "${ramdisk_addr_r}${fit_conf}" Boot arguments (some very likely unrelated stuff stripped): console=ttyAMA0,115200 earlyprintk 8250.nr_uarts=1 bcm2708_fb.fbwidth=480 bcm2708_fb.fbheight=800 bcm2708_fb.fbswap=1 dwc_otg.lpm_enable=0 usbhid.mousepoll=0 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 cma=512M fbcon=vc:2-4 logo.nologo video=HDMI-A-1:480x800MR-24@60 dwc_otg.microframe_schedule=1 smsc95xx.turbo_mode=N root=/dev/ram0 rw rootwait rootdelay=2 ramdisk_size=8192 panic=10 The log with all debugging options I could find (first part is rpi firmware): Raspberry Pi Bootcode Found SD card, config.txt = 1, start.elf = 1, recovery.elf = 0, timeout = 0 Read File: config.txt, 36655 (bytes) Raspberry Pi Bootcode Read File: config.txt, 36655 Read File: start.elf, 2973536 (bytes) Read File: fixup.dat, 7262 (bytes) MESS:00:00:03.766632:0: brfs: File read: /mfs/sd/config.txt MESS:00:00:03.790677:0: brfs: File read: 36655 bytes MESS:00:00:03.824492:0: brfs: File read: /mfs/sd/edid.dat MESS:00:00:03.828906:0: brfs: File read: 128 bytes MESS:00:00:03.833665:0: brfs: File read: /mfs/sd/config.txt MESS:00:00:03.838028:0: gpioman: gpioman_get_pin_num: pin FLASH_0_ENABLE not defined MESS:00:00:03.845480:0: gpioman: gpioman_get_pin_num: pin FLASH_0_INDICATOR not defined piSS:00:00:03.853227:0: gpioman: gpioman_get_pin_num: pin FMISEPLSAYS_S:0D0:A00 :0n3.o85t82 98d:0e: fgpiionmaen:d g _goman MEeSSt:0_0:p00i:0n3._86n43u16m:0:: gppioimann: gFpiLomAanSH__0g_IeNDtIC_ATpORi nnot_ dnefuMm:E pSinS L:ED0S_0PW:R_0OK0 n:ot0 d3ef.in8ed7 2n2ed1 9:0: gpioman: gpioman_get_pin_num: pin LEDS_PWR_OK not defined MESS:00:00:03.896414:0: gpioman: gpioman_get_pin_num: pin BT_ON not defined MESS:00:00:03.901684:0: gpioman: gpioman_get_pin_num: pin WL_ON not defined MESS:00:00:03.935160:0: gpioman: gpioman_get_pin_num: pin LEDS_PWR_OK not defined MESS:00:00:03.940993:0: *** Restart logging MESS:00:00:03.944864:0: brfs: File read: 36655 bytes MESS:00:00:03.970043:0: HDMI0: hdmi_pixel_encoding: 162000000 MESS:00:00:03.974816:0: gpioman: gpioman_get_pin_num: pin CAMERA_0_I2C_PORT not defined MESS:00:00:03.981831:0: dtb_file 'bcm2710-rpi-cm3.dtb' MESS:00:00:03.990825:0: brfs: File read: /mfs/sd/bcm2710-rpi-cm3.dtb MESS:00:00:03.995486:0: Loaded 'bcm2710-rpi-cm3.dtb' to 0x100 size 0x75b2 MESS:00:00:04.015999:0: brfs: File read: 30130 bytes MESS:00:00:04.096779:0: brfs: File read: /mfs/sd/config.txt MESS:00:00:04.123208:0: dtparam: i2c1=on MESS:00:00:04.134136:0: dtparam: i2c_arm=on MESS:00:00:04.145334:0: brfs: File read: 36655 bytes MESS:00:00:04.148795:0: Failed to load overlay 'vc4-kms-v3d' MESS:00:00:04.154137:0: dtparam: audio=on MESS:00:00:04.168070:0: brfs: File read: /mfs/sd/overlays/vc4-kms-v3d.dtbo MESS:00:00:04.179270:0: brfs: File read: /mfs/sd/cmdline.txt MESS:00:00:04.183258:0: Read command line from file 'cmdline.txt': MESS:00:00:04.189134:0: 'dwc_otg.lpm_enable=0 console=serial0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait' MESS:00:00:04.973468:0: gpioman: gpioman_get_pin_num: pin WL_ON not defined MESS:00:00:04.987033:0: brfs: File read: 89 bytes MESS:00:00:05.038864:0: brfs: File read: /mfs/sd/kernel7.img MESS:00:00:05.042831:0: Loaded 'kernel7.img' to 0x8000 size 0x85f1c MESS:00:00:05.048833:0: Device tree loaded to 0x2eff8400 (size 0x7b09) MESS:00:00:05.056422:0: uart: Set PL011 baud rate to 103448.300000 Hz MESS:00:00:05.062784:0: uart: Baud rate change done... MESS:00:00:05.066216:0: uart: Baud rate change done... MESS:00:00:05.073531:0: gpioman: gpioman_get_pin_num: pin SDCARD_CONTROL_POWER not defined U-Boot 2022.01 (Jan 01 2000 - 00:00:00 +0000) DRAM: 960 MiB RPI Compute Module 3+ (0xa02100) MMC: mmc@7e202000: 0 Loading Environment from FAT... WARNING at drivers/mmc/bcm2835_sdhost.c:414/bcm2835_send_command()! WARNING at drivers/mmc/bcm2835_sdhost.c:414/bcm2835_send_command()! Unable to read "uboot.env" from mmc0:1... In: serial Out: vidconsole Err: vidconsole Net: No ethernet found. Hit any key to stop autoboot: 0 WARNING at drivers/mmc/bcm2835_sdhost.c:414/bcm2835_send_command()! WARNING at drivers/mmc/bcm2835_sdhost.c:414/bcm2835_send_command()! switch to partitions #0, OK mmc0(part 0) is current device Scanning mmc 0:1... Found U-Boot script /boot.scr 177 bytes read in 1 ms (172.9 KiB/s) ## Executing script at 02400000 1551 bytes read in 1 ms (1.5 MiB/s) Saving Environment to FAT... OK 669 bytes read in 1 ms (653.3 KiB/s) ostree_root=/ostree/boot.1/poky/2b3c8673ae53eb1a02210e627c06ac617b0e758fbf71afa0c7e91a8ff5931aeb/0 215 bytes read in 5 ms (42 KiB/s) 9269132 bytes read in 387 ms (22.8 MiB/s) ## Loading kernel from FIT Image at 02700000 ... Using 'conf-bcm2710-rpi-cm3.dtb' configuration Trying 'kernel-1' kernel subimage Description: Linux kernel Type: Kernel Image Compression: uncompressed Data Start: 0x02700110 Data Size: 6631488 Bytes = 6.3 MiB Architecture: ARM OS: Linux Load Address: 0x00008000 Entry Point: 0x00080000 Hash algo: sha256 Hash value: 6ff211d7430e5179b546ad46e3783fbe797e036302c9d55a0adaf09b03a7ad40 Verifying Hash Integrity ... sha256+ OK ## Loading ramdisk from FIT Image at 02700000 ... Using 'conf-bcm2710-rpi-cm3.dtb' configuration Trying 'ramdisk-1' ramdisk subimage Description: initramfs-ostree-image Type: RAMDisk Image Compression: uncompressed Data Start: 0x02d5be80 Data Size: 2599324 Bytes = 2.5 MiB Architecture: ARM OS: Linux Load Address: unavailable Entry Point: unavailable Hash algo: sha256 Hash value: f10f8afa25b5416fdf6f2790c087661999c5502260ec8e2e3caff5d9d9a48632 Verifying Hash Integrity ... sha256+ OK ## Loading fdt from FIT Image at 02700000 ... Using 'conf-bcm2710-rpi-cm3.dtb' configuration Trying 'fdt-bcm2710-rpi-cm3.dtb' fdt subimage Description: Flattened Device Tree blob Type: Flat Device Tree Compression: uncompressed Data Start: 0x02d53260 Data Size: 30130 Bytes = 29.4 KiB Architecture: ARM Load Address: 0x05000000 Hash algo: sha256 Hash value: 50c601276d58a4a1daded000c4d8a7a5ef917436a9e483675ff8e93265d6c294 Verifying Hash Integrity ... sha256+ OK Loading fdt from 0x02d53260 to 0x05000000 ## Loading fdt from FIT Image at 02700000 ... Using 'conf-overlays_i2c-ds1307.dtbo' configuration Trying 'fdt-overlays_i2c-ds1307.dtbo' fdt subimage Description: Flattened Device Tree blob Type: Flat Device Tree Compression: uncompressed Data Start: 0x02d5a908 Data Size: 508 Bytes = 508 Bytes Architecture: ARM Load Address: 0x06000000 Hash algo: sha256 Hash value: 2efdf54d40f36118a2f771de7b412bcdcb56819bfd646719a429b1580a9b67bd Verifying Hash Integrity ... sha256+ OK ## Loading fdt from FIT Image at 02700000 ... Using 'conf-overlays_audio-on.dtbo' configuration Trying 'fdt-overlays_audio-on.dtbo' fdt subimage Description: Flattened Device Tree blob Type: Flat Device Tree Compression: uncompressed Data Start: 0x02d5abf4 Data Size: 263 Bytes = 263 Bytes Architecture: ARM Load Address: 0x06000000 Hash algo: sha256 Hash value: c5dfd7893d0248f2c966995fe332cdb075771d398326c0c997e43120c793b818 Verifying Hash Integrity ... sha256+ OK ## Loading fdt from FIT Image at 02700000 ... Using 'conf-overlays_gpio43-reset.dtbo' configuration Trying 'fdt-overlays_gpio43-reset.dtbo' fdt subimage Description: Flattened Device Tree blob Type: Flat Device Tree Compression: uncompressed Data Start: 0x02d5adf0 Data Size: 1340 Bytes = 1.3 KiB Architecture: ARM Load Address: 0x06000000 Hash algo: sha256 Hash value: c9fc421b77391ae8323147007cef422c1c80246aa8606927a93fe1ecb122fdbd Verifying Hash Integrity ... sha256+ OK ## Loading fdt from FIT Image at 02700000 ... Using 'conf-overlays_mmc-non-removable.dtbo' configuration Trying 'fdt-overlays_mmc-non-removable.dtbo' fdt subimage Description: Flattened Device Tree blob Type: Flat Device Tree Compression: uncompressed Data Start: 0x02d5b424 Data Size: 263 Bytes = 263 Bytes Architecture: ARM Load Address: 0x06000000 Hash algo: sha256 Hash value: 06a9b23fac0a5d75e671107fcecbf556ababc4d4fe25218ba47d1803024aa751 Verifying Hash Integrity ... sha256+ OK ## Loading fdt from FIT Image at 02700000 ... Using 'conf-overlays_spi.dtbo' configuration Trying 'fdt-overlays_spi.dtbo' fdt subimage Description: Flattened Device Tree blob Type: Flat Device Tree Compression: uncompressed Data Start: 0x02d5b618 Data Size: 1930 Bytes = 1.9 KiB Architecture: ARM Load Address: 0x06000000 Hash algo: sha256 Hash value: 024bf878c83abe13ecb49273611177a1b72f0975377a34ad077977f023c1bb79 Verifying Hash Integrity ... sha256+ OK Booting using the fdt blob at 0x5000000 Loading Kernel Image Using Device Tree in place at 05000000, end 0500ad04 Starting kernel ... How can I find out what's blocking my boot?
According to your U-Boot ouput, you have an unusual offset of 0x78000 from the start of kernel to the address where the kernel is run: Load Address: 0x00008000 Entry Point: 0x00080000 The typical case is that you jump into the kernel at the start of the image, so either of the addresses probably has one zero too much or one zero missing (as you confirmed in your answer to my comment).
u-boot/linux hangs after "Starting Linux...."
1,611,532,540,000
Waveshare makes a great CAN HAT for the Raspberry Pi (see here), but the instructions only work for Raspberry Pi OS, not for Armbian. The Banana Pi BPI-M2 Zero has the same pin header layout as the Raspberry Pi, but runs Armbian. How do you setup the Waveshare CAN HAT using Armbian's overlay system?
Overlays work slightly differently on Armbian than on Raspberry Pi OS. For this, there are two things you need. First, you need to enable SPI bus zero. This can be done by editing the file /boot/armbianEnv.txt. Add the following two lines to the file: overlays=spi-spidev param_spidev_spi_bus=0 If there is already a line that says overlays= you will need to add spi-spidev to the same line, as all of the system overlays have to be specified in the same command. Next, you need a DTS file, which essentially maps various driver parameters to their specific implementation on the board you are working with. I used this file (copied below) which seemed to match the specific board that Waveshare ships. The file should be named spi-mcp251x.dts. The file can be compiled and installed with the command armbian-add-overlay spi-mcp251x.dts, which will also add it to /boot/armbianEnv.txt. Then, on reboot, you should have a working CAN driver! The contents of the spi-mcp251x.dts file are below: /dts-v1/; /plugin/; / { compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5"; fragment@0 { target-path = "/clocks"; __overlay__ { #address-cells = <1>; #size-cells = <1>; can0_osc_fixed: can0_osc_fixed { compatible = "fixed-clock"; #clock-cells = <0>; clock-frequency = <12000000>; }; }; }; fragment@1 { target = <&pio>; __overlay__ { can0_pin_irq: can0_pin_irq { pins = "PA2"; function = "irq"; bias-pull-up; }; }; }; fragment@2 { target = <&spi0>; __overlay__ { #address-cells = <1>; #size-cells = <0>; status = "okay"; mcp2515 { reg = <0>; compatible = "microchip,mcp2515"; pinctrl-names = "default"; pinctrl-0 = <&can0_pin_irq>; spi-max-frequency = <2000000>; interrupt-parent = <&pio>; interrupts = <0 2 8>; /* PA2 IRQ_TYPE_LEVEL_LOW */ clocks = <&can0_osc_fixed>; status = "okay"; }; }; }; };
Getting a Waveshare CAN HAT working on a Banana Pi BPI-M2 Zero
1,611,532,540,000
I have irq/21-xhci-hcd displayed as the process consuming 90% CPU on top. There was also a lot of CPU time spent on servicing software interrupts (si). This is on embedded Linux. Does this mean that it's IRQ 21? Can I then use lspci -vvv to get more info on IRQ 21? If that's not the case, do I need to use other methods like doing dmesg or watch -n1 -d "cat /proc/interrupts"? What's the best way to get more info on this, including which kernel module is affected? Which kernel thread and function is responsible?
xhci stands for eXtensible Host Controller Interface which is standard for USB 3.0 "SuperSpeed" host controller hardware. irq/21-xhci-hcd is likely to represent the irq associated to one particular usb bus. (Which can host several different usb devices) lsusb -t utility should give you more information (and lsusb -vt even more) regarding the individual devices, the bus they are connected to as well as the drivers involved (one for the bus and another for the device itself) in particular. The problem you notice could be the fact of one particular very busy or ill-functionning usb device. You should be able to identify it (thanks to the lsusb utility) and physically remove it (if possible) and re-test. Time spent servicing software interrupts are likely to be but not necessarily related. You could check if they evolve in the same order of magnitude viewing /proc/stat watching in particular the "tasklet" soft-irq periodically. Regarding the latter while the info is reported as part of /proc/stat, one might find easier to watch /proc/softirqs (because of the explicit labels)
How to get more details on irq process in top?
1,611,532,540,000
Overview I am in the process of reverse engineering the software on my Infiniti Q50 head unit, and I am trying to figure out the best way to get shell access. I have pulled the image off of the microSD card and flashed it to another microSD that I am modifying, it runs a heavily modified version of Meego which was discontinued a while ago and I can't find docs for because it just goes to the Tizen website. Background The head unit itself has diagnostic connectors board edge connectors that are not accessible while plugged in, so I want to get shell via Bluetooth or the attached USB-A ports The linux system partition was readonly with a separate home partition, but I enabled write access in the bootloader There are udev rules in place to automount USB drives (for infotainment system & updates) I have full root filesystem access and I can add/change any files on the system including adding scripts to systemd I do not have network access or shell access I can answer any other questions you may have about the system Kernel Modules Below is a GitHub gist of the /lib/2.6.37.6-35.1_DLK0041-android-intel-crossville_lapis-fastboot/kernel/ folder Kernel Modules
Something like this has worked for me in the past in a similar situation: Check, if the directory of driver modules contains one or more modules for one of the popular USB-Serial adapter chips If not, you could compile one of them.Maybe you'll need to cross-compile on a different host architecture Find/Buy a USB-Serial adapter, that uses the correct chip for the driver module you found/compiled above. Modify the rootfs to start a getty on (what I assume will then be) /dev/ttyUSB0 Connect all the hardware login via this serial connection.
Shell/tty Access via USB or Bluetooth?
1,611,532,540,000
I'm trying to get the WiFi working on a Banana PI M2M using the mainline kernel. The device tree definition of the banana pi m2m is very incomplete sun8i-r16-bananapi-m2m.dts I successfully managed to get SPI working but I am now struggling to get the WiFi drivers working as they should. The banana pi M2M uses the AP6212 chip which from the looks of it uses a BRCM4329 chip. The AP6212 is connected through the SDIO1 to the allwinner A33, PL6 is connected WL_PMU_EN and PL7 is connected to WL-WAKE-AP. (https://drive.google.com/file/d/0B4PAo2nW2KfndHY1VF9UWXl2Rm8/view?usp=sharing) I've modified the dts with the following: &mmc1 { pinctrl-names = "default"; pinctrl-0 = <&mmc1_pg_pins>; vmmc-supply = <&reg_aldo1>; mmc-pwrseq = <&wifi_pwrseq>; bus-width = <4>; non-removable; status = "okay"; brcmf: wifi@1 { reg = <1>; compatible = "brcm,bcm4329-fmac"; interrupt-parent = <&r_pio>; interrupts = <0 7 IRQ_TYPE_LEVEL_LOW>; /* PL7 */ interrupt-names = "host-wake"; }; }; I've enabled in the kernel 80211, the bcrm-fmac driver and brcm-fmac-sdio. In buildroot I've added the wireless-regdb package. I've also copied from the bananapi official image (kernel 3.4) the /lib/firmware/brcm to get the firmware and config. At the point I can load the driver with modprobe but I get a timeout issue and not too sure where to look from here... # modprobe brcmfmac [ 67.440758] cfg80211: Loading compiled-in X.509 certificates for regulatory database [ 67.513578] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7' [ 67.595615] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1 # [ 68.745996] brcmfmac: brcmf_sdio_htclk: HT Avail timeout (1000000): clkctl 0x50 [ 69.767856] brcmfmac: brcmf_sdio_htclk: HT Avail timeout (1000000): clkctl 0x50 My guess (but it's really just a guess) is that i'm missing some steps to properly wake up the wifi chip but measuring on the board it looks like the different rails are at the right level. Has anyone by any chance got a recent kernel working with the different drivers on a banana pi m2m? Thanks for any answers or tips!
I have same board and also want to use mainline Linux. I found this line in 3.4 kernel log of Banana pi m2m bsp: [ 14.519605] DHD: dongle ram size is set to 524288(orig 524288) at 0x0 [ 14.535387] dhd_conf_read_others: ccode = CN [ 14.535623] dhd_conf_read_others: regrev = 0 [ 14.535763] Final fw_path=/lib/firmware/ap6212/fw_bcm43438a1.bin [ 14.535959] Final nv_path=/lib/firmware/ap6212/nvram.txt So, copy /lib/firmware/ap6212/fw_bcm43438a1.bin to /lib/firmware/brcm/brcmfmac43430-sdio.bin and copy /lib/firmware/ap6212/nvram.txt to /lib/firmware/brcm/brcmfmac43430-sdio.sinovoip,bananapi-m2m.txt and it works. I have got working Wi-Fi now.
Banana PI M2M (allwinner A33/R16) WiFI drivers in mainline kernel
1,611,532,540,000
I'm working on an embedded device that runs Yocto Poky as distro. The final product will have several applications that are started by SysVinit. There is only one root user. I have some scripts, both in /etc/init.d and /etc/profile.d that add some environment variables needed by our applications. The problem I'm facing is that, if I run the app "by hand" (so I have an interactive shell) they run nicely, since the scripts in /etc/profile.d/ were sourced, but when ran by SysVinit, they cannot find the environment populated (obviously). We are using sh as shell. I read about different files like .bashrc, .profile and some variables like ENV and BASH_ENV. I tried to define my variables there, but without luck. A small workaround I found is launching my main application in a login shell (from SysVinit): 2:12345:once:/bin/sh -lc /usr/bin/my_app So my questions are: How can I set the environment during boot (aka without logging in) or let SysVinit do it in a nice way? The exports performed in /etc/init.d scripts do not propagate to my environment at all; that's because those scripts are run in a subshell, and not sourced in the current one (that will required login two) I guess, so how can I export variables from there? Is my workaround a valid solution?
How can I set the environment during boot (aka without logging in) or let SysVinit doing it, in a nice way? During the boot environment is clean (isn't initialised jet). You need put env variables via source or . commands for sh (if your service is a script) or initialise it in the program (i.e. via config file). Small example of service script header: #!/bin/bash [ -f /etc/profile.d/needed.sh ] && . /etc/profile.d/needed.sh . . . The exports performed in /etc/init.d scripts do not propagate to my environment at all, that's because those script are run in a subshell, and not sourced in the current one (that will required login two) I guess, so how can I export variables from there? source your env variables for subshells or call commands with specified env variable. Small example of service script header: #!/bin/bash . . . $(BASH_ENV=/etc/profile.d/needed.sh command) $(ENV_VAR1=value1 command) . . . Is my workaround a valid solution? If it's work - it's dirty way for the service. See 1. and 2.
Populate environment in non-interactive session
1,555,242,594,000
Why do I want this? I use the pwm-ir-tx kernel module to blast IR signals from my embedded device. However, when the pwm kernel module is loaded during the boot process, the pin is on high. It takes about 10 seconds or so until I can set it to low with a lirc irsend signal. You can in principle 'overload' the IR-LED to make it brighter, if it is only used in PWM mode and not permanently on. The 10 seconds during the boot process undermine this strategy, however. What is my system doing so far (e.g. what's working, DT-Overlay file, etc)? I am using Armbian and modified the pwm-ir-tx driver in the mainline kernel, so that the state after a send is guaranteed low (setting duty cycle to 0, it was randomly 1 or 0 when just disabling the pwm channel on my device). I am using a device tree overlay that activates the pwm and the pwm-ir-tx. /dts-v1/; /plugin/; / { compatible = "allwinner,sun4i-a10"; fragment@0 { target = <&pwm>; __overlay__ { pinctrl-names = "default"; pinctrl-0 = <&pwm0_pin>, <&pwm1_pin>; status = "okay"; }; }; fragment@1 { target-path = "/"; __overlay__ { pwm-ir-transmitter { compatible = "pwm-ir-tx"; pwms = <&pwm 0 0 0>; }; }; }; }; When I boot, the pwm-sun4i modules and pwm-ir-tx are loaded and a /dev/lircx character device is available to be used. To turn the LED off, I enabled a systemd service 'lircd-out' with the Unit entry 'After=lircd.service', that turns the led off, but it runs about 10 seconds after the boot process. Setting modules in the DT Overlay to "disabled" and loading them with modprobe afterwards is not working (not creating pwm or rc devices in sysfs, or a /dev/lircx character device). Maybe since those modules are built in (i.e. configured with 'Y', not 'M' in the .config file), but I must admit my understanding is still a bit fuzzy, here. What would be ideal? The ability to control the loading of the modules pwm-sun4i and pwm-ir-tx and thus be able to run a script after pwm-sun4i was loaded that sets the pwm pin to low and then load pwm-ir-tx. But as I mentioned, when I load those modules manually, they are somehow not accessible for the sysfs. Alternatively, I could pass a parameter in the fragment@0 to the pwm that sets it to low. But I do not know how and do not see anything in the code of pwm-sun4i.c that would allow this. I do not want to modify the kernel source to keep it compatible for updates. Any suggestions?
Create an udev rule to match it. It shouldn't be necessary to run the script "after a module is loaded" – it deals with a specific device, so it would be better to run it "after the device is detected". Doesn't matter how the device was detected; as long as the kernel reports it as a 'new' device, it'll work. That said, modules have a presence in /sys just like devices, which means they too can trigger udev rules, and even have systemd .device units generated for them. For example, to trigger a service as soon as pwm-sun4i loads, use this udev rule: ACTION=="add", SUBSYSTEM=="module", KERNEL=="pwl-sun4i", \ TAG+="systemd", ENV{SYSTEMD_WANTS}+="fixup-pwl.service" To run a simple oneshot command: ACTION=="add", SUBSYSTEM=="module", KERNEL=="pwl-sun4i", RUN+="/etc/fix-pwl.sh"
Run script after module is loaded due to device tree
1,555,242,594,000
I get the following warning on debian linux (kernel 4.18.8) bootup of my microchip sama5d3 board: mmc0: unrecognised SCR structure version 4 mmc0: error -22 whilst initialising SD card after spewing this about 30 times I get the following and the linux boot completes mmc0: host does not support reading read-only switch, assuming write-enable mmc0: new SDHC card at address 0007 mmcblk0: mmc0:0007 SD4GB 3.71 GiB I have tried several different SD cards and get the same result, with the only variation being the version number. I found the following online https://groups.google.com/forum/#!topic/beagleboard/A4zfNvyMmVI: SCR is a register defined by MMC/SD standard, and the data should be read by the data bus, instead of the cmd bus as most predefined registers do. The omap_hsmmc_request function of the TI HSMMC driver tries to read in the SCR data by DMA, and this always returns garbage. Sometimes the SCR check gets passed, because the garbage data happens to be a valid SCR data The linux kernel just checks to see if the SCR version is not 0, if so it produces the error. My dts file for mmc0 is as follows: mmc0: mmc@f0000000 { pinctrl-0 = <&pinctrl_mmc0_clk_cmd_dat0 &pinctrl_mmc0_dat1_3>; status = "okay"; slot@0 { reg = <0>; bus-width = <8>; }; };
Updating to kernel 4.20 the error no longer appears. I can't determine exactly which kernel commit fixed it. There are a few that might have played a roll, but nothing I could identify as an exact fit.
mmc0 warning on SD card bootup of linux
1,555,242,594,000
I have an IP Camera from Thundersoft with a Qualcomm Snapdragon 625 chip inside that runs a Linux distribution. It is extremely limited in terms of available commands, and I can't install any new commands without reflashing it (and I'm trying to avoid that). I'm trying to connect the camera to an external machine learning API, to process the frames from the camera, but I can't connect the camera to the internet and I don't really know how to address the problem. I tried connecting it through an ethernet cable (it works perfectly on my computer), but when I run ifconfig it returns: br0 Link encap:Ethernet HWaddr 00:0A:F5:27:C8:C4 inet6 addr: fe80::20a:f5ff:fe27:c8c4/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:268 errors:0 dropped:0 overruns:0 frame:0 TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:22048 (21.5 KiB) TX bytes:536 (536.0 B) eth0 Link encap:Ethernet HWaddr 00:0E:C6:8E:EE:C6 inet6 addr: fe80::20e:c6ff:fe8e:eec6/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1497 errors:3 dropped:2 overruns:0 frame:3 TX packets:17 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:861688 (841.4 KiB) TX bytes:1502 (1.4 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:8 errors:0 dropped:0 overruns:0 frame:0 TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:448 (448.0 B) TX bytes:448 (448.0 B) wlan0 Link encap:Ethernet HWaddr 00:0A:F5:27:C8:C4 inet6 addr: fe80::20a:f5ff:fe27:c8c4/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:284 errors:0 dropped:1140 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:27096 (26.4 KiB) What should I do to diagnose and solve the problem? [EDIT AFTER COMMENTS] The camera has two modes: USB and LAN, and they can't work at the same time. So in USB mode there's no dhcp client (or at least no process called dhc), but when I run ps in LAN mode (with a program that runs on startup and logs to file, because I don't have access to shell on LAN mode), I get no output, so I don't really know the processes running. About the manual IP assignment, I've tried a few things I found, but I think the camera overwrites the configurations later, because the files change after reboot. My network does have a DHCP server.
First thing to try is to assign an IP address manually, ifconfig eth0 192.168.45.1 netmask 255.255.255.0 then use route to make sure that route is also set. Finally do the same on the PC it is connected to, using 192.168.45.2. Now check with ping if they can reach each other. If they can't, next step is to figure out how the IP cam uses the bridge br0; possibly it should get the IP address instead, if eth0 is a port in the bridge. As soon as anything works, you can think about DHCP and how to automate it.
IP Camera with embedded Linux won't connect to internet using ethernet
1,555,242,594,000
We are developing embedded device which will integrate with some of our services in future. This device have limited set of functionalities and user defined mods for particular use cases. Based on arm architecture this device running modified version of Debian. For network and main configuration setup I need to write small web service. This should be secure and light. I tested this with mix of lightweight web servers such as lighttpd and languages like python and manged to get prototype working. which have the functioning web service and that web service can integrate with clients which push the configuration in initial step. My concern is even though this is lightweight I dont need to deploy full featured web server on devices which have high level of access to the device for configure it. even though I disable this process after the configuring Is there any way to have small rest api other than having full-blown web server ? I already tested restbed C++ rest api. which is complex and python based server less web service. but I don't want to deploy python either. since this service only transmit like below 10 parameters to the client and it's overkill. is there any secure way to implement this without daemon like service.
Although this question is a little vague and open to opinion I'll throw mine out there. Golang Has a very easy to use server package right in the standard library. It looks a lot like C, compiles to native executables on almost any platform and architecture and you can host a very simple webserver with very few lines as in below. package main import ( "fmt" "log" "net/http" ) func handler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hi there, I love %s!", r.URL.Path[1:]) } func main() { http.HandleFunc("/", handler) log.Fatal(http.ListenAndServe(":8080", nil)) } If you want security you can very easily set up TLS by creating some self signed certs, and simply replacing the http.ListenAndServe with err := http.ListenAndServeTLS(":10443", "cert.pem", "key.pem", nil) It's very lightweight and easy to run anywhere. As Eli smartly pointed out in the comments, cross compilation is also very easy to do, meaning quick builds and deploys to your embedded devices.
writing small web service for embedded device based on debian [closed]
1,555,242,594,000
I am preparing a new linux kernel for Pine64, because it is slow, I did the cross-compilation on a linux PC. I am looking for a way to run make install && make install modules without copying the whole ~3GB of source and object files of the compiled kernel over to the Pine64 just to install the compiled binaries. Is there a way to either create some "installation package" or just omit the unneeded files (*.o, *.c, ...)?
You can install the modules to an alternate path: mkdir /tmp/pine64 make modules_install INSTALL_MOD_PATH=/tmp/pine64 Then you can copy the modules from /tmp/pine64, and the bzImage kernel image, to your Pine64. Another approach is to build a binary package: make binrpm-pkg or make bindeb-pkg depending on your target distribution. This will produce a package containing the kernel and modules.
Installing a cross-compiled linux kernel on Pine64(or Raspberry Pi or any other similar Single Board Computer)
1,555,242,594,000
I'm building my own Embedded Linux OS for Raspberry PI3 using Buildroot. This OS will be used to handle several applications, one of them performs objects detection based on OpenCV (v3.3.0). I started with Raspbian Jessy + Python but it turned out that it takes a lot of time to execute a simple example, So I decided to design my own RTOS with Optimized features + C++ development instead of Python. I thought that with these optimizations the 4 cores of RPI + the 1GB RAM will handle such applications. The problem is that even with these things, the simplest Computer Vision programs take a lot of time. PC vs. Raspberry PI3 Comparaison This is a simple program I wrote to have an idea of the order of magnitude of execution time of each part of the program. #include <stdio.h> #include "opencv2/core.hpp" #include "opencv2/imgproc.hpp" #include "opencv2/highgui.hpp" #include <time.h> /* clock_t, clock, CLOCKS_PER_SEC */ using namespace cv; using namespace std; int main() { setUseOptimized(true); clock_t t_access, t_proc, t_save, t_total; // Access time. t_access = clock(); Mat img0 = imread("img0.jpg", IMREAD_COLOR);// takes ~90ms t_access = clock() - t_access; // Processing time t_proc = clock(); cvtColor(img0, img0, CV_BGR2GRAY); blur(img0, img0, Size(9,9));// takes ~18ms t_proc = clock() - t_proc; // Saving time t_save = clock(); imwrite("img1.jpg", img0); t_save = clock() - t_save; t_total = t_access + t_proc + t_save; //printf("CLOCKS_PER_SEC = %d\n\n", CLOCKS_PER_SEC); printf("(TEST 0) Total execution time\t %d cycles \t= %f ms!\n", t_total,((float)t_total)*1000./CLOCKS_PER_SEC); printf("---->> Accessing in\t %d cycles \t= %f ms.\n", t_access,((float)t_access)*1000./CLOCKS_PER_SEC); printf("---->> Processing in\t %d cycles \t= %f ms.\n", t_proc,((float)t_proc)*1000./CLOCKS_PER_SEC); printf("---->> Saving in\t %d cycles \t= %f ms.\n", t_save,((float)t_save)*1000./CLOCKS_PER_SEC); return 0; } Results of Execution on an i7 PC Results of Execution on Raspberry PI (Generated OS from Buildroot) As you can see there is a huge difference. What I need is to optimize every single detail so that this example processing step occurs in "near" real-time at in a maximum 15ms time. My question is about: How can I optimize my OS so that it can handle intensive calculations applications and how can control the priorities of each part? How can I fully use the 4 Cores of RPI3 to fulfill the requirements? Is there any other possibilities instead of OpenCV? Should I use C instead of C++? Any hardware improvements you recommend?
In order: How can I optimize my OS so that it can handle intensive calculations applications and how can control the priorities of each part? For general optimization, there's not much you can do on the OS side beyond the normal stuff like making sure you have only what you actually need running in the background. On the original Pi, you could speed up memmove() and similar functions by LD_PRELOAD'ing a library called 'cofi' that provided assembly optimized versions of those functions, but I'm not sure if it will help on a Pi 3. For prioritization, that's really something to look at man pages for, but you generally can't do it unless you parallelize things (in your case, it seems like the obvious solution is to run each step as it's won process and use IPC (probably shared memory for performance reasons) to move the data between them). On the note of the results you quoted from your test program, notice in particular that the processing and saving steps are both about 10 times slower on the Pi, while the access step is only about 5 times slower, and those numbers match up with a rough estimate of what I would expect when comparing a Pi 3 to a generic PC that's less than a year old. The CPU in the Pi is almost certainly significantly slower than what you ran the PC test on (and if you didn't parallelize things at all, then the gap widens even more, as most modern x86 CPU's can run a single core by itself at full load much faster than they can run all their cores at full load), and that will have an impact. The ARM ISA is also significantly different from the x86 ISA (ARM tends to do less per-cycle compared to x86, but doesn't usually need to access RAM as often and usually doesn't make branch prediction misses as expensive as x86 does), so any code that's optimized for how GCC arranges things on a PC is not going to be as optimal on a Pi. I don't know about what camera you're using either, but I would expect that you could get better times by cutting the resolution of the images you're processing, and you can probably cut down on the acquisition time if you avoid using compressed formats (and not using lossy compression means that the resolution won't matter as much). How can I fully use the 4 Cores of RPI3 to fulfill the requirements? Parallelization in your own code. You just need to make sure SMP is enabled in your kernel (and if you're using the official config from the RPi Foundation, it should be), and then try to run things in parallel. I'm not certain how much OpenCV does to parallelize things itself, but you may want to look at OpenMP as well (it provides a reasonably easy way to parallelize iterations in loops that aren't interdependent). Is there any other possibilities instead of OpenCV? There might be, but everyone's standardized on OpenCV, so I would suggest using that (you'll have an easier time getting technical help with implementing things because everyone uses it). Should I use C instead of C++? That depends on how you're using things. While it's a lot easier to write slow code in C++ than C, it's no more difficult to write fast code in either language. A lot of the optimization techniques are pretty similar in both languages (for example, pre-allocating everything at startup so you aren't calling malloc() in critical sections, or avoiding calling stat()). In the case of C++ specifically though, avoid std::string like the plague, it calls malloc() all over the place, and as a result is insanely slow (I've seen conversions that switch from std::string to C-style strings improve performance by over 40% in some cases). Any hardware improvements you recommend? Under the assumption that you're trying to keep hardware costs low and are space constrained (thus the choice of the Raspberry Pi), there aren't really any I can think of. The Pi (in all of it's iterations) uses a SoC that's pretty uniquely suited for computer vision work at that price range. If you are willing to go with something a bit bigger, and somewhat more expensive, I might suggest an NVIDIA Jetson board (they use a Tegra SoC that's got a Quadro-equivalent GPU integrated with 192 CUDA cores, so it could probably run your processing workload much faster), but getting Buildroot working on there is significantly more involved than on a Pi. Edits in response to comments: Parallelization at a process level isn't the same thing as multithreading, it's drastically different (the biggest difference is in how resources get shared, by default threads share everything, process share nothing). In general, when there's lots of processing involved, you're (usually) better off using process-based parallelization, as it's easier to write efficient code without having to worry about thread safety. As far as options, the two you mentioned can have a big impact on system performance, but they both end up being trade-offs between throughput and latency. The preemption model controls how things running in kernel mode (like syscalls) can be rescheduled. The three options there are: No Preemption: This pretty much means that anything running in kernel mode can't be interrupted. It matches how SVR4 and 4.4BSD behaved, as well as how most other older UNIX systems work. It's very good for throughput, but very bad for latency, so it's generally only used on big servers with lots of CPU's (more CPU's means it's more likely that one will be running something that can be preempted). Voluntary Preemption: This lets each function in the kernel define locations that it can be rescheduled. This is the setting that most desktop targeted Linux distributions use, as it gives a good balance between throughput and latency. Full Preemption: This means that (almost) any code in the kernel can be interrupted at (almost) any time. This is useful for systems which need very low latency with respect to input and external events, such as systems used for real-time multimedia work. It's absolutely horrible for throughput, but you can't beat the latency. The timer frequency in contrast is much easier to explain. It controls the longest period of time that something can run uninterrupted if there is something else waiting to run. Higher values result in a shorter period of time (lower latency, and lower throughput), lower values a longer period (higher latency, and higher throughput). For a general start, I'd suggest setting the preemption model to voluntary, and the timer frequency to 300 Hz, and then start experimenting with changing the timer frequency first (as that will usually have a more visible impact). As for the Movidius NCS, whether or not it's worth it depends on how much data you need to work with because it will be bandwidth constrained by the USB connection (the Pi only has a single USB 2.0 controller, so not only are you limited to less than a tenth of the bandwidth the Movidius is designed for, you also have to share the bus with at least the Ethernet adapter, which will hurt both your latency and your throughput). If you're only doing single frames of 1920x1080 with 32-bit color at a low rate, then it might be viable, but if you need to do streaming processing of that same video at full frame rates, then you will probably run into latency issues. If you do choose to use one, make sure you get a powered hub for it (otherwise you may have issues with it trying to draw more power than the Pi can provide).
OpenCV based programs optimization embedded linux OS [closed]
1,555,242,594,000
Linux version 2.6.26.5 embedded system on board. Device use full Image's Kernel. File system stored on NAND Flash memory, Hynix NAND 32MiB 3,3V 8-bit. # printenv baudrate=115200 ethaddr=FF:FF:FF:FF:FF:FF netmask=255.255.255.0 ipaddr=192.168.1.1 serverip=192.168.1.100 bootfile=firetux.kernel bootcmd1=setenv bootargs ${bootargs} && nboot 0x20200000 0 ${image_addr} && bootm 0x20200000 bootcmd2=setenv bootargs ${bootargs} && tftpboot 20200000 firetux.kernel && bootm 20200000 phymode=auto mtdids=nand0=gen_nand unlock=yes verify=y update.uboot=echo Update u-boot && tftpboot 0x20000000 nandboot.flash && nand erase 0x0 0x03ffff && nand write.jffs2 0x20000000 0x0 ${filesize} update.kernel=echo Update kernel && tftpboot 0x20000000 uImage && nand erase 0x80000 0x180000 && nand write.jffs2 20000000 0x80000 0x180000 update.romimg=echo Update RomImage && tftpboot 0x20000000 romimage.img && nand erase 0x80000 0x13e0000&& nand write.jffs2 20000000 0x80000 ${filesize} update.halfimg=echo Update HalfImage && tftpboot 0x20000000 recovery.img && nand erase 0x1460000 0x700000&& nand write.jffs2 20000000 0x1460000 ${filesize} eraseenv=echo Erase Environment && nand erase 0x60000 0x20000 HwModel=Hw_Model=NXPi02 bootcmd=run bootcmd1 halfImage=half_image=0 cy_boot_code_ver=1.0.1 (Oct 6 2011 - 20:04:00) RouterMode=Router_Mode=0 stdin=serial stdout=serial stderr=serial bootcmd=run bootcmd1 image_addr=0x80000 bootargs=console=ttyS1,115200n8 rootfstype=squashfs noalign half_image=0 verify=y Hw_Model=NXPi02 Router_Mode=0 ethact=ETN1 bootdelay=3 Need to backup some areas of NAND memory (NVRAM) from U-boot, connection to board via serial interface (UART), network connection is not available. U-boot have certain options for managing nand memory: # help nand nand info - show available NAND devices nand device [dev] - show or set current device nand read - addr off|partition size nand write - addr off|partition size read/write 'size' bytes starting at offset 'off' to/from memory address 'addr', skipping bad blocks. nand erase [clean] [off size] - erase 'size' bytes from offset 'off' (entire device if not specified) nand bad - show bad blocks nand dump[.oob] off - dump page nand scrub - really clean NAND erasing bad blocks (UNSAFE) nand markbad off - mark bad block at offset (UNSAFE) nand biterr off - make a bit error at offset (UNSAFE) In particular, nand dump[.oob] off - dump page What is nand offset address for this? There was not specified partition size to dump. I need dump the whole NVRAM. After device loading Kernel Image, it creates 11 MTD partitions: Creating 11 MTD partitions on "gen_nand": 0x00000000-0x00060000 : "u-boot" 0x00060000-0x00080000 : "u-bootenv" 0x00080000-0x01460000 : "ROMIMAGE" 0x01460000-0x01b60000 : "HALFIMAGE" 0x00200000-0x01460000 : "LINUX_ROOTFS" 0x01b60000-0x01d60000 : "HS_FW" 0x01d60000-0x01e60000 : "FPAR" 0x01e60000-0x01ee0000 : "SNOM" 0x01ee0000-0x01f00000 : "EEPROM" 0x01f00000-0x01f80000 : "NVRAM" 0x01f80000-0x02000000 : "CA_DATA" Is the 0x01f00000 nvram offset address? What is nvram size? Is it 0x80000? U-boot also have command md - memory display. => help md md - memory display Usage: md [.b, .w, .l] address [# of objects] => I tried command md.b 0x01f00000 0x80000 to display nvram on terminal, but it doesn't output anything, terminal hungs up. EDIT: [an addition] # nand info Device 0: NAND 32MiB 3,3V 8-bit, sector size 16 KiB # nand device nand0 Device 0: NAND 32MiB 3,3V 8-bit... is now current device # nand read 0x20000000 NVRAM NAND read: mtdparts variable not set, see 'help mtdparts' incorrect device type in NVRAM 'NVRAM' is not a number # nand read 0x20000000 0x01f00000 0x00080000 NAND read: device 0 offset 0x1f00000, size 0x80000 524288 bytes read: OK BusyBox v1.10.2 (2015-09-06 10:58:05 CST) built-in shell (ash) Enter 'help' for a list of built-in commands. /bin/sh: can't access tty; job control turned off # help Built-in commands: ------------------- . : [ [[ alias bg break cd chdir continue echo eval exec exit export false fg hash help jobs let local pwd read readonly return set shift source test times trap true type ulimit umask unalias unset wait # ext4write LINUX_ROOTFS /NVRAM.img 0x20000000 0x00080000 /bin/sh: ext4write: not found
You're going to want to be more careful what you do with commands. The md command shows you memory at that location. When you use md.b it outputs in bytes which no doubt confuses your tty. Your command basically says send me all bytes in memory from 0x01f00000 to 0x01f00000 + 0x80000 over the line. Also nand dumb doesn't do what you think it does. Get devices nand info Set your device nand device nand0 Just use the name of the partition nand read 0x20000000 NVRAM 0x00080000 To be clear what this does: read 524288 (0x00080000 in hex) bytes from the partition nvram into memory location 0x20000000. You can also just omit the size if you want the whole partition. nand read 0x20000000 NVRAM Now with the NVRAM in memory you need to write it somewhere. Lets say an ext4 file system. ext4write LINUX_ROOTFS /NVRAM.img 0x20000000 0x00080000
Backup Nand Flash memory area
1,555,242,594,000
What is proper syntax for setenv bootargs command when using shorthand syntax for method? For example, the full kernel environment variables is U-Boot> setenv bootargs console=ttyS1,115200n8 rootfstype=squashfs noalign half_image=0 verify=y Hw_Model=pnx8181 Router_Mode=0 I want to add 2 bootargs to the mentioned code,single and init=/bin/sh. Is the following command with shorthand syntax correct? setenv bootargs ${bootargs} single init=/bin/sh No single quotes are required anywhere?
Yes, that syntax should work fine. If you're in doubt, you can double check by running printenv bootargs. By the way, you can also run editenv bootargs which will let you arrow over wherever you want and edit the variable easily. If you're trying to make your change persistent, you need to run saveenv to keep the changes for the next reboot.
Shorthand syntax for U-Boot arguments
1,555,242,594,000
I am working on an embedded linux board with a freescale cpu and an ltib built linux on it. The appliance has two network interfaces and here is the output of ifconfig and route commands: [root@sina-dwdm /root]# ifconfig eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:05 inet addr:110.122.5.0 Bcast:110.122.255.255 Mask:255.255.0.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:10 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:420 (420.0 b) Base address:0x4000 eth1 Link encap:Ethernet HWaddr 00:00:00:01:00:05 inet addr:192.168.5.0 Bcast:192.168.255.255 Mask:255.255.0.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:20530 errors:0 dropped:0 overruns:0 frame:0 TX packets:8622 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2052409 (1.9 Mb) TX bytes:1066396 (1.0 Mb) Base address:0xc000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:59 errors:0 dropped:0 overruns:0 frame:0 TX packets:59 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:5294 (5.1 Kb) TX bytes:5294 (5.1 Kb) [root@sina-dwdm /root]# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 110.122.0.0 * 255.255.0.0 U 0 0 0 eth0 192.168.0.0 * 255.255.0.0 U 0 0 0 eth1 127.0.0.0 * 255.0.0.0 U 0 0 0 lo When i try pinging this board from my computer on 192.168.1.194 or ping my computer from the board there is no success. But there are other computers on the same subnet as my computer which can ping the board some of them are also pingable! from board and some not. And more puzzling for me is that even those that are not pingable from board can telnet to it. (but not my computer) There is no firewall on my computer and my computer and other nodes on network see each other. Rebooting the board makes no change. And here is the output of arp command on the board after pinging my computer: (It is successful) [root@sina-dwdm /root]# arp Address HWtype HWaddress Flags Mask Iface 192.168.1.201 ether 2c:56:dc:3d:ac:e1 C eth1 192.168.1.54 ether 00:0c:29:65:ac:39 C eth1 192.168.1.195 ether 40:16:7e:e7:5b:5f C eth1 192.168.1.194 ether 10:c3:7b:91:39:92 C eth1 Where can i look for source of problem?
(Written up as answer after confirmation). Are you sure 192.168.0.0 is a /16 network? If the other machines have it configured as 192.168.1.0/24 (which is more usual), then your 192.168.5.0 on eth1 would just get ignored, and therefore no pings. Change the netmask to 255.255.255.0 for a /24 subnet on this computer, or change the netmask to 255.255.0.0 for a /16 subnet on the other computers, and see if that fixes it.
arp-scan shows machines, but I can't ping some of them
1,555,242,594,000
I have this board with the STi7105BKUD chip on it, along with ram, flash, and a lot of I/O. Reading the documentation for this chip (here) I can see it has the ST40-300 processor embedded into it ; its doc is right here and says it can run , among other systems, Linux. Architecture is RISC. Is it possible to successfully run Linux on this board? How should it be done ?
It definitively is possible to run Linux on this SoC. Although ST dropped official support and (unfortunately) removed a lot of useful info from STLinux website, a part of it (part of downloads) is available here. A large number of old satellite and IPTV set-top boxes had STi7105, STi7109 or similar. All of them run Linux, and Enigma2 was a popular choice for satellite boxes. However, you must keep some things in mind: STi7105 is almost 10 years old (introduced in September 2008) It has a single core 450 MHz ST40 CPU (SH4 architecture) It can't decode any of the new codecs, like HEVC If you decide to port Enigma2 (which is the best this SoC can run), remember that it can be PITA and requires access to the current firmware in order to obtain ST231 multimedia blobs. The most recent kernel that supports this SoC is 2.6.32 with patches from ST, released in 2009. I'm currently porting one STi7105 board (Albis STB-8000) to 4.15 but without any ability to properly debug kernel, it's difficult. If the board manufacturer decided to lock down JTAG, UART and network access (tipical for vendor-locked satelite boxes with CI), you're out of luck and you can just dump the board because it's not good for anything.
Run Linux on RISC STi7105BKUD?
1,555,242,594,000
I am testing a ARM based embedded target running with customized embedded linux version 3.14. Is there any way that I can find out which scheduling policy my linux is using at runtime? I see some /proc/sys entries like these on target. But I am not sure whether it is CFS: sched_child_runs_first sched_domain/ sched_latency_ns sched_migration_cost_ns sched_min_granularity_ns sched_nr_migrate sched_rr_timeslice_ms sched_rt_period_us sched_rt_runtime_us sched_shares_window_ns sched_time_avg_ms sched_tunable_scaling sched_wakeup_granularity_ns Can anyone help?
I assume you want to find out if your system is using the CFS CPU scheduler. The scheduling policy is the policy the CFS or some other scheduler uses. On my Ubuntu 16.04 box I have /proc/sched_debug. Maybe you can get a hint out of: cat /proc/sched_debug If your system is using the CFS scheduler the output should contain something like: cfs_rq[CORE_NUMBER]: ...
How verify the current scheduling policy running in a embedded Linux?
1,555,242,594,000
I've got a Buildroot-based embedded system that uses a 3G modem (Cinterion PH8-P) and PPP to connect to the internet. The 3G modem is a USB device that provides 4 ttyUSB ports. One of these is used for PPP, whereas another is used for GPS. Occasionally, the 3G modem will stop working and will need to be restarted. I do this by first stopping the PPP and GPSd daemons, then restarting the modem, and then restarting the daemons again. Unfortunately, it seems that if PPP is run beforehand, it seems to affect the serial ports in some way so that other programs can no longer use them. For example, if I run the following on a freshly booted system where PPP has not been run yet: cat /dev/ttyUSB3& echo "AT" > /dev/ttyUSB3 I get the expected OK AT response back. If I then run PPP for a bit (by calling pon), then stop it (by calling poff), restart the modem and try to send the same AT command again, the terminal just seems to echo back exactly what I sent to the modem and I don't get the OK response. As a result, the GPS won't work, since I stop receiving NMEA messsages from the GPS tty port. It's almost like PPP is configuring all the serial ports to redirect their outputs somewhere else. Despite this, PPP has no problem at all starting up again after the modem has rebooted - according to the logs, the chat scripts happily send their AT commands and get the expected responses back. What could be causing this issue?
As it turns out, PPP is affecting it's own serial port, and since that's the one that's used to configure the GPS, that's what's causing the problem. By comparing the results of stty -F /dev/ttyUSB3 before and after running PPP, it became apparent that PPP was configuring the serial port in raw mode, which meant I couldn't use it to configure the GPS port. What's interesting is that these settings persisted even after the ttyUSBx device nodes were removed and recreated due to the modem being reset. Simply running stty sane -F /dev/ttyUSB3 to revert back to default settings allowed me to configure the GPS port without issue.
ppp affecting serial ports so that they cannot be used if modem is reset
1,555,242,594,000
What are the advantages of using threads on single core, does that makes sense to use multithreading on single core?
There is far too little context here to give a good answer, but for most reasonable contexts the answer is "probably yes". The operating system itself runs many things in parallell on that single core, after all, and you'd be pretty darn annoyed if you had to wait for some web page to finish loading before your mouse pointer would move.
Two or more threads on single core [closed]
1,555,242,594,000
My embedded device is not working after updating firmware. Thus I tried to update firmware using u-boot. I could successfully get u-boot console via serial connection, but updating firmware failed due to the lack of knowledge on firmware update using u-boot. At last, I not only corrupted linux kernel but also u-boot while modifying the device flash memory (u-boot command supports flash memory modification). Booting device no longer gives u-boot console. It just stops (I can see it through the serial connection). In this situation, how can I recover(or update) firmware on my device?
If available (ie. if there's a JTAG header on your board) , you can connect using a JTAG cable. Remember: Before using it you might need to enable JTAG using Test Mode Select Input (sometimes a jumper somewhere). You can then use that connection to upload a new firmware into your device.
How to recover firmware on a embedded device with corrupted u-boot and kernel image? [closed]
1,555,242,594,000
I'm trying to conceive a firmware update mechanism for a Linux-based embedded system without an additional initrd/initramfs/whatever. From within the running system, which has a read-only mounted root, I use dd to copy the new root image (residing on a secondary data partition). The problem is that half of the times I end up with a corrupted root filesystem. I don't get why this is happening, knowing that the partition is read-only and that I do a sync right before rebooting (I reboot by writing 'b' to /proc/sysrq-trigger). Someone please enlighten me.
You're overwriting a mounted filesystem. As soon as the file system driver attempts to read anything from it, you're bound to end up in trouble. You'll need to make sure that as soon as you're writing the new firmware, nothing else must read or write that partition. What people usually seem to be doing to circumvent that problem is to use the boot loader to flash new firmware. It usually resides completely in RAM and therefore doesn't need to access your partitions. EDIT: Another way would be to install another minimal system on your second partition whose sole purpose it is to flash an image file to the first partition. when an update is due, you'd just need to copy the image to the right location, update the bootloader (to boot from the second partition) and reboot. Once the image is written, reset the boot loader and reboot again.
live dd over a mounted read-only root partition
1,555,242,594,000
today I changed from an image with initramfs to an image with separate kernel and rootfs. Theses images are used for an Embedded System (ARM9 SAM9G25), that is runnging with an Linux 2.6.39. During boot I got the following warning, that didn't show up with the initramfs: WARNING: at kernel/irq/handle.c:130 handle_irq_event_percpu+0x70/0x198() irq 12 handler atmci_interrupt+0x0/0x6b0 enabled interrupts Modules linked in: Backtrace: [<c0024918>] (dump_backtrace+0x0/0x10c) from [<c01f5664>] (dump_stack+0x18/0x1c) r6:c005d558 r5:00000009 r4:c028fea8 r3:c02956bc [<c01f564c>] (dump_stack+0x0/0x1c) from [<c0030f74>] (warn_slowpath_common+0x54/0x6c) [<c0030f20>] (warn_slowpath_common+0x0/0x6c) from [<c0031030>] (warn_slowpath_fmt+0x38/0x40) r8:00000000 r7:00000000 r6:0000000c r5:00000001 r4:c7969f60 r3:00000009 [<c0030ff8>] (warn_slowpath_fmt+0x0/0x40) from [<c005d558>] (handle_irq_event_percpu+0x70/0x198) r3:0000000c r2:c025b447 [<c005d4e8>] (handle_irq_event_percpu+0x0/0x198) from [<c005d6b0>] (handle_irq_event+0x30/0x40) [<c005d680>] (handle_irq_event+0x0/0x40) from [<c005f274>] (handle_level_irq+0xbc/0xe4) r4:c02976a8 r3:00020000 [<c005f1b8>] (handle_level_irq+0x0/0xe4) from [<c0021078>] (asm_do_IRQ+0x78/0xa8) r4:0000000c r3:c005f1b8 [<c0021000>] (asm_do_IRQ+0x0/0xa8) from [<c0021a74>] (__irq_svc+0x34/0x60) Exception stack(0xc028ff48 to 0xc028ff90) ff40: 00000000 0005317f 0005217f 60000013 c028e000 c02ab1a4 ff60: c03b9480 c0291f0c 20000000 41069265 2001c2a8 c028ff9c 600000d3 c028ff90 ff80: c0022748 c0022754 60000013 ffffffff r5:fefff000 r4:ffffffff [<c0022714>] (default_idle+0x0/0x44) from [<c0022908>] (cpu_idle+0x70/0xc8) [<c0022898>] (cpu_idle+0x0/0xc8) from [<c01f37f4>] (rest_init+0x60/0x78) r5:c001d5c4 r4:c0290094 [<c01f3794>] (rest_init+0x0/0x78) from [<c00088c0> (start_kernel+0x23c/0x284) [<c0008684>] (start_kernel+0x0/0x284) from [<20008038>] (0x20008038) ---[ end trace 45f8d0076fc9ced3 ]--- I have to say, the system doesn't crash here and boots on as the usual way and is usable in the end (I end up in Busybox - the distro). What I did: I created an SD card with 2 FAT32 partitions of ~1 GB each. On the first there are the bootloaders and the kernel and on the second I extracted the rootfs.tar, that was generated with the help of Buildroot 2013.11. The Linux command line looks like this: console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait rw (I'm not sure if this belongs to here, but first i couldn't even boot the rootfs at all, since he wasn't able to initialize the mmcblk. Now with the rootwait it works just fine). My question is: does anyone know where this error comes from? I couldn't find any useful threads anywhere about this. I'd like to remove this error, because I guess it's wasting a bit of time during boot and that's my actual aim: keeping the boot time at the lowest time it could get.
This is a bug somewhere in the kernel. It is not directly related to rootfs/initramfs changes. It may be due to some other change you made (did you use the same sources, the same configuration, the same compiler?), or it may be related to some timing issue that revealed a latent bug. This warning comes from handle_irq_event_percpu and the interrupt handler is for the Atmel MMC controller. There is probably a bug in that code. Even if you don't observe any consequences other than the trace, this kind of warning tends to indicate serious problems, which could lead to corrupted data or at least to a lock-up. Debugging is nontrivial. Given that this is a fairly old kernel, check if more recent versions of this driver have had fixes that could be related, and consider using a more recent kernel if possible.
WARNING: at kernel/irq/handle.c - after changing rootfs, but why?
1,555,242,594,000
I have an embedded device, built using buildroot, kernel version 3.6.11 running busybox. The kernel is built with completely default options. I have configured the device according to what the network guy has specified for the IP, gateway, netmask etc and I have put these values in the /etc/network/interfaces file. When the system boots up, a call to ifconfig tells me that all the network settings are what they are supposed to be. However, I cannot ping any other machine on the same subnet as the device. I can communicate with my host machine with a direct ethernet cable connection so I think the network adapter is ok - I can ssh to the host, and the host can view the target correctly from the vsftpd I have installed on the device. Basically I am very unsure how to proceed with diagnosing the problem. I am drowning on internet forum linux network setup guides and getting nowhere. Also, worryingly, when I type # ip addr show dev eth0 I get the report of a segfault in libuClibc-0.9.33.2.so. I built this all using buildroot and it reported that everything was successful. Is it possible that I have a broken kernel?? I really do not know how to proceed so any advice would be gratefully received. EDIT The output from ip addr show dev eth0 is 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 00:18:7d:19:a0:d8 brd ff:ff:ff:ff:ff:ff inet 172.18.255.212/24 brd 172.18.255.255 scope global eth0 [ 331.700545] ip[951]: segfault at 0 ip b76e1f26 sp bfbd29b0 error 4 in libuClibc-0.9.33.2.so[b76b5000+4d000] Segmentation fault When I call the same command on the other adapter eth1, then I get no segfault, so really don't know what is going on. EDIT2 After rebuilding with debug information and strace I was able to get strace output of the segfault - I do not really know what this means though other than it looks like it is trying to write to a location it perhaps should not (I have not included it all, just the last few lines). socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4 ioctl(4, SIOCGIFTXQLEN, {ifr_name="eth1", ifr_qlen=1000}) = 0 close(4) = 0 write(1, "3: eth1: <BROADCAST,MULTICAST,UP"..., 793: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000 ) = 79 write(1, " link/ether 00:18:7d:19:a0:d7"..., 55 link/ether 00:18:7d:19:a0:d7 brd ff:ff:ff:ff:ff:ff ) = 55 open("/etc/iproute2/rt_scopes", O_RDONLY) = 4 ioctl(4, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0xbfc91b30) = -1 ENOTTY (Inappropriate ioctl for device) read(4, "#\n# reserved values\n#\n0\tglobal\n2"..., 4096) = 92 read(4, "", 4096) = 0 close(4) = 0 write(1, " inet 192.168.12.198/16 brd 1"..., 65 inet 192.168.12.198/16 brd 192.168.255.255 scope global eth1 ) = 65 --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0} --- +++ killed by SIGSEGV +++ Segmentation fault
I managed to resolve the segmentation fault issue which I will document here in case anyone has similar problems in the future. I noticed that when I called the following ip -f inet addr show dev eth0 instead of ip inet addr show dev eth0 then the segfault would not happen, but it would still happen with ip -f inet6 addr show dev eth0 This lead me to the conclusion that I must have an incompatibility with IPv6 support somewhere in my toolchain or busybox. I rebuild my entire target, toolchain, kernel and uClibc from scratch once again with the buildroot config files, this time ensuring that my crosstools were created with IPV6 support. With that option set the reported segfault no longer occurs.
Unable to get embedded device to ping anything on the network
1,555,242,594,000
Has anybody ever successfully installed Linux on the Lego Mindstorms NXT Intelligent Brick? I've found plenty of things on Google, but none of them worked. I can't find the download for legOS, and the gcc I was told to download never actually built (although it spent over 5 minutes in an install script). There was no download page for NXC (Not Exactly C). NOTE: I have an Ubuntu Linux system, a Mac OSX Lion system, and access to Windows (although I would prefer to avoid Windows).
AFIAK, only the new Mindstorms EV3 run Linux-based firmware. NXC is only a language and compiler for the Mindstorms NXT, and legOS is an alternative firmware.
How to install Linux on the Lego Mindstorms NXT
1,555,242,594,000
The below route is sticky, even if manually deleted, it gets added by connmand (Connection Manager Daemon) with another interface name. If the specific interface is made down using ip link cmd, I see the same problem. root@soc:~$ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 eth0 Is there a way to configure connmand not do this? Additional Information: eth0 uses static IP address. On my system (SoC), I have 4 interfaces, out of which 3 use static IP addresses and the one uses DHCP. I have added the systemd/network file that defines the static IP for eth0 below. root@soc:/etc/systemd/network$ cat 10-eth0-soc.network [Match] Name=eth0 [Network] Address=10.10.11.2/24 root@soc:/etc/systemd/network$
connmand appears to be so minimalist and simple that it apparently cannot modify the route specified by DHCP at all. After a quick browse through the source code, it looks like connmand will set a default gateway to 0.0.0.0 if the DHCP server has specified it that way. Apparently it used to include code to filter out such cases, but it was removed because in certain IPv4LL situations such a route can be a valid configuration. It seems to me that connmand might be too simple to handle your multi-homed host (= has multiple interfaces to different networks), and you may have to seek other solutions. The fact that you can use *.network files with IP addresses suggests you have systemd-networkd available to you. You might try disabling connmand entirely, and using a .network file for the DHCP interface too, as it will allow more customization than connmand. Specifically, you can set UseRoutes=false in the [DHCPV4] section of a .network file if the DHCP server provides a harmful route/gateway you need to ignore. If you cannot abandon connman, then you might have to check the configuration of your DHCP server, and ensure that if it has no gateway address to give, it should not send the relevant DHCP option at all, instead of specifying it as 0.0.0.0. But if some other hardware requires that a DHCP server always specifies some gateway, you may be in trouble unless your DHCP server is flexible enough to allow tailoring its offers for each client.
How to configure connmand to not to add the unnecessary route with IP 0.0.0.0 and GW 0.0.0.0