date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,555,242,594,000 |
I have been working on a Altera DE1-SoC Development Board for 8 months. The system I was working on includes a Cyclone V FPGA chip, particularly the 5CSEMA5F31C6N. It was running an embedded Linux operating system on chip.
All was well and development was on-going. Two weeks ago, a new custom board was put together by a hardware engineer in the company. The design and components were mostly similar to that of the Development Board. All HPS related pins are wired the same way, with one main difference being that the default console port was UART1 instead. That issue has since been resolved and I now am able to receive the U-boot and Kernel messages through UART1.
But the system did not completely boot. I have pinpointed this to multiple reasons. Firstly, I had an init.d script that would export the GPIO LEDs and create a sysfs file. Exporting the gpio pin works, however, changing the direction, or changing the value, or reading from it, causes the system to freeze. I disabled that function on the init.d script and rebooted the device. This time the boot failed on another init.d script line. This line was going to change the value of a register in the lightweight bridge. The command was devmem 0xFF200XXX 32 1, with XXX being the specific register.
I tried using devmem on all bridges but all attempts would freeze Linux. I tried using devmem on the UART register of HPS, on the SDCard register of HPS (referenced here), and it does not freeze.
I can verify that the bridge is enabled by reading the state sysfs file of each bridge:
fpga_bridge state returns enabled
I can also verify that the bridges are linked to the driver from this dmesg output:
dmesg output
I have enabled all three bridges in the hps configuration using Quartus Platform Designer.
I also have the following lines in my u-boot.scr:
fatload mmc 0:1 $fpgadata soc_system.rbf;
fpga load 0 $fpgadata $filesize;
setenv fdtimage soc_system.dtb;
run bridge_enable_handoff;
run mmcload;
run mmcboot;
I have also attempted enabling the bridges through the U-boot command line following these instructions.
However, I am unable to write anything into $l3regs:
writing into l3regs
I am building the OS using Buildroot 2016.05 with a 4.4 Linux Kernel. To create the .rbf, .dts, .dtb, preloader-mkpimage.bin, and u-boot files, I am using SoC EDS 18.1 [Build 625].
I have run out of things to try.
I would consider the issue solved if I am able to toggle an LED on and off from the Linux OS, using sysfs files.
Assuming that the hardware is correct, what else could be the cause and how do I fix it?
|
Thanks for the reply. This issue has been resolved.
On the development board we are using a 50Mhz oscillator to provide a clock to the HPS peripherals, while a 25MHz signal is generated from that same 50Mhz clock which is then connected to the HPS clock pin on the fabric.
On the new board, we have not used the 50Mhz oscillator but instead opted for a 25Mhz oscillator instead. This time a single track connects to the HPS clock pin on the fabric directly from the oscillator.
We did not have any other clock to supply toward the HPS peripherals.
Therefore, we routed the dedicated HPS clock internally toward the input pin on the peripherals of the HPS. This was a mistake as this cannot be done on the top level architecture of the Cyclone V as the dedicated HPS clock pin is not a GPIO.
| Why does linux freezes when trying to access peripherals connected to the lightweight hps-to-fpga bridge (or any bridge)? |
1,666,077,107,000 |
I am building an embedded Linux board with Buildroot (user manual here).
I have syslog-ng running on the board. It's config file is specified in buildroot here: https://github.com/buildroot/buildroot/blob/master/package/syslog-ng/syslog-ng.conf:
@version: 3.37
source s_sys {
file("/proc/kmsg" program_override("kernel"));
unix-stream ("/dev/log");
internal();
};
destination d_all {
file("/var/log/messages");
};
log {
source(s_sys);
destination(d_all);
};
Notice it specifies the destination as "/var/log/messages", yet active logging on the board is going into a file named /var/log/messages.1, and the /var/log/messages file doesn't even exist. Why is that? Is there a way to get logging into the /var/log/messages file instead?
Syslog, which we used to use, logs into /var/log/messages, and we are trying to keep that behavior for consistency.
Additional notes
ls -1 /var/log on a board running syslog contains these messages files:
messages
messages.1
messages.2
messages.2.gz
messages.3
messages.4
messages.5
messages.6
messages.7
ls -1 /var/log on a board running syslog-ng contains these messages files (notice messages is missing):
messages.1
messages.2
messages.3
messages.4
messages.5
messages.6
messages.7
On the syslog-ng board, tail -f /var/log/messages.1 shows it is continually receiving logged messages, which is unexpected, since when using syslog the "active" file is /var/log/messages instead.
|
Solved! You must force syslog-ng to reopen its target log files after each log rotation
So, I figured it out. Thanks to @Murray Jensen for the hint about it here.
Whenever logrotate rotates my /var/log/messages file, it renames it to /var/log/messages.1. However, syslog-ng is writing to the file pointed to by the original file descriptor (fd) it opened up. Renaming the file from /var/log/messages to /var/log/messages.1 does not change the file descriptor, so the file descriptor syslog-ng is now writing to points to the file now named /var/log/messages.1. The fix is to simply force syslog-ng to reopen its log files and obtain new file descriptors after each log rotation, thereby causing it to obtain a new file descriptor for the newly-created target log file which now exists at /var/log/messages.
There are 3 ways to do this, which I've written about here: https://github.com/syslog-ng/syslog-ng/issues/1774#issuecomment-1270517815
See here for where I learned about syslog-ng-ctl reopen, which is the recommended way: https://github.com/syslog-ng/syslog-ng/issues/1774#issuecomment-346624252
The 3 ways are:
# Option 0 (no longer recommended): call the heavier `reload` command after log
# rotation
syslog-ng-ctl reload
# Option 1 (RECOMMENDED): call the new `reopen` command after log rotation
syslog-ng-ctl reopen
# Option 2 (same thing as Option 1 above): send the `SIGUSR1` kill signal to the
# running `syslog-ng` process
pid="$(cat /var/run/syslog-ng.pid)" kill -SIGUSR1 $pid
So, to force logrotate to call one of the 3 ways above automatically after each log rotation, you must add the proper command as a postrotate script inside your /etc/logrotate.d/syslog-ng (or similar--can be named anything) logrotate configuration file. Here is what a fixed logrotate config file might now look like:
From my notes here:
Sample /etc/logrotate.d/syslog-ng logrotate config file:
/var/log/auth.log
/var/log/user.log
/var/log/messages
{
rotate 7
size 20M
delaycompress
missingok
# Required for syslog-ng after each rotation, to cause it to reopen log
# files so it can begin logging to the new log file under a new file
# descriptor, rather than to the old log file which has now been rotated
# and renamed.
postrotate
# After rotating the log files, cause syslog-ng to reopen the
# destination log files so it will log into the newly-created log files
# rather than into the now-rotated and renamed ones.
#
# This ensures, for example, that syslog-ng will move its file
# descriptor to begin logging into the main "/var/log/messages" log
# file again, instead of into the now-rotated "/var/log/messages.1"
# file, which the old file descriptor (fd) is now pointing to since
# that fd's filename was just renamed from "/var/log/messages"
# to "/var/log/messages.1" during the log rotation.
# Option 1:
syslog-ng-ctl reopen
# OR, Option 2
# pid="$(cat /var/run/syslog-ng.pid)" kill -SIGUSR1 $pid
endscript
}
Note: I've also opened up a documentation change request here: https://github.com/syslog-ng/syslog-ng/issues/4166. It is now recommended to use syslog-ng-ctl reopen after each log rotation instead of syslog-ng-ctl reload.
Old attempt at an answer (what I tried first)
On the board running syslog-ng, I reflashed the rootfs (root filesystem) image entirely, and rebooted the board, and now I see the /var/log/messages file again:
Part of the output of ls -1 /var/log:
messages
messages.1
messages.2
messages.3
messages.4
messages.5
messages.6
messages.7
I can't explain it. tail -f /var/log/messages does indeed show active logs coming into that file, as expected, and tail -f /var/log/messages.1 shows that the file is static, with no new messages coming in, also as expected.
I can prove that this board is indeed running syslog-ng by looking at the output of ps aux | grep syslog:
# ps aux | grep syslog
803 root 0:00 {syslog-ng} supervising syslog-ng
804 root 0:02 /usr/sbin/syslog-ng
12571 root 0:00 grep syslog
...as opposed to that same command's output when run on the syslog board:
# ps aux | grep syslog
789 root 0:19 /sbin/syslogd -n -n -s 0
2993 root 0:00 grep syslog
Again, I'm not sure what happened, nor why.
On both boards, ps aux | grep logrotate shows that logrotate is running. Ex:
# ps aux | grep logrotate
1299 root 0:00 runsv logrotate-periodically
14208 root 0:00 grep logrotate
Both boards have the same /etc/logrotate.conf file, and only the syslog-ng board has the /etc/syslog-ng.conf file, which contains the contents as shown in the question.
If I figure out anything new in the coming days, I'll come back and update this answer.
| Buildroot: syslog-ng logs into the "/var/log/messages.1" file instead of "/var/log/messages" |
1,666,077,107,000 |
On a headless embedded computer (booting on a read-only filesystem), I see that systemd-tmpfiles-setup.service is rather slow, and prevents other services to start earlier (I checked with systemctl list-dependencies myservice.service).
How to make it faster on a read-only filesystem?
journalctl -u systemd-tmpfiles-setup.service also confirms it takes nearly 4 seconds:
-- Logs begin at Sat 2021-12-11 01:55:43 GMT, end at Sat 2021-12-11 01:58:03 GMT. --
Dec 11 01:55:**43** foo systemd[1]: Starting Create Volatile Files and Directories...
Dec 11 01:55:**47** foo systemd-tmpfiles[149]: **rm_rf(/tmp): Read-only file system**
Dec 11 01:55:47 foo systemd-tmpfiles[149]: symlink(/etc/machine-id, /var/lib/dbus/machine-id) failed: Read-only file system
Dec 11 01:55:47 foo systemd-tmpfiles[149]: symlink(../proc/self/mounts, /etc/mtab) failed: Read-only file system
Dec 11 01:55:47 foo systemd-tmpfiles[149]: Failed to open directory 'coredump': No such file or directory
Dec 11 01:55:47 foo systemd-tmpfiles[149]: Failed to open directory 'private': No such file or directory
Dec 11 01:55:47 foo systemd-tmpfiles[149]: Failed to open directory 'private': No such file or directory
Dec 11 01:55:47 foo systemd-tmpfiles[149]: Failed to open directory 'private': No such file or directory
Dec 11 01:55:47 foo systemd-tmpfiles[149]: Failed to open directory '.X11-unix': No such file or directory
Dec 11 01:55:47 foo systemd-tmpfiles[149]: Failed to open directory '.ICE-unix': No such file or directory
Dec 11 01:55:47 foo systemd-tmpfiles[149]: Failed to open directory '.XIM-unix': No such file or directory
Dec 11 01:55:47 foo systemd-tmpfiles[149]: Failed to open directory '.font-unix': No such file or directory
Dec 11 01:55:47 foo systemd-tmpfiles[149]: Failed to open directory '.Test-unix': No such file or directory
Dec 11 01:55:47 foo systemd[1]: Started Create Volatile Files and Directories.
Here is the result of systemd-analyze plot:
|
Since systemd-tmpfiles-setup.service is defined in /usr/lib/systemd/... I used the "masking" technique from the article "Three levels of off":
By symlinking a service file to /dev/null you tell systemd to never start the service in question and completely block its execution. Unit files stored in /etc/systemd/system override those from /lib/systemd/system that carry the same name. The former directory is administrator territory, the latter terroritory of your package manager. By installing your symlink in /etc/systemd/system/ntpd.service you hence make sure that systemd will never read the upstream shipped service file /lib/systemd/system/ntpd.service.
I did
ln -s /dev/null /etc/systemd/system/systemd-tmpfiles-setup.service
I'm still interested if there is a "more clever solution" to make systemd-tmpfiles-setup.service work even on read-only systems, without waiting 4 seconds for nothing. Ideas welcome in comments or another answer!
| "systemd-tmpfiles-setup.service" slow on read-only filesystem |
1,666,077,107,000 |
I am developing an esp32 project and I log all the esp32 uart debug output in multiple files. At some point my early releases crash and the output looks something like this:
Guru Meditation Error: Core 0 panic'ed (Cache disabled but cached memory region accessed).
Core 0 register dump:
PC : 0x40008150 PS : 0x00060034 A0 : 0x8008225c A1 : 0x3ffb0670
A2 : 0x3f40117c A3 : 0x00000000 A4 : 0x00000004 A5 : 0x00000000
A6 : 0x00000000 A7 : 0xfffffff7 A8 : 0x00000000 A9 : 0x00000000
A10 : 0x000000ad A11 : 0x00000000 A12 : 0x800861de A13 : 0x3ffbb010
A14 : 0x00000003 A15 : 0x00060a23 SAR : 0x00000020 EXCCAUSE: 0x00000007
EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x00000000
Core 0 was running in ISR context:
EPC1 : 0x4008a2e8 EPC2 : 0x00000000 EPC3 : 0x00000000 EPC4 : 0x40008150
Backtrace:0x4000814d:0x3ffb0670 0x40082259:0x3ffb0700 0x400833b9:0x3ffb0720 0x400833e2:0x3ffb0740 0x40081e6a:0x3ffb0760 0x4008a2e5:0x3ffbb0a0 0x4008438d:0x3ffbb0c0 0x400830ed:0x3ffbb0e0 0x40083271:0x3ffbb110 0x400de4b1:0x3ffbb130 0x400dd525:0x3ffbb150 0x400dd7c5:0x3ffbb170 0x400de175:0x3ffbb1d0 0x400dccf2:0x3ffbb240 0x400dcedf:0x3ffbb2a0 0x400dcf47:0x3ffbb2d0 0x400dbebf:0x3ffbb2f0 0x400dbed2:0x3ffbb310 0x400d757a:0x3ffbb330 0x400d770a:0x3ffbb360 0x400d3a66:0x3ffbb380
ELF file SHA256: c278c3c874dd3748
Rebooting...
At this point I can start to review my code at the points where the backtrace is pointing:
addr2line xtensa-esp32- -pfiaC -e project.elf 0x400d3a66 0x400d770a 0x400d757a ...(the remaining addresses of the backtrace)
the output looks like:
0x400d3a66: root_task at $somePATH/build/../main/main.c:163
0x400d770a: init at $somePATH/build/../main/init_app.c:122
0x400d757a: init_nvs_app at $somePATH/build/../main/init_app.c:47
(inlined by) init_nvs_app at /$somePATH/build/../main/init_app.c:34
This is tedious. So I need to automate it, but I don't have much experience with shell scripts(new to linux)
Also there are million different ways to approach it. Could someone experienced help me out to grep the text between "Guru Meditation Error:" and "Rebooting..." and what's the best way to separate the PC(program counter) addresses from the Backtrace into a single line ignoring the SP(stack pointer) ones(SP addresses start with 0x3ff in this speciffic case).
I have tried some things with grep regular expressions and awk but cannot nail it good enough.
|
sed version:
sed -n -E -e '/^Backtrace:/ {s/Backtrace://; s/:0x3ff[^ ]* */ /g; p}' input.txt
This ignores all lines that don't start with "Backtrace:" and uses two search & replace rules to modify matching lines before printing them out.
The s/:0x3ff[^ ]* */ /g operation matches any text beginning with :0x3ff followed by zero-or-more non-space characters ([^ ]*), followed by zero-or-more spaces ( *), and replaces any matches found with a single space character. It is a global search and replace (/g), so will affect all matches found on the line, not just the first match.
It does not attempt to limit its action to only lines between "Guru Meditation" and "Rebooting". This should be adequate if there aren't any other lines beginning with "Backtrace:" in the input, or if you only feed it one input file at a time.
If the 0x3ff isn't constant across multiple runs, it can be changed to a regexp that matches a colon followed by 0x followed by 1 or more hex digits. e.g.
s/:0x[0-9a-f]+//gi
This change can also be used with the awk and perl versions below if necessary.
awk version:
awk -v SKIP=1 '/^Guru Meditation Error/ { SKIP=0 };
/^Rebooting\.\.\./ { SKIP=1} ;
SKIP==1 || ! /^Backtrace:/ { next };
{
sub("^Backtrace:","");
gsub(":0x3ff[^ ]* *"," ");
print
}
' input.txt
This skips all input that isn't between the "Guru Meditation" and "Rebooting" lines, as well as all input that doesn't begin with "Backtrace:". Then it modifies non-skipped lines with two search and replace operations (sub() and gsub()) before printing out the modified line.
perl version:
perl -lne 'BEGIN {$SKIP=1};
$SKIP=0 if (m/^Guru Meditation Error/);
$SKIP=1 if (m/^Rebooting\.\.\./);
next if ($SKIP || ! m/^Backtrace:/);
s/Backtrace://;
s/:0x3ff\H*\h*/ /g;
print' input.txt
This works like the awk version, but the code looks like a cross between the awk and sed versions (perl is capable of both awk-like and sed-like syntax...and a whole lot more).
The final s//g operation has been modified to use perl's \H (non- horizontal space character) and \h (horizontal space character) matches instead of just spaces (i.e. tabs and spaces and more - see man perlrecharclass and search for the section on "Whitespace" for details)
Output for all three versions is identical:
0x4000814d 0x40082259 0x400833b9 0x400833e2 0x40081e6a 0x4008a2e5 0x4008438d 0x400830ed 0x40083271 0x400de4b1 0x400dd525 0x400dd7c5 0x400de175 0x400dccf2 0x400dcedf 0x400dcf47 0x400dbebf 0x400dbed2 0x400d757a 0x400d770a 0x400d3a66
All three versions are capable of taking input from stdin or from one or more filename(s) on the command line. The examples above use input.txt (which is a text file I copy-pasted your sample input into).
They all output to stdout, so can be used for command substitution. e.g.
addr2line xtensa-esp32- -pfiaC -e project.elf $(sed -n -E -e '/^Backtrace:/ {s/Backtrace://; s/:0x3ff[^ ]* */ /g; p}' input.txt)
| How to parse a speciffic strings from multiple files with shell script |
1,666,077,107,000 |
Issue: To reduce the autoboot_timeout parameter in bootloader source code.
Rugged Board---> phyBoard-Segin i.MX6UL/ULL
Current booting time is around 14 seconds and with the autoboot timeout, an extra 3 seconds. Have to reduce the timeout to 1.
Method 1:
@Bootloader:
cd /env/nv
ls
barebox@Phytec phyCORE-i.MX6 Ultra Lite SOM with NAND:/env/nv ls
. ..
allow_color autoboot_timeout
bootchooser.state_prefix bootchooser.system0.boot
bootchooser.system1.boot bootchooser.targets
dev.eth0.ipaddr dev.eth0.linux.devname
dev.eth0.mode dev.eth0.netmask
dev.eth0.serverip dhcp.vendor_id
linux.bootargs.base linux.bootargs.rootfs
net.gateway user
barebox@Phytec phyCORE-i.MX6 Ultra Lite SOM with NAND:/env/nv
I edit the autoboot_timeout to 1.
saveenv.
This method works, I have verified. Now I wish to make the same changes in the barebox source code and have it reflect[As per Project requirement, the same change should not be made here but rather in the source code]
Reverting all the changes made here.
Method 2:
bitbake barebox -c devshell
cd defaultenv/defaultenv-2-base/bin/
I edit the init file, change the autoboot timeout parameter to 1.
Snippet:
root@hp15t:~/yocto/build/tmp/work/phyboard_segin_imx6ul_2-phytec-linux-gnueabi/barebox/2019.01.0-phy7-r7.0/git/defaultenv/defaultenv-2-base/bin#
cat init
#!/bin/sh
export PATH=/env/bin
global hostname global user global autoboot_timeout global
autoboot_abort_key global boot.default global linux.bootargs.base
global linux.bootargs.console
#linux.bootargs.dyn.* will be cleared at the beginning of boot global linux.bootargs.dyn.ip global linux.bootargs.dyn.root global editcmd
[ -z "${global.hostname}" ] && global.hostname=generic [ -z
"${global.user}" ] && global.user=none magicvar -a global.user
"username (used in network filenames)" [ -z
"${global.autoboot_timeout}" ] && global.autoboot_timeout=1
magicvar -a global.autoboot_timeout "timeout in seconds before
automatic booting" [ -z "${global.autoboot_abort_key}" ] &&
global.autoboot_abort_key=any magicvar -a global.autoboot_abort_key
"key to abort automatic booting (valid options: any, ctrl-c)" [ -z
"${global.boot.default}" ] && global.boot.default=net [ -z
"${global.editcmd}" ] && global.editcmd=sedit
[ -e /env/config-board ] && /env/config-board /env/config
After saving the changes[highlighted the parameter which i have changed], i run the below commands.
bitbake barebox -c compile --force
bitbake barebox -c deploy
bitbake < image name >
Here when I verify, the changes made are not reflected.
Required Scenario- timeout should be 1 and board should boot up.
Obtained Scenario- it is still taking 3s and then booting.
|
After much deliberation and digging around I found out. I had forgotten to update the environment in the bootloader for the changes to reflect.
Make the above changes to the file in the path defaultenv/defaultenv-2-base/bin/init
Save the changes.
git status
git add < respective file name in the path >
git commit -m " [ insert proper message for the commit ] "
git show or git status [ this is to see the whether the changes made
are present]
exit
bitbake barebox -c compile --force && bitbake barebox && bitbake
barebox -c deploy
bitbake < image name >
Flash the SD Card image.
Go the following path in the yocto:
cd /deploy/images/ [ version ]/
cp barebox.bin /home/< name >/boot
@Bootloader:
barebox_update -t nand barebox.bin
erase /dev/nand0.barebox-environment.bb [ we need to erase the old
environment ]
saveenv
reset
Now the changes made will be reflected.
We can cross check in the bootloader.
cd /env/bin/
cat init [ check the autoboot_timeout. Default was 3, it has been
changed to 1]
| How to make changes in barebox code reflect in build? |
1,666,077,107,000 |
I need to make a Buildroot system for various x86_64 EFI systems with varying storage sizes, but unfortunately, the pc_x86_64_efi config creates an img file with a fixed partition size, not one that expands to the full size of the media it is flashed to. If I want it to fill the various drives, I need to manually specify the size of the drive in the filesystem config, and then recompile, which is a major pain, and ends up making a massive 128GB+ image file. I tried causing it to resize from within the running system using resize2fs, but that did not work. Ideally I would like it to either expand to the full size of the drive when it is flashed, or to have it resize when it first boots. Is this possible, or is it outside the limits of Buildroot?
|
If you have 'parted' and 'resize2fs' built you can resize the partition, resize the filesystem then reboot in a script.
For example here's a system I'm building with a 500MB image flashed onto a 16GB SD Card:
# parted -s /dev/mmcblk0 u s p
Model: SD SL16G (sd/mmc)
Disk /dev/mmcblk0: 31116288s
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1s 65536s 65536s primary fat16 boot, lba
2 65537s 3111628s 3046092s primary ext4
The 2nd line gives the total size of the disk, and assuming the partition you need to resize is the last partition you can issue the following commands to expand it to the max:
# parted -s /dev/mmcblk0 u s resizepart 2 31116287
# resize2fs /dev/mmcblk0
# reboot
| How do I create a compressed buildroot system image that expands to fill the available storage of the media it is flashed to? |
1,666,077,107,000 |
I'm setting up an embedded system that is built using the Yocto project. This outputs a root file system, kernel, u-boot, etc. I have an installer script that I run from an SD card that configures the eMMC on the board with partitions, copies in the rootfs, uboot, etc. It produces a bootable system when I boot from eMMC.
The problem I'm having is with the ethernet driver. Is isn't installed on the system by default. The installation script copies it to /lib/modules/4.14.98-imx8mq+gea48c83/kernel/drivers/net/ethernet/freescale/fec.ko and I can log in over serial and manually load it with insmod, and that works fine. But I'm not sure how to get it to load automatically.
Systemd looks in /etc/modules-load.d/ for lists of modules to load, but this process seems to use modprobe and not insmod. The modprobe system doesn't really know about the ethernet driver because I haven't run depmod on it. But I can't run depmod from the installer because it would install it on my SD card installation, not on the eMMC.
What is my best approach here? Do I need to find some way to run depmod during the installation? Maybe it could be done with chroot?
Or is there a good way to get my module to load automatically without using the depmod/modprobe system?
Any insight here would be very appreciated.
|
User icarus was correct in their comment to my post.
I am issuing the following command from my installation script and that seems to be working:
depmod -b /mnt/root1 -a 4.14.98-imx8mq+gea48c83
The last argument is because the kernel version on the SD card system I'm booting from is different than the system I am modifying.
| How can I install kernel modules on a mounted file system? |
1,546,427,185,000 |
On an embedded system, we have a a 512Kb static ram on a character device
/dev/mem.
We're currently using it by memory-mapping the file directly in our application with a mmap.
I would like to mount it as a file-system to enable the following use-cases:
manage stored data with system utilities
fast and reliable storage for important data (eg. rsyslog disk queue)
buffer data to be written on flash device
Would it make sense to mount it as a file-system?
How could I do it? Maybe using a loop device to make the file a block device?
What file-system should I consider?
|
I would consider pramfs: the developers state:
Many embedded systems have a block of non-volatile RAM separate from normal system memory, i.e. of which the kernel maintains no memory page descriptors. For such systems it would be beneficial to mount a read/write filesystem over this "I/O memory", for storing frequently accessed data that must survive system reboots and power cycles or volatile data avoiding to write on a disk or flash. An example usage might be system logs under /var/log or debug information of a flight-recorder.
It has several advantages over traditional filesystems, is lightweight, and supports extended attributes, ACLs, security labels and freezing.
| What file system to use on embedded static ram device? |
1,546,427,185,000 |
When I use rsync on large files it shows a download speed of 2.7 MB/s, or around 22Mbps. When I run ethtool on the NIC, here is the output
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: MII
PHYAD: 1
Transceiver: external
Auto-negotiation: on
Current message level: 0x00000007 (7)
drv probe link
Link detected: yes
I found similar readings on the host machine.
When I look at ethtool -i etho I get the following:
driver: smsc911x
version: 2008-10-21
firmware-version:
expansion-rom-version:
bus-info: smsc911x.0
supports-statistics: no
supports-test: no
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no
I double checked the ethernet cables I'm using, and all are at least 5e.
I'm using the LAN9221-ABZJ chip for this project. Is this a firmware issue, too much overhead on the protocols, or is this chip know for not transmitting fast enough?
UPDATE
I checked the speeds with iperf. Going from the server side it was 50Mbps. From the Client side it was 65 Mbps. Also, I had to do this remotely (as in i ssh'd into the one machine to configure it). That seems a little low.
|
Check the Cpu usage through htop while it is transmitting data. If it is maxed out during ethernet events, it is a good sign that your cpu is the bottleneck. The only fixes are to increase the clock of your cpu, or to get a faster one.
| not getting full network speed (or even close) of 100 mbps |
1,546,427,185,000 |
I'm trying to set up a custom Linux installation on an Intel Atom (Baytrail) based Android tablet, using Qt 5.5 for device creation. The build system is based on the Yocto project and builds an embedded Linux image. In order to run this image on the tablet (which is originally and Android tablet), I'm replacing the boot partition, with an image containing the kernel, initramfs and initial boot script, and replacing the system partition with the full image, then flashing these to the device with the Intel Manufacturing Tool.
So far, I have the device booting into my new kernel with the initramfs, and running the init script. The issue comes when trying to mount the main partition on the embedded flash. The command to mount the system partition fails with "Invalid Argument".
A cat proc/filesystems shows that ext4 is supported, and parted -l shows the partitions on the internal MMC are all ext4, with the exception of the first, which is the EFI boot partition. I can't mount any of the ext4 partitions, but I can mount the EFI partition, so I think that means the whole MMC should be accessible.
Running fdisk -l only shows the first partition (the EFI boot partition), but I think that is because fsdisk doesn't support GPT.
Does anyone know why I wouldn't be able to mount the ext4 partitions? They are all listed in /dev as:
mmcblk0
mmcblk0p1
mmcblk0p2
mmcblk0p3
mmcblk0p4
mmcblk0p5
mmcblk0p6
mmcblk0p7
mmcblk0p1 is mountable, and is the EFI boot partition.
Sorry I can't post any of the actual output, so this is all from memory, but the battery just died on the device as I started writing this. I should be able to get some actual output from the commands if it's needed once it's charged again.
Update
So I recompiled Busybox, enabling GPT support in fdisk, and fdisk lists the partitions. I also installed TestDisk on the device, and can browse the filesystem using TestDisk. Trying to mount the partitions listed under /dev/mmcblk0p(2 - 7) still doesn't work, but I can successfully mount a partition by getting the start sector from fdisk -l, then setting up a loop device via losetup -o (Start Sector * Sector Size) /dev/loop0 /dev/mmcblk0, then finally mounting /dev/loop0. Why do I have to go through this method instead of being able to just mount /dev/mmcblk0p2 etc.?
|
OK, so it turned out the issue was that not all the partitions were being listed under /dev. The eMMC has 15 partitions on, but only 1 - 7 were listed. I thought that the 1 - 7 were just the ext4 partitions, and that the other partitions (which aren't formatted to ext4) just wouldn't show up there. So when I thought I was mounting the ext4 partitions, it was trying to mount these others, which it couldn't, hence the error. The problem stemmed from the kernel config, particularly CONFIG_MMC_BLOCK_MINORS, which defaults to 8 I think, so only the first few partitions were showing up. I recompiled the kernel with the value at 20, and the rest of the partitions show up under /dev/mmcblk0p8, 9, 10, etc., and I can mount them just fine.
| Trying to mount ext4 partition from eMMC gives "Invalid Argument" error |
1,436,686,767,000 |
I'm building my own Embedded Linux distro using bitbake . I added udev in the list of dependencies (RDEPENDS).
I noticed that the output of:
udevadm info --query=property --path=/sys/block/sda
is just:
DEVNAME=/dev/sda
DEVPATH=/devices/pci0000:00/0000:00:13.0/ata1/host0/target0:0:0/0:0:0:0/block/sda
DEVTYPE=disk
MAJOR=8
MINOR=0
SUBSYSTEM=block
whereas I expect something like this (the output on my Ubuntu):
DEVLINKS=/dev/disk/by-id/ata-WDC_WD10EALX-009BA0_WD-WMATR1360774 /dev/disk/by-id/wwn-0x50014ee2072ca983
DEVNAME=/dev/sda
DEVPATH=/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda
DEVTYPE=disk
ID_ATA=1
ID_ATA_DOWNLOAD_MICROCODE=1
ID_ATA_FEATURE_SET_HPA=1
ID_ATA_FEATURE_SET_HPA_ENABLED=1
ID_ATA_FEATURE_SET_PM=1
ID_ATA_FEATURE_SET_PM_ENABLED=1
ID_ATA_FEATURE_SET_PUIS=1
ID_ATA_FEATURE_SET_PUIS_ENABLED=0
ID_ATA_FEATURE_SET_SECURITY=1
ID_ATA_FEATURE_SET_SECURITY_ENABLED=0
ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=174
ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=174
ID_ATA_FEATURE_SET_SECURITY_FROZEN=1
ID_ATA_FEATURE_SET_SMART=1
ID_ATA_FEATURE_SET_SMART_ENABLED=1
ID_ATA_SATA=1
ID_ATA_SATA_SIGNAL_RATE_GEN1=1
ID_ATA_SATA_SIGNAL_RATE_GEN2=1
ID_ATA_WRITE_CACHE=1
ID_ATA_WRITE_CACHE_ENABLED=1
ID_BUS=ata
ID_MODEL=WDC_WD10EALX-009BA0
ID_MODEL_ENC=WDC\x20WD10EALX-009BA0\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
ID_PART_TABLE_TYPE=dos
ID_REVISION=15.01H15
ID_SERIAL=WDC_WD10EALX-009BA0_WD-WMATR1360774
ID_SERIAL_SHORT=WD-WMATR1360774
ID_TYPE=disk
ID_WWN=0x50014ee2072ca983
ID_WWN_WITH_EXTENSION=0x50014ee2072ca983
MAJOR=8
MINOR=0
SUBSYSTEM=block
I want to grep after ID_BUS to check whether a device is a usb or not, but it seems that the lines ID_ are missing.
Do you know what am I missing here? My first guess is a missing package, which I am not aware of.
Thank you.
|
The problem is that udev was not started.
/etc/init.d/udev start
Conclusion: in case someone experiences any issue related to udev, firstly make sure it has been started.
| udevadm does not show expected information |
1,436,686,767,000 |
On my embedded system, I can toggle a user led with: echo > 1 sys/class/leds/beaglebone:green:usr2/value.
Similarly, I can find the value of a GPIO (gpio60) (set to input), with more sys/class/gpio/gpio60/value
I've been trying to write a script to set the state of the user led based on that of the input. The following produces no errors, but doesn't actually work.
#!/bin/bash
cd ../../../
if [ sys/class/gpio/gpio60/value = 0 ]; then
echo 1 > sys/class/leds/beaglebone:green:usr2/brightness;
[else echo 0 > sys/class/leds/beaglebone:green:usr2/brightness;]
fi
|
Maybe like this?
if [ $(cat sys/class/gpio/gpio60/value) -eq 0 ]; then
echo 1 > sys/class/leds/beaglebone:green:usr2/brightness
else
echo 0 > sys/class/leds/beaglebone:green:usr2/brightness
fi
| Basic script in Angstrom Linux running on a Beaglebone Black |
1,436,686,767,000 |
The device tree for LCD4 cape is located at /lib/firmware/BB-BONE-LCD4-01-00A1.dts When I looked into it, the declaration of those GPIO buttons confuse me. There are five buttons according to schematic revision A1 here link, none of them are mapped to GPIO0_3, which is UART2. But in the dts file, GPIO0_3(on P9_21) is used as a button.
bone_lcd4_cape_keys_00A2_pins: pinmux_bone_lcd4_cape_keys_00A2_pins {
pinctrl-single,pins = <
0x040 0x2f /* gpmc_a0.gpio1_16, INPUT | PULLDIS | MODE7 */
0x044 0x2f /* gpmc_a1.gpio1_17, INPUT | PULLDIS | MODE7 */
0x04c 0x2f /* gpmc_a3.gpio1_19, INPUT | PULLDIS | MODE7 */
0x154 0x2f /* P9_21 spi0_d0.gpio0_3 INPUT | PULLDIS | MODE7 */
>;
};
Assume this is an error, I tried to disable LCD4 cape on boot up and start my own edited and compiled dts for LCD in uEnv.txt like this:
optargs=quiet capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN,BB-BONE-LCD4-01 capemgr.enable_partno=myNewCape
myNewCape.dtbo is located in /lbi/firmware and compiled from myNewCape.dts without errors.
Basically I commented out all GPIO buttons and key group definition.
It didn't work. This screen is clearly disabled due to capemgr.disable_partno=BB-BONE-LCD4-01 but it never shows anything even capemgr.enable_partno=myNewCape is there.
|
Angstrom mailing list says this error will be corrected in the next Angstrom release. It can also be corrected by recompiling entire kernel with modified dts file. LCD device tree is bundled with kernel directly and cannot be loaded dynamically like other virtual capes.
| Beaglebone Black Device Tree for LCD4 cape |
1,436,686,767,000 |
Scenario
I am on an embedded Linux system. As usual /var/log/ is the directory when all the logs are stored. I have a directory called /safepath which is created during image creation and it is on persistent memory. It means that whatever I place under /safepath persists across reboot sessions.
I want the logs in /var/log/ to not be lost on every reboot and wish to make it persistent through the reboots. So I thought to mount /var/log/ on to /persists by doing a mount --bind /var/log /safepath which I read from this interesting discussion here
Question:
But doing this still causes me to lose the data in /var/log/. Is this correct? How can one force /var/log/ to persist across reboot sessions?
|
Not sure if you are still looking for the solution as question was posted 1 year 4 months ago. Anyway, here is the solution that is very simple.
Change configuration file /etc/syslog.conf (or /etc/rsyslog.conf) to change /var/log/messages to desired path.
| How to make /var/log persistent through reboots on an embedded linux device |
1,436,686,767,000 |
I have an embedded system running a custom distro built using Yocto. Later down the line, I will have a usb camera plugged into the system, but for not I would like to use a .mp4 file as a "dummy" camera.
My goal is to stream the video file over USB as a USB UVC device to a computer so that the computer sees my embedded Linux system as a USB webcam:
I can't find any documentation on the subject and I am a bare metal c developer dipping his toes into embedded Linux development. I would like to know what to look for and the broader steps to get this working. (including modifications to the distro through Yocto.)
Thank you.
|
Where to start?
Is of course a very broad question. So, I can only give you a very rough overview:
Linux can, given your SoC actually has the hardware, control an USB peripheral to act as a device (rather than host). In the Linux context, that's called USB gadget.
With that technical low-level functionality solved, one has to turn to offering the logical functionality as well, i.e., a UVC gadget. Luckily, the Linux kernel brings exactly that.
With that out the way, you need to consider the data aspect. I don't think mp4 I'd something you can directly transport via uvc. So, you would have to transcode first.
Then, the question becomes how to get the transcoded data from Userland into the kernel. The relatively new v4l2-loopback driver might be of help there.
| Stream MP4 file over usb |
1,436,686,767,000 |
I need a kernel compiled, featuring the qcserial module to have support for the Huawei EM 680 model (Gobi 3000). I got kernel 3.11.6 and can find the appropriate source file in ./drivers/usb/serial/qcserial.c but how can I make sure it gets compiled and loaded statically? I can't find it in the kernel config dialog... any ideas?
I'm cross compiling this kernel for an arm AT91 CPU and I need support for above cell modem...
"As of linux-3.1.1-1 the device is detected by the qcserial module" - is what I found on https://wiki.archlinux.org/index.php/Gobi_Broadband_Modems
edit modem-manager
after installing modem-manager, i tried to launch it but I don't really get anything, see the
screen output below:
# modem-manager
modem-manager[2417]: <info> ModemManager (version 0.5.2.0) starting...
modem-manager[2417]: <info> Loaded plugin Novatel
modem-manager[2417]: <info> Loaded plugin ZTE
modem-manager[2417]: <info> Loaded plugin Option High-Speed
modem-manager[2417]: <info> Loaded plugin Longcheer
modem-manager[2417]: <info> Loaded plugin Ericsson MBM
modem-manager[2417]: <info> Loaded plugin Samsung
modem-manager[2417]: <info> Loaded plugin Nokia
modem-manager[2417]: <info> Loaded plugin SimTech
modem-manager[2417]: <info> Loaded plugin Huawei
modem-manager[2417]: <info> Loaded plugin MotoC
modem-manager[2417]: <info> Loaded plugin X22X
modem-manager[2417]: <info> Loaded plugin Generic
modem-manager[2417]: <info> Loaded plugin Sierra
modem-manager[2417]: <info> Loaded plugin Option
modem-manager[2417]: <info> Loaded plugin Wavecom
modem-manager[2417]: <info> Loaded plugin Linktop
modem-manager[2417]: <info> Loaded plugin Gobi
modem-manager[2417]: <info> Loaded plugin AnyData
modem-manager[2417]: <info> (ttyUSB0) opening serial port...
modem-manager[2417]: <info> (ttyUSB1) opening serial port...
modem-manager[2417]: <info> (ttyUSB2) opening serial port...
modem-manager[2417]: <info> (ttyS1) opening serial port...
modem-manager[2417]: <info> (ttyS2) opening serial port...
modem-manager[2417]: <info> (ttyS3) opening serial port...
modem-manager[2417]: <info> (ttyS4) opening serial port...
modem-manager[2417]: <info> (ttyS0) opening serial port...
modem-manager[2417]: <info> (ttyUSB0) closing serial port...
modem-manager[2417]: <info> (ttyUSB0) serial port closed
modem-manager[2417]: <info> (ttyUSB0) opening serial port...
modem-manager[2417]: <info> (ttyUSB1) closing serial port...
modem-manager[2417]: <info> (ttyUSB1) serial port closed
modem-manager[2417]: <info> (ttyUSB1) opening serial port...
modem-manager[2417]: <info> (ttyUSB2) closing serial port...
modem-manager[2417]: <info> (ttyUSB2) serial port closed
modem-manager[2417]: <info> (ttyUSB2) opening serial port...
modem-manager[2417]: <info> (ttyS1) closing serial port...
modem-manager[2417]: <info> (ttyS1) serial port closed
modem-manager[2417]: <info> (ttyS1) opening serial port...
modem-manager[2417]: <info> (ttyS2) closing serial port...
modem-manager[2417]: <info> (ttyS2) serial port closed
modem-manager[2417]: <info> (ttyS2) opening serial port...
modem-manager[2417]: <info> (ttyS3) closing serial port...
modem-manager[2417]: <info> (ttyS3) serial port closed
modem-manager[2417]: <info> (ttyS3) opening serial port...
modem-manager[2417]: <info> (ttyS4) closing serial port...
modem-manager[2417]: <info> (ttyS4) serial port closed
modem-manager[2417]: <info> (ttyS4) opening serial port...
modem-manager[2417]: <info> (ttyS0) closing serial port...
modem-manager[2417]: <info> (ttyS0) serial port closed
modem-manager[2417]: <info> (ttyS0) opening serial port...
modem-manager[2417]: <info> (ttyUSB0) closing serial port...
modem-manager[2417]: <info> (ttyUSB0) serial port closed
modem-manager[2417]: <info> (ttyUSB1) closing serial port...
modem-manager[2417]: <info> (ttyUSB1) serial port closed
modem-manager[2417]: <info> (ttyUSB2) closing serial port...
modem-manager[2417]: <info> (ttyUSB2) serial port closed
modem-manager[2417]: <info> (ttyS1) closing serial port...
modem-manager[2417]: <info> (ttyS1) serial port closed
modem-manager[2417]: <info> (ttyS2) closing serial port...
modem-manager[2417]: <info> (ttyS2) serial port closed
modem-manager[2417]: <info> (ttyS3) closing serial port...
modem-manager[2417]: <info> (ttyS3) serial port closed
modem-manager[2417]: <info> (ttyS4) closing serial port...
modem-manager[2417]: <info> (ttyS4) serial port closed
modem-manager[2417]: <info> (ttyS0) closing serial port...
modem-manager[2417]: <info> (ttyS0) serial port closed
Which is kind of odd as when I plugin the modem, in dmesg I now get:
usb 1-1: New USB device found, idVendor=12d1, idProduct=14f1
usb 1-1: New USB device strings: Mfr=3, Product=2, SerialNumber=0
usb 1-1: Product: Huawei EM680 w/Gobi Technology
usb 1-1: Manufacturer: HUAWEI Incorporated
qcserial 1-1:1.1: Qualcomm USB modem converter detected
usb 1-1: Qualcomm USB modem converter now attached to ttyUSB0
qcserial 1-1:1.2: Qualcomm USB modem converter detected
usb 1-1: Qualcomm USB modem converter now attached to ttyUSB1
qcserial 1-1:1.3: Qualcomm USB modem converter detected
usb 1-1: Qualcomm USB modem converter now attached to ttyUSB2
|
If you look into drivers/usb/serial/Makefile, you'll see that CONFIG_USB_SERIAL_QUALCOMM is responsible for this driver.
Execute make menuconfig and goto "Device Drivers"->"USB support"->"USB Serial Converter support"->"USB Qualcomm Serial modem"
| how do I include the qcserial module in the kernel? |
1,436,686,767,000 |
Sony has TV, PlayStation, Camera random hardware's. Where many of those have GUI available too.
I want to run my BASH script there with ncurses.
But how do they drive there devices? Which operating system is used inside?
Or they just use micro-controllers or is it open-solaris?
Xperia by Sony Ericsson
http://developer.sonymobile.com/wportal/devworld/search-downloads/opensource?cc=gb&lc=en
|
Those customer devices run custom operating systems, or a highly-customized embedded Linux or other UNIX-type OS; sometimes not even Bash and ncurses are included.
It's unlikely that you will be able to run your custom scripts (specially after the PlayStation 3/Linux situation), unless you can get more documentation about them - which might be quite difficult unless you go the reverse-engineering path.
| Sony runs which operating system? Oracle Linux or Crestron Extron or Minix or OS X? |
1,436,686,767,000 |
In the past our company used raspberry pi's for our IOT application.
The problem with that was that SD cards wear out and get corrupt.
We now ordered Compulab SBC's with eMMC storage running Debian.
So what would be the best practices to configure durable embedded IOT devices?
I would say:
Choose an SBC with eMMC storage
Make sure you have a journaling filesystem (has_journal is enabled on EXT4)
Write logs to ram to prevent wear on storage (in /etc/systemd/journald.conf Storage=volatile)
Ensure fsck runs at boot (in /etc/fstab the last field is set to 1 or 2)
Swap should be disabled (run free -> total Swap should be 0)
Any more suggestions?
Overlay file system
Raspbian has an option in 'raspi-config'->'Performance Options'->'Overlay File System'
I asked Compulab if they would recommend also using it, but they think it is already as robust as it can be with filesystem journaling and fsck that runs at boot.
Would using an Overlay File System to prevent writes to storage be worth the extra complexity of needing to reboot the device multiple times to disable it and enable it again if you ever want to update it later?
|
I'll try to address your first question regarding the storage device durability as I'm a bit familiar with that.
Switching from SD to eMMC might not improve the situation if you don't do an accessment of your system's storage usage and take action to improve things, because both SD and eMMC use NAND.
Do you have an estimate of data writes to your storage?
Use the following to evaluate your use case [see [1] for details]
total bytes written throughout device life = (device capacity in bytes) * (max program/erase cycles) / (write amplification factor)
Say for example
you write 0.5GiB per day
want your device to operate for 5 years
partitions you write data to totals 4GiB (storage capacity is more
than this, but other partitions are read-only)
max program/erase cycles is 3000 for your multi-level cell (MLC) NAND
This gives you a write amplification factor of
4 * 3000 / (0.5 * 365 * 5) = ~13
What is write amplification
NAND in the SD or eMMC is written in NAND pages. Suppose you write/modify 1KiB (two 512-byte sectors) from the host, but say NAND page is 16KiB. So, the eMMC controller will write a whole NAND page.
Things get more complicated when you think of erasures, because NAND is erased in NAND blocks, and a NAND block consists of many NAND pages.
So, what can you do to improve device life
From the above equation, you can
increase device capacity (but that'll add to the cost)
improve program/erase cycles: go for SLC or turn your data write partitions from MLC to pSLC (but this reduces the capacity)
reduce write amplification by improving your apps to perform NAND page aligned, NAND page sized (or multiples) writes from host (see eMMC EXT_CSD[265] optimal write size), enabling eMMC cache etc.
What else can you do
You can monitor your eMMC health using mmc-utils (https://git.kernel.org/pub/scm/utils/mmc/mmc-utils.git) or sysfs, and take necessary steps before the failure comes as a surprise.
eMMC extended CSD register provides
estimate for life time of SLC and MLC blocks in steps of 10%
(0x01 = 0-10% device life time used, 0x02 = 10-20%, .. , 0x0B = end of life)
type-B (MLC): EXT_CSD[268], type-A (SLC): EXT_CSD[269]
status of the spare blocks that are used to replace bad blocks
(0x01: Normal, 0x02: Warning: 80% of blocks used, 0x03: Urgent: 90% of blocks used)
Pre EOL info: EXT_CSD[267]
vendor may provide a proprietary health report in EXT_CSD[301:270] (but so far, I have only seen all zeros here)
e.g.
mmc-utils:
# mmc extcsd read /dev/mmcblk0
:
eMMC Life Time Estimation A [EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_A]: 0x01
eMMC Life Time Estimation B [EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B]: 0x00
eMMC Pre EOL information [EXT_CSD_PRE_EOL_INFO]: 0x01
:
sysfs:
# cat /sys/block/mmcblk0/device/life_time
0x00 0x01
# cat /sys/block/mmcblk0/device/pre_eol_info
0x01
vendor may provide health related information you can access from mmc generic command CMD56 (using mmc-utils, mmc gen_cmd read < device > [arg])
See the following for a good explanation:
[1] https://www.kingston.com/en/embedded/emmc-embedded-flash
'Estimating, validating & monitoring eMMC life cycle'
| What are the best practices for configuring durable IOT Linux devices? Should I use an Overlay File System? |
1,436,686,767,000 |
I want to install a package manager on an embedded system that does not currently have one.
I know that the best way to do this is to use bitbake to simply bake a new image which includes a package manager and then flash that image to the board, but unfortunately I don't currently have access to all of the necessary pieces to build a full operating system image, so I need to hack it somehow.
The embedded system is running Automotive Grade Linux (Halibut 8.0.0).
sa8155:/etc# cat os-release
ID="auto"
NAME="auto"
VERSION="8.0.0 (halibut)"
VERSION_ID="8.0.0"
PRETTY_NAME="auto 8.0.0 (halibut)"
sa8155:/etc#
Linux kernel 4.14.146
😈 >adb shell
sa8155:~# uname -srm
Linux 4.14.146 aarch64
I'm not sure which version of glibc is installed as the system currently has no development tools:
sa8155:~# ldd --version
-sh: ldd: not found
sa8155:~# lsof -p $$ | grep libc | awk ' { print $NF" --version"; } ' | sh
-sh: lsof: not found
sa8155:~#
If I can get the package manager installed, the first thing I will do is install the development tools.
Also, I'm not sure about any other dependencies that the debian package manager may have.
|
Installing dpkg built for something else on a different distribution to manage software built also elsewhere does not sound like a great idea. This is going to be fraught with binary compatibility problems and subtle errors, as this would be the equivalent of using dpkg with --force-all and disregarding any dependency information.
Even projects that use dpkg as an overlay on top of a pre-existing binary "distribution" such as Fink on macOS, do build all the overlayed packages on the macOS system they are targeting, and inject phantom dependencies to represent the base system software.
Probably what you should do instead is create a foreign arm64 chroot with «debootstrap --arch=arm64 --foreign», tar that up and unpack and finalize the second stage debootstrapping on that device to get an actual and proper Debian chroot in that system, with a functional dependency system.
| Where can I get a tarball of the debian package manager for aarch64? |
1,436,686,767,000 |
I am running OpenWrt (=Busybox per SSH) so my amount of binaries is limited. I would like to change my MAC address only using a text editor like nano.
|
As you can see here, you should add the option macaddr in /etc/config/network in your desired interface.
For example:
config interface 'lan'
option ifname 'eth0.1'
option proto 'dhcp'
option macaddr 'xx:xx:xx:xx:xx:xx'
After that, restart the network service with /etc/init.d/network restart or reboot the device.
| How to change eth0 MAC address only using a text editor? |
1,436,686,767,000 |
In the recent project we have been asked to create a debain based system for a SOC. Doing some gooogling I did find guides that point to ways to use yocto to create a debian system [1]. But then I also came across steps to create debian root filesystem using multistrap[2] and it worked (just had to give list of packages in config file).
After going through all this I am unable to bring my head around "What is debain and what makes an [kernel + Rootfs + initrd] package debian?". I understand there is a Debain distribution of linux but in the world of embedded devices what does debain mean, is it the same ?. The SOC vendor provides me with option of loading a debain based system or Open embedded system or android system or Core ubuntu sytem and many more[3]. What exactly makes them all different (I understand the difference between andriod kernel and linux kernel but what about core ubuntu and debain are they not closely related)?
[1] : http://events17.linuxfoundation.org/sites/events/files/slides/Yocto%20%2B%20Debian%20%283%29.pdf
[2] : https://www.acmesystems.it/debian_jessie
[3] : https://www.96boards.org/documentation/consumer/dragonboard410c/downloads/
|
The problem may come from the common miss-use of the word Linux. Linux is just the kernel, however it is often used to mean the whole system (kernel, shell, tools, libraries, compiler, and user applications) see here https://www.gnu.org/gnu/linux-and-gnu.en.html it may clear up some confusion.
Debian, Ubuntu, Mint, CentOs, Suse, Vector, … are all collections of all of this. Some are related more than others.
see also https://en.wikipedia.org/wiki/List_of_Linux_distributions#/media/File:Linux_Distribution_Timeline.svg
What this does not show, is that all the projects got their material from up-stream sources. The Gnu project, A kernel named Linux, Xfree86/Xorg, and many others.
| What makes debian different from other variants given they have same kernel? [closed] |
1,436,686,767,000 |
The motivation behind this question arises from exploring the Intel Galileo gen2 board which has a single threaded processor.
I'm looking for a conceptual explanation on what does that mean for all the userspace applications that rely on the existence of threading?
Does this mean that the kernel needs to be patched so that the system calls for the threading invocation are emulated in software instead of relying on the CPU threading support?
|
Multi-tasking systems handle multiple processes and threads regardless of the number of processors or cores installed in the system, and the number of "threads" they handle. Multi-tasking works using time-slicing: the kernel and every running process or thread each get to spend some time running, and then the system switches to the next runnable thread. The switches happen very frequently, which gives the impression everything is running in parallel even when it's not.
All this happens without any change to the APIs etc. Multi-core systems need to be able to run more threads than they physically support anyway, the single-core case is just an instance of that.
Describing a CPU as single-threaded refers to simultaneous multithreading (SMT, or hyper-threading in the Intel world), not the CPU's ability to run multiple threads (or processes, or tasks). Adding SMT features to a CPU doesn't add any instructions to help running threads, it just allows better use of the hardware in some circumstances.
| Multithreaded applications on a single threaded CPU? |
1,436,686,767,000 |
I'm building a control device that runs Debian Jessie on a ARM based Linux SBC. I'm curious what the recommended location is for application files? To date, I've been placing things in a root level directory, e.g.
/MyApplication
But I was toying with moving it to /root/ since it's a single user deployment, e.g.
/root/MyApplication
I know if I was on a more conventional multi-use(r) system, I'd place it in /usr/local/ or maybe /opt/local/. But I'm think that perhaps the guidelines/practices might be different for embedded single use devices?
|
Certainly you have tighter control of the environment on an embedded system than you do on a desktop or server, and you can probably get away with putting your files anywhere you like (subject to constraints like avoiding read-only filesystems, which embedded systems often have).
That being said, I would definitely avoid /root. That's root's home directory and application files that belong to the application and not to the system administrator emphatically do not belong there.
On an embedded system, /MyApplication is probably just fine. It has the advantage of being obvious to anyone who inherits management of the system. /usr/local and /opt/local are fine too, but they lump your application's files together with any other software that might be installed in those directories (which might occur because it's not packages with the operating system distribution). I would consider /opt/MyApplication as an alternative to /MyApplication, but not with any very strong preference.
| Where to place application files in embedded linux deployment? |
1,436,686,767,000 |
So I wanted to do some performance test with encrypted and normal data storage on my embedded device.
That is not what I was expected to see at all!
Can you please explain it to me what just happend. Why dd comand output was 1843200+0 records but df -h show file system disk space usage as 13TB?
Maybe I explain what I have done. This is my workflow:
dd if=/dev/urandom of=enc_per_test.img bs=512 count=2097152
dd if=/dev/urandom of=normal_per_test.img bs=512 count=2097152
And receive 2 images 1GB each - as I predicted.
losetup /dev/loop1 enc_per_test.img
losetup /dev/loop2 normal_per_test.img
After that I perform:
dmsetup -v create enc_per_test --table "0 $(blockdev --getsz /dev/loop1) crypt <crypt_setup> 0 /dev/loop1 0 1 sector_size:512"
mkfs.ext4 /dev/mapper/enc_per_test
mkdir /mnt/enc_per_test
mount -t ext4 /dev/mapper/enc_per_test /mnt/enc_per_test/
As I expected df-h showed mounted enc_per_test:
Filesystem ############## Size ### Used ## Avail ## Use% ### Mounted on #####
/dev/mapper/enc_per_test ## 976M ## 2.6M ## 907M ## 1% #### /mnt/enc_per_test
I clear cache:
echo 3 > /proc/sys/vm/drop_caches
And finally perform dd comand to fill up the enc_per_test:
time dd if=/tmp/random of=/dev/mapper/enc_per_test conv=fsync
1843200+0 records in
1843200+0 records out
943718400 bytes (944 MB, 900 MiB) copied, 152.098 s, 6.2 MB/s
So I was like, ok that's fine. This is what I wanted. Let's see how it's look like in df -h:
Filesystem ############## Size ### Used ## Avail ## Use% ### Mounted on #####
/dev/mapper/enc_per_test ## 13T ## 13T ## 0 ## 100% #### /mnt/enc_per_test
What happned here? Why df -hshow 13TB of data storage. It is even not possible because my device has ~250GB of hard drive.
Thank you for any answer and hint!
|
You mounted a filesystem existing in /dev/mapper/enc_per_test (the device) to /mnt/enc_per_test/ (the mountpoint).
Then with dd you chose to write to the device, not to a regular file inside the filesystem (i.e. under the mountpoint, e.g. of=/mnt/enc_per_test/blob). Your dd overwrote the majority of the filesystem with the content of /tmp/random while the filesystem was mounted.
df queries mounted filesystems. For a given filesystem the fields Size, Used and such are what the filesystem knows and reports about itself. Probably some data, metadata and information about the filesystem in question was still available as old values in the cache, so it seemed sane enough; but apparently something new had to be read from the device. Some part(s) of the garbage you had written was read, hence the surprising values
The statement in the title is wrong. It's not true that "dd command created 13TB of data". 13T appeared only because df got some random values from what used to be a filesystem.
| Performance test went wrong and the dd command created 13TB of data on /dev/mapper/device. Why system didn't crash? HDD-250GB |
1,436,686,767,000 |
For some reason, my U-Boot does not seem to be able to load files from my FAT32 partition:
=> mmc part
Partition Map for MMC device 1 -- Partition Type: DOS
Part Start Sector Num Sectors UUID Type
1 2048 62519296 a1d1165e-01 0b
=> fatls mmc 1:1
52560 file1.bin
1984 file2.bin
456 file3.bin
64 file4.bin
=> fatload mmc 1:1 0x0001FF80 file1.bin
** Reading file would overwrite reserved memory **
Failed to load 'file1.bin'
Why do I get Failed to load and how can I get around it?
|
It's telling you the reason:
** Reading file would overwrite reserved memory **
Based on the first line of the error message, reading the file into memory using the start address you specified would cause some reserved memory area to be overwritten.
You should either use a different start address (and perhaps rebuild your file(s) to match the changed start address), or perhaps change U-Boot (and rebuild it) to place itself into a different location if U-Boot is the one reserving the memory you are trying to use.
You will have to understand the boot-time memory map of the system you're trying to boot. Without knowing the actual hardware you're using, it's kind of difficult to help you there, but the bdinfo command of U-Boot could be a good starting point.
| Why am I not able to load files from a partition with U-Boot? |
1,436,686,767,000 |
We have IoT gateways that run Linux 5.4.31 kernel. These gateways need to manage thousands of devices which are mobile and each has a unique encryption key. The idea is to fetch the key of a device from a server (via secure channel) when the device enters the range, use it for decryption as long as the device is in the range and delete the key from memory when it leaves. Decryption must be done on the gateway since we have to do specific actions depending on the received data.
We want to store the keys on RAM unencrypted because we don't want the overhead of decrypting the keys for each time we access them. We have following assumptions:
Physical access to the gateways are not possible.
The service is running under a non-root user.
An attacker might gain access to the gateway as a non-root user (that is different from the service user if that matters).
An attacker might pull off a buffer overflow attack.
What are the options of an attacker to access the encryption keys on the RAM under these assumptions if
We store the keys on a statically allocated memory (via static keyword in C, not in stack)
We store the keys on dynamically allocated memory (it would probably be one-time allocation since we have limited resources).
Also what restrictions should we put on a non-root user, e.g. they can't access swap memory, core dumps, install packages, use gdb, etc. to prevent access to the process RAM?
Note: If the attacker has root access then they can access to all the keys using the private key that is used to access the server anyway, so we do not consider this case for this question.
|
You’ll probably get better answers on Information Security SE.
You should ensure that the keys aren’t written to swap, by locking the relevant memory ranges (see mlock); this is easier to do if you allocate a pool of memory for the keys.
Also what restrictions should we put on a non-root user, e.g. they can't access swap memory, core dumps, install packages, use gdb, etc. to prevent access to the process RAM?
Non-root users can’t access swap anyway, and by locking the keys in memory you avoid that issue entirely. Non-root users also can’t access core dumps other than those generated by their own processes, and they can’t ptrace other users’ processes either (which means they can’t run gdb etc. to view other processes’ memory).
If your CPU provides the required features, you could look into using pkeys for additional protection. Another possibility is to delegate key handling to the kernel entirely; see the keyrings man page for details.
| Feasibility of storing keys unencrypted on RAM under certain assumptions |
1,622,818,609,000 |
I want to know what actually happens once I turn my ethernet OFF.
What does the OS do on a network layer?
Does it flush the routing table or anything like that.
|
Linux kernel describes every Ethernet adapter(physical device or virtual) by struct net_device (struct net_device). Every struct net_device has a set of struct net_device_ops which should be implemented by device driver. The most important of them:
ndo_open(). Called when you set Ethernet adapter to ON (ip link set up dev <eth_dev>).
ndo_start_xmit(). Called when you start transmit data through the interface.
ndo_stop(). Called when you set Ethernet adapter to OFF(ip link set down dev <eth_dev>).
So, what's really does when device is going DOWN?
There are set of routines which implemented in most drivers:
stop all queues related to specific device.
clear ARP table entries related to specific device.
mark interface status as DOWN (ip link show dev <eth_dev>).
device specific features: clear some structs, buffers, move Ethernet controllers chip to sleep...
| What happens when I turn my ethernet off? What steps does the OS perform once I turn the ethernet OFF? |
1,622,818,609,000 |
I am usin Buildroot as distro.
I have a problem. I wanted to update my build with adding some packages for my embedded system(stm32mp157).
In menuconfig --> Filesystem images I chose an exact size of 270M which generated the above error.
I tested the exact size and I for
exact file size inferior to 265M :mkfs.ext4: Could not allocate block in ext2 filesystem while populating file system
*** Maybe you need to increase the filesystem size (BR2_TARGET_ROOTFS_EXT2_SIZE)
fs/ext2/ext2.mk:46: recipe for target '/home/mehdi/buildroot/output/images/rootfs.ext2' failed
exact file size superior or equal to 265M I get : part rootfs size (268435456) too small for rootfs.ext4 (283115520)
What should I do? I am beginning my project and I may need further packages and modules for what is coming.
What should I do?
Best Regards
|
I assume you are using genimage to create your final SD/MMC image. If this is the case, then your genimage configuration file defines a size of 256 MB for the partition that holds the rootfs, and this size is too small. You need to change your genimage configuration file.
Based on the issue you report, I suppose you're perhaps using the STM32MP1 Buildroot configuration I wrote and published at https://github.com/tpetazzoni/buildroot/blob/2019.02/stm32mp157-dk-blog-7/ together with a series of blog post.
And indeed, the genimage configuration file at https://github.com/tpetazzoni/buildroot/blob/2019.02/stm32mp157-dk-blog-7/board/stmicroelectronics/stm32mp157-dk/genimage.cfg limits the rootfs partition size to 256 MB. Just change that.
| Buildroot How do I deal with Error filesystem size (BR2_TARGET_ROOTFS_EXT2_SIZE) |
1,622,818,609,000 |
We have an embedded arm device running an OS based on Debian 9, running kernel 4.14.67-1.0.6+.
EDIT: As per @A.B's request, below is the driver/chipset info too for future viewers - I didn't know how to find this at the time of asking the question.
filename: /lib/modules/4.14.67-1.0.6+/extra/mlan.ko
license: GPL
version: C605
author: Marvell International Ltd.
description: M-WLAN MLAN Driver
srcversion: 103492D596FC10822F1F391
depends:
name: mlan
vermagic: 4.14.67-1.0.6+ SMP preempt mod_unload modversions ARMv7 p2v8
We're able to connect to WiFi on bootup, but when the signal is lost the device is not automatically reconnecting. I've been going over the documents for /etc/network/interfaces and wpa_supplicant again and again trying different options and while I've made some progress it's still not reconnecting properly.
My config is shown below. I've tried playing about with wpa-conf vs wpa-roam with a manual iface setting. I've tried using different autoscan and ap_scan settings for wpa_supplicant. We've tried using NetworkManager in the past but that proved to have some issues with the GSM interface on this device.
/etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
allow-hotplug mlan0
iface mlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
/etc/wpa_supplicant/wpa_supplicant.conf
ap_scan=2
# Networks SSIDs
network={
ssid="1+ Benji"
psk="REDACTED"
key_mgmt=WPA-PSK
}
I'm testing this by rebooting the device and making sure it has a good connection, then turning off and on the WiFi hotspot on my mobile. When it's brought back up wpa_supplicant now scans to attempt to reconnect (which it wasn't before) but the connection keeps failing just saying that the station is leaving.
/var/log/syslog
# Network manually turned off
Feb 11 15:56:08 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-DISCONNECTED bssid=94:65:2d:83:c2:0d reason=3
Feb 11 15:56:08 arm kernel: [ 154.302149] wlan: EVENT: Disassociated (reason 0x3)
Feb 11 15:56:08 arm kernel: [ 154.302166] wlan: REASON: (Deauth) Sending STA is leaving (or has left) IBSS or ESS
Feb 11 15:56:08 arm kernel: [ 154.302339] wlan: Disconnected from 94:XX:XX:XX:c2:0d: Reason code 3
Feb 11 15:56:08 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Feb 11 15:56:08 arm wpa_supplicant[459]: mlan0: Trying to associate with SSID '1+ Benji'
Feb 11 15:56:13 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=1
Feb 11 15:56:13 arm kernel: [ 159.732160] wlan: SCAN COMPLETED: scanned AP count=0
Feb 11 15:56:14 arm wpa_supplicant[459]: mlan0: Trying to associate with SSID '1+ Benji'
Feb 11 15:56:19 arm kernel: [ 165.291259] usb 2-1: USB disconnect, device number 5
Feb 11 15:56:19 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=1
Feb 11 15:56:19 arm kernel: [ 165.572172] wlan: SCAN COMPLETED: scanned AP count=0
Feb 11 15:56:20 arm wpa_supplicant[459]: mlan0: Trying to associate with SSID '1+ Benji'
Feb 11 15:56:26 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=1
Feb 11 15:56:26 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="1+ Benji" auth_failures=1 duration=10 reason=CONN_FAILED
Feb 11 15:56:26 arm kernel: [ 171.912043] wlan: SCAN COMPLETED: scanned AP count=0
Feb 11 15:56:31 arm wpa_supplicant[459]: mlan0: Trying to associate with SSID '1+ Benji'
Feb 11 15:56:36 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=1
Feb 11 15:56:36 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="1+ Benji" auth_failures=2 duration=20 reason=CONN_FAILED
Feb 11 15:56:36 arm kernel: [ 182.252181] wlan: SCAN COMPLETED: scanned AP count=0
# Network AP manually turned back on
Feb 11 15:56:46 arm wpa_supplicant[459]: mlan0: Trying to associate with SSID '1+ Benji'
Feb 11 15:56:51 arm kernel: [ 197.512170] wlan: SCAN COMPLETED: scanned AP count=1
Feb 11 15:56:51 arm kernel: [ 197.682452] wlan: Connected to bssid 94:XX:XX:XX:c2:0d successfully
Feb 11 15:56:51 arm kernel: [ 197.685349] wlan: Received disassociation request on mlan0, reason: 3
Feb 11 15:56:51 arm kernel: [ 197.685361] wlan: REASON: (Deauth) Sending STA is leaving (or has left) IBSS or ESS
Feb 11 15:56:53 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-DISCONNECTED bssid=94:65:2d:83:c2:0d reason=3 locally_generated=1
Feb 11 15:56:53 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Feb 11 15:56:53 arm wpa_supplicant[459]: mlan0: Trying to associate with SSID '1+ Benji'
Feb 11 15:56:54 arm kernel: [ 199.872319] wlan: Connected to bssid 94:XX:XX:XX:c2:0d successfully
Feb 11 15:56:54 arm kernel: [ 199.874233] wlan: Received disassociation request on mlan0, reason: 3
Feb 11 15:56:54 arm kernel: [ 199.874247] wlan: REASON: (Deauth) Sending STA is leaving (or has left) IBSS or ESS
Feb 11 15:56:55 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-DISCONNECTED bssid=94:65:2d:83:c2:0d reason=3 locally_generated=1
Feb 11 15:56:55 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Feb 11 15:56:55 arm wpa_supplicant[459]: mlan0: Trying to associate with SSID '1+ Benji'
Feb 11 15:56:55 arm kernel: [ 201.702474] wlan: Connected to bssid 94:XX:XX:XX:c2:0d successfully
Feb 11 15:56:55 arm kernel: [ 201.704140] wlan: Received disassociation request on mlan0, reason: 3
Feb 11 15:56:55 arm kernel: [ 201.704152] wlan: REASON: (Deauth) Sending STA is leaving (or has left) IBSS or ESS
Feb 11 15:56:57 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-DISCONNECTED bssid=94:65:2d:83:c2:0d reason=3 locally_generated=1
Feb 11 15:56:57 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="1+ Benji" auth_failures=3 duration=30 reason=CONN_FAILED
Feb 11 15:56:57 arm wpa_supplicant[459]: mlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD
Feb 11 15:56:57 arm wpa_supplicant[459]: mlan0: Trying to associate with SSID '1+ Benji'
Feb 11 15:56:58 arm kernel: [ 203.872352] wlan: Connected to bssid 94:XX:XX:XX:c2:0d successfully
Feb 11 15:56:58 arm kernel: [ 203.874052] wlan: Received disassociation request on mlan0, reason: 3
Feb 11 15:56:58 arm kernel: [ 203.874064] wlan: REASON: (Deauth) Sending STA is leaving (or has left) IBSS or ESS
As you can see after I turn the network AP back on the device keeps trying to reconnect, but fails with reason 3. I've looked up that reason and I can't find anything that actually says anything meaningful and the message of "Sending STA is leaving (or has left) IBSS or ESS" isn't helpful.
If any additional information or output logs are needed please let me know and I'll be happy to supply them.
|
I also asked the device manufacturer if they had any suggestions a few days ago, while it took a bit for them to respond, their suggestion appears to be working perfectly.
The basic /etc/network/interfaces that I have is fine, but there was 1 line that I was missing when I was trying all the various options in /etc/wpa_supplicant/wpa_supplicant.conf which is disable_scan_offload=1... With ap_scan=1.
Final config:
# Enable WiFi scanning on network disconnect.
ap_scan=1
autoscan=periodic:10
disable_scan_offload=1
# This above line is crucial for making wpa_supplicant do the scan instead of relying
# on the driver, which in this case didn't appear to be scanning to reconnect.
# Users saved network list
network={
ssid="1+ Benji"
psk="REDACTED"
key_mgmt=WPA-PSK
}
#network={...}
#network={...}
| Embedded device wpa_supplicant reconnect |
1,622,818,609,000 |
I have an issue trying to build kernel and modules for an embedded system. The resulting Module.symvers has some (a few dozen) entries with invalid (0x00000000) CRC entries.
I'm trying to figure out the process by which Module.symvers is generated so that I can start debugging the problematic entries. However, after looking at the build process for a few hours, I still can't figure out what generates Module.symvers.
N.B. - I am looking for the code that actually creates the contents of Module.symvers, not for instructions to "make modules" ;-)
I suspect that the breakage is due to building Linux 3.4.12 with GCC 6.3, but I need to get it working with that config. Disabling modvers is not an option, because I need to load 3rd party binary blob modules.
|
The creation of Module.symvers has a number of steps. These steps make use of MODVERDIR (typically .tmp_versions in the build directory) which contains .mod files,
After the modules are compiled and corresponding .o files are generated, the source is pushed through the C pre-processor with -D__GENKSYMS__ and the resulting output is piped into scripts/genksyms. genksyms implements it's own (relatively simple) code parser to generate symbol signatures and their corresponding CRCs. It was the limitations in this parser that prevented genksyms from correctly parsing source when using gcc 6.3 on kernel 3.4. (I solved my issue by backporting kernel 4.12 genksyms). genksyms will produce a .mod.c file for each module that contains all the symbol CRCs. This is then compiled to produce .mod.o files.
The final step involves parsing all the *.mod files in MODVERDIR, examining these for all the .ko files that make up the modules and passing the corresponding list of .mod.o files, together with vmlinux to scripts/modpost. scripts/modposts parses the object files and generates Module.symvers.
| How is Module.symvers generated? |
1,622,818,609,000 |
I am working on embedded Linux.(arm)
I am using mplayer.
In general, the video plays well. (# mplayer aaa.mp4)
However, using the "-zoom" option will slow video playback. (# mplayer aaa.mp4 -zoom)
Why is it slower with the "-zoom" option despite the same movie size?
How should I solve this problem?
|
man mplayer:
-zoom
Allow software scaling, where available. This will allow scal‐
ing with output drivers (like x11, fbdev) that do not support
hardware scaling where MPlayer disables scaling by default for
performance reasons.
Solution: use video output which supports hardware scaling.
| The "-zoom" option slows down mplayer |
1,622,818,609,000 |
I am working on ROS under Ubuntu 14.04 on an Odroid XU3 (ARM dev board).
I connect two USB devices to my dev board which are recognized as ttyACM0 and ttyACM1 according to the time when they are connected.
Since thoses devices (Arduino & PixHawk) have different PID / VID, I would like to bind them to a certain "custom name" tty like ttyController0 & ttyPosition0 for example.
According to this subject, we can simlink the device depending on PID & VID to ttyUSB0.
How should I do to simlink to a deterministic name? Would 4 rules in /etc/udev/rules.d/99-custom.rules with a simlink work ?
ACTION=="add", ATTRS{idVendor}=="0123", ATTRS{idProduct}=="0001", RUN+="/bin/ln -s /dev/ttyACM0 /dev/ttyController"
ACTION=="remove", ATTRS{idVendor}=="0123", ATTRS{idProduct}=="0001", RUN+="/bin/rm /dev/ttyController"
ACTION=="add", ATTRS{idVendor}=="3210", ATTRS{idProduct}=="0002", RUN+="/bin/ln -s /dev/ttyACM0 /dev/ttyPosition"
ACTION=="remove", ATTRS{idVendor}=="3210", ATTRS{idProduct}=="0002", RUN+="/bin/rm /dev/ttyPosition"
Or can I use Udev with custom PID & VID ?
|
Your configuration should basically work, but I'd like to make a few suggestions:
First off, I think you want to use ATTR, not ATTRS. ATTRS searches the whole device tree upwards to a matching (parent) device. This is most likely not what you intend. With using ATTR the device actually triggering the event has to have the specified attribute.
Second, as creating symlinks to device nodes is a rather common task, there is a dedicated statement to do so, i.e. SYMLINK+="newname". This way you won't be dependent on "external" commands. Even more important, by using this directive, you only need to match the "add" event as udevd will automatically removes associated symlinks when a device vanishes.
Thus, your rules should be
ACTION=="add", ATTR{idVendor}=="0123", ATTR{idProduct}=="0001", SYMLINK+="ttyController"
ACTION=="add", ATTR{idVendor}=="3210", ATTR{idProduct}=="0002", SYMLINK+="ttyPosition"
And last, I would suggest narrowing down the match by adding a further SUBSYSTEM constraint, i.e. adding SUBSYSTEM=="usb". As device and vendor IDs are only (hopefully) unique in their scope, leaving out the subsystem match could result in your rules matching on other device classes, like PCI devices. Even though this is rather unlikely, it is commonly seen as good style in udev rules:
SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="0123", ATTR{idProduct}=="0001", SYMLINK+="ttyController"
SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="3210", ATTR{idProduct}=="0002", SYMLINK+="ttyPosition"
| How to give a custom name to a serial device on connection? |
1,622,818,609,000 |
I'm new to embedded and am reading 'Embedded Linux Primer' at the moment.
I tried to build an xscale arm kernel:
make ARCH=arm CROSS_COMPILE=xscale_be- ixp4xx_defconfig
#
# configuration written to .config
followed by the make:
~/linux-stable$ make ARCH=arm CROSS_COMPILE=xscale_be- zImage
make: xscale_be-gcc: Command not found
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
CC kernel/bounds.s
/bin/sh: 1: xscale_be-gcc: not found
make[1]: *** [kernel/bounds.s] Error 127
make: *** [prepare0] Error 2
I had downloaded and extracted gcc-arm-none-eabi-4_9-2014q4 from
https://launchpad.net/gcc-arm-embedded
and set the path
PATH=/opt/gcc-arm-none-eabi-4_9-2014q4/bin/
Do I need another compiler for the xscale architecture?
Any ideas where I can find xscale_be-gcc?
|
I'm reading the same book and get stuck in the same part, so... after some research i finally compiled the kernel for ixp4xx target
Download the ARM toolchain from:
Devloper arm Compiler v6
then...
$ mkdir -p ~/opt
$ cd ~/opt
$ tar xjf ~/Downloads/gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2
$ chmod -R -w ~/opt/gcc-arm-none-eabi-6-2017-q2-update
look if the installation is correct
~/opt$ gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi-gcc --version
The output will be something like this:
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors 6-2017-q2-update) 6.3.1 20170620 (release) [ARM/embedded-6-branch revision 249437]
Copyright (C) 2016 Free Software Foundation, Inc...
Now you can prepare your Kernel source tree
make ARCH=arm CROSS_COMPILE=~/opt/gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi- ixp4xx_defconfig
And finally compile...
make ARCH=arm CROSS_COMPILE=~/opt/gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi- zImage
Maybe it is not the best compiler for the target or need a kernel patch but... in order to follow each step in the book i think is enough.
BR,
| make: xscale_be-gcc: Command not found |
1,622,818,609,000 |
I try to speed up my boot sequence, and somebody recommends to use the uClibc instead of Glibc. I've built an image with it, it gets smaller and faster to boot — but at which cost?
Does anyone know the disadvantages of using uClibc as the C library?
|
You can refer to the official page: https://www.kernel.org/pub/linux/libs/uclibc/Glibc_vs_uClibc_Differences.txt
| What are the disadvantages of uClibc? |
1,622,818,609,000 |
I am working on an embedded Linux system (kernel-5.10.24). Now I am trying to use zbar-0.23 to scan barcodes in JPEG format, but I don't know how to do that.
There is an example/scan_image.c, which can scan barcodes in PNG format, but my barcodes are all in JPEG format.
So how to scan the barcodes in JPEG format with zbar? What are the interfaces in libzbar can be used to do the JPEG barcode scanning?
|
The zbarimg program uses imagemagick to read the images.
See the code here: https://github.com/herbyme/zbar/blob/068c810f75994b61ab9edc689650d09a0fc78bf9/zbarimg/zbarimg.c#L127
That deals beautifully with jpeg and a very large range of image files (unless you disabled jpeg explicitly when building imagemagick). So, I don't know what exactly you're doing, but it seems like a solved problem!
| How to scan barcode in JPEG format with zbar in Linux? |
1,622,818,609,000 |
I have to update some outdated embedded systems. But the RAUC Update contains four partitions, while the old systems have only three partitions.
The additional Partition is at the start of the disk and I cannot flash the devices with an external Adapter.
What I have, is SSH access to the existing Linux on the device.
Could I change the partition table somehow from within the running system and thereby move the system partition?
Or could I somehow dd the whole disk with a new image?
I just cannot get my head around this problem and I am not sure, if I am missing a good solution here.
|
I did something similar on an embedded system. What saved me was that the compressed image of the new disk (with all its partitions) was small enough to keep in memory.
What I did was to patch the initramfs to include a custom script. At boot, before mounting anything, it copied the (compressed) disk image into a ramfs filesystem, and decompressed it to dd of=/dev/<disk>, completely overwriting everything, including new partitioning.
(I had to struggle a bit to retain certain files. In the end I did a tarball of what I wanted to retain, put this as well in the tmpfs, and untarred this onto the new filesystem. It's working pretty well.)
I'm sure that there are prettier solutions, but this worked for me.
[Edited to add:]
Another option would be to add a small script in the initramfs that would pull in the disk image over network. You'd have to figure out IP settings etc without the benefit of the full system, which can be awkward. But I think that putting a script in the initramfs is probably your best option as it can run from ram, without mounting any disks, so that you can overwrite the lot.
| Handle Partition Changes Embedded System |
1,622,818,609,000 |
I am trying to ssh into an embedded Linux device (let's call it petalinux) connected to my Ubuntu server running 22.04 (let's call it oip). petalinux and oip are connected by a direct ethernet cable and a serial UART. I am able to connect to the device using a serial terminal (minicom), but ssh times out. I am also unable to ping the device. So, I believe it is one of two things:
Network settings are incompatible (subnet mask, gateway, etc.), or
The firewall on the embedded Linux device is not letting traffic through.
In order to check the first one, I tried finding the IP address of oip; however, I do not see an IPv4 associated with eno1:
EDIT (add output of ifconfig, arp, netstat, and ip route)
$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether cc:48:3a:66:a3:b3 brd ff:ff:ff:ff:ff:ff
altname enp0s31f6
inet6 fe80::91fe:23e9:430c:4c90/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:5d:96:04 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
4: wlp60s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 18:47:3d:31:82:dd brd ff:ff:ff:ff:ff:ff
inet 192.168.29.146/24 brd 192.168.29.255 scope global dynamic noprefixroute wlp60s0
valid_lft 40510sec preferred_lft 40510sec
inet6 2405:201:d001:8b9b:6aa1:628a:c18a:852c/64 scope global temporary dynamic
valid_lft 4186sec preferred_lft 4186sec
inet6 2405:201:d001:8b9b:9fbf:f0f:d3d4:34f5/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 4186sec preferred_lft 4186sec
inet6 fe80::8d6c:7a7c:f242:2c67/64 scope link noprefixroute
valid_lft forever preferred_lft forever
5: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:0c:f4:0a:c5 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
6: br-71e276fedf6f: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:93:94:0b:70 brd ff:ff:ff:ff:ff:ff
inet 172.19.0.1/16 brd 172.19.255.255 scope global br-71e276fedf6f
valid_lft forever preferred_lft forever
$ ifconfig -a
br-71e276fedf6f: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.19.0.1 netmask 255.255.0.0 broadcast 172.19.255.255
ether 02:42:93:94:0b:70 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:0c:f4:0a:c5 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether cc:48:3a:66:a3:b3 txqueuelen 1000 (Ethernet)
RX packets 12827 bytes 1018633 (1.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3854 bytes 679852 (679.8 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 16 memory 0xed700000-ed720000
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 31692 bytes 4654677 (4.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 31692 bytes 4654677 (4.6 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:5d:96:04 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp60s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.29.146 netmask 255.255.255.0 broadcast 192.168.29.255
inet6 fe80::8d6c:7a7c:f242:2c67 prefixlen 64 scopeid 0x20<link>
inet6 2405:201:d001:8b9b:9fbf:f0f:d3d4:34f5 prefixlen 64 scopeid 0x0<global>
inet6 2405:201:d001:8b9b:2e48:2aca:eaf7:f31b prefixlen 64 scopeid 0x0<global>
ether 18:47:3d:31:82:dd txqueuelen 1000 (Ethernet)
RX packets 7661151 bytes 11185482986 (11.1 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2146363 bytes 514484076 (514.4 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
$ arp -an
? (192.168.29.73) at 5c:e9:1e:9c:3a:b0 [ether] on wlp60s0
? (192.168.29.1) at a8:da:0c:c0:06:48 [ether] on wlp60s0
$ netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.29.1 0.0.0.0 UG 0 0 0 wlp60s0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 virbr0
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
172.19.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-71e276fedf6f
192.168.29.0 0.0.0.0 255.255.255.0 U 0 0 0 wlp60s0
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
$ ip route
default via 192.168.29.1 dev wlp60s0 proto dhcp metric 600
169.254.0.0/16 dev virbr0 scope link metric 1000 linkdown
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
172.19.0.0/16 dev br-71e276fedf6f proto kernel scope link src 172.19.0.1 linkdown
192.168.29.0/24 dev wlp60s0 proto kernel scope link src 192.168.29.146 metric 600
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown
On oip's side, the ip addr is more straightforward. Here, I have set the eth0 IP statically.
EDIT (add output of ifconfig, arp, netstat, and ip route)
$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
link/sit 0.0.0.0 brd 0.0.0.0
3: can0: <NOARP,ECHO> mtu 16 qdisc noop state DOWN group default qlen 10
link/can
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether a6:e6:68:9d:46:5f brd ff:ff:ff:ff:ff:ff
inet 192.168.0.10/24 brd 192.168.0.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::a4e6:68ff:fe9d:465f/64 scope link
valid_lft forever preferred_lft forever
$ ifconfig -a
can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
NOARP MTU:16 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:10
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:47
eth0 Link encap:Ethernet HWaddr A6:E6:68:9D:46:5F
inet addr:192.168.0.10 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::a4e6:68ff:fe9d:465f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:77 errors:0 dropped:0 overruns:0 frame:0
TX packets:692 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:17852 (17.4 KiB) TX bytes:54248 (52.9 KiB)
Interrupt:48
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:626 errors:0 dropped:0 overruns:0 frame:0
TX packets:626 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:56300 (54.9 KiB) TX bytes:56300 (54.9 KiB)
sit0 Link encap:IPv6-in-IPv4
NOARP MTU:1480 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)
$ arp -an
-sh: arp: command not found
$ netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
$ ip route
default via 192.168.0.1 dev eth0 proto static
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.10
In addition, the SSH server is running on the device, as checked via the sudo systemctl status sshd command. The end-goal is to debug why I am unable to ping or ssh to the device.
|
With 192.168.0.10/24 already set on petalinux's eth0 linked to oip's eno1, to allow communication between oip and petalinux, run this on oip (as root user, meaning it probably should be prepended by sudo ):
ip addr add 192.168.0.11/24 dev eno1
And that's it: each should now be able to reach the other using the other's IP address: 192.168.0.10 or 192.168.0.11 (both being within 192.168.0.0/24). I don't see any strange problem here, except the superfluous information (libvirt and Docker are running too).
Note: petalinux won't be reachable directly from the PC (mentioned in comment) nor can it reach "outside" through oip for at least two reasons: Ubuntu's Docker sets filter/FORWARD to DROP, and the PC probably doesn't have an adequate route to 192.168.0.0/24. But that's not part of the question.
| Unable to ping or ssh into embedded Linux device: eno1 has no IPv4 address |
1,622,818,609,000 |
I'm basically trying to read the output of the below command in my c application.
timedatectl
so basically I wanted to read the RTC time through my application so for the same reason I was trying to read the output of the above command in my application.
O is there any other way to read the time from the RTC by using
/dev/rtc0
Any help will be really appreciated!
|
If you want raw access to control /dev/rtc0 then you need to use the ioctl call after opening the file (as per manpage), e.g.
#include <errno.h>
#include <fcntl.h>
#include <linux/rtc.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <time.h>
#include <unistd.h>
int main(int argc, char** argv)
{
int rtc_fd = open("/dev/rtc0", O_RDONLY);
if (rtc_fd < 0)
{
perror("");
return EXIT_FAILURE;
}
struct rtc_time read_time;
if (ioctl(rtc_fd, RTC_RD_TIME, &read_time) < 0)
{
close(rtc_fd);
perror("");
return EXIT_FAILURE;
}
close(rtc_fd);
printf("RTC Time is: %s\n", asctime((struct tm*)&read_time));
return EXIT_SUCCESS;
}
| How to read rtc driver data (dev/rtc0) from embedded c application? |
1,622,818,609,000 |
I'm trying to send a binary packet to a local process, via netcat (nc), like this:
nc -w 1 -u localhost 10000 < my_binary_packet.bin
The output is:
read(net): Connection refused
Anyone know what's going on?
I get the same result with nc -w 1 -u 127.0.0.1 10000 < my_binary_packet.bin
|
Summary
If your listener is bound to a particular IP (such as 192.168.0.10) and port (such as 10000) instead of to IP INADDR_ANY (Internet Namespace Address Any, which means it listens to all interfaces / IP addresses), do this instead to specify the correct IP:
# with netcat
nc -w 1 -u 192.168.0.10 10000 < my_binary_packet.bin
# OR (same thing), with socat
socat udp:192.168.0.10:10000 - < my_binary_packet.bin
Details
Ok so I figured it out!
I wrote the local listener process (UDP "server/listener") I was trying to send the binary packet to (from a UDP "client/sender"), and I had bound that socket to a particular IP address, 192.168.0.10, instead of to the "catch-all" IP address INADDR_ANY. Binding to that particular IP address means that my listener process is NOT listening to localhost (127.0.0.1), so those packets were getting rejected! I didn't know that you could send a process running on the same PC some data by using anything other than localhost or 127.0.0.1, but apparently you can.
So, this works instead:
nc -w 1 -u 192.168.0.10 10000 < my_binary_packet.bin
The timeout/wait period of 1 second (-w 1), however, doesn't seem to do anything--I'm not sure why. It just sits there after it sends the packet, and I have to Ctrl + C the nc process after it sends, if I want to send it again. That doesn't really matter though--the point is: it works!
I also carefully read the comments under my question, so here's some more information for anyone wondering:
The equivalent socat command is this (don't forget the - in the command!):
socat udp:192.168.0.10:10000 - < my_binary_packet.bin
Also, here are my versions of netcat and socat on the embedded Linux board.
# nc -h
GNU netcat 0.7.1, a rewrite of the famous networking tool.
# nc -V
netcat (The GNU Netcat) 0.7.1
Copyright (C) 2002 - 2003 Giovanni Giacobbi
# socat -V
socat by Gerhard Rieger and contributors - see www.dest-unreach.org
socat version 1.7.3.4 on May 6 2022 17:55:04
Going further
How to build a binary packet in C or C++ to send via netcat or socat
Lastly, for anyone wondering, the way I wrote the binary packet my_binary_packet.bin is by simply writing some C code to write a packed struct to a file using the Linux write() command.
Writing the packet to a binary file like this allows for easy testing via netcat or socat, which is what drove me to ask the question when it didn't work.
Be sure to set file permissions while opening the file. Ex:
int file = open("my_binary_packet.bin", O_WRONLY | O_CREAT, 0644);
And here is what the struct definition looks like. The my_binary_packet.bin file literally just contains a byte-for-byte copy of this struct inside that binary packet, after I set particular, required values for each member of the struct:
struct __attribute__((__packed__)) my_packet {
bool flag1;
bool flag2;
bool flag3;
};
Full code to open the file, create the packet, and write the binary packet to a file might look like this:
typedef struct __attribute__((__packed__)) my_packet_s {
bool flag1;
bool flag2;
bool flag3;
} my_packet_t;
int file = open("my_binary_packet.bin", O_WRONLY | O_CREAT, 0644);
if (file == -1)
{
printf("Failed to open. errno = %i: %s\n", errno, strerror(errno));
return;
}
my_packet_t my_packet =
{
.flag1 = true,
.flag2 = true,
.flag3 = true,
};
ssize_t num_bytes_written = write(file, &my_packet, sizeof(my_packet));
if (num_bytes_written == -1)
{
printf("Failed to write. errno = %i: %s\n", errno, strerror(errno));
return;
}
int retcode = close(file);
if (retcode == -1)
{
printf("Failed to close. errno = %i: %s\n", errno, strerror(errno));
return;
}
For anyone who wants to learn how to program Berkeley sockets in C or C++...
I wrote this really thorough demo in my eRCaGuy_hello_world repo. This server code is what my UDP listener process is based on:
socket__geeksforgeeks_udp_server_GS_edit_GREAT.c
socket__geeksforgeeks_udp_client_GS_edit_GREAT.c
References
The comments under my question.
There are many versions of netcat: Netcat - How to listen on a TCP port using IPv6 address?
This answer, and my comment here: Error receiving in UDP: Connection refused
See also
My answer on General netcat (nc) usage instructions, including setting the IP address to bind to when receiving, or to send to when sending
| "Connection refused" when I try to send a UDP packet with netcat on an embedded-linux board |
1,622,818,609,000 |
I'm developing an embedded board (Tinkerboard) based on Linux Linaro (Debian) OS 9.3.
The board is basically a (webpage) kiosk where the browser is run by a sh script included the automatic scripts on startup. The kiosk needs to play a couple of mp3 files triggered by js events.
Most of the times the audio is not reproduced: if i manually run the browser the audio is always ok.
So far, I found that the chromium process is run before pulseaudio process (based on PIDs values) so i supposed the browser does not 'connect' the audio process cause missing.
I modified the script something like:
# Script.sh
pulseaudio
sleep 4s
chromium -kiosk ....
In this way the audio is ok but I don't like it.. first of all because I'm not sure the cause of the problem.
Is there a way to put in the right sequence the processes?
Any other reasons about the audio problem?
|
This seems exactly the kind of problem a sensible init system solves:
Starting services and programs in the right order, and exactly when the things they depend on are ready; not earlier, and not a fixed 4s seconds later than the last start, "just to make sure".
On Debian 9, you'd use a systemd service to initiate the user session that runs wayland or Xorg, on which you then start and show the chromium.
Instead of manually starting processes one after the other without actually checking whether they've started:
You'd simply define a chromium-kiosk.service user service, which depends on pulseaudio.service; starting that will wait until the pulseaudio service has started. How to do that is explained in many places, e.g. here.
Other advantages of doing that include automatic restarting of chromium if it ever crashes, logging of failures to start, ability to make the chromium process itself a requirement for other services. Most importantly, you can actually say "hey, for a full boot you need to start chromium", and your system will make sure everything necessary for that will boot.
| How to wait for pulseaudio before running chromium? |
1,622,818,609,000 |
How can I customize systemd source code? When I do bitbake, systemd appears in my end project, but I cannot find any source files of it in my local directories. I want to track down unit files lifecycle, log_debug(...) and log_info(...)s are not showing up (some of the messages appear, but gives not enough info for me) in journalctl in my embedded project. Does Yocto pulls systemd source files, compiles and then deletes them, if so how can I prevent deletion, customize code and then recompile?
|
Besides adding recipe name to the RM_WORK_EXCLUDE += "systemd" in local.conf, one should clean shared state using one of the cleaning options provided by Yocto, for example $ bitbake -c cleansstate recipe before bitbaking again, otherwise, with an unflushed shared state cache it will start from the current state, not from the beginning. More information on cleaning state and much more is on the yoctoproject website.
| How Yocto embeds systemd in end project? |
1,622,818,609,000 |
I have a wokring image file for an ARM embedded Linux system.
The rootfs partition is way too big and I want to shrink it.
Initial scenario:
Disk /dev/loop0: 7,22 GiB, 7744782336 bytes, 15126528 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/loop0p1 * 2048 206847 204800 100M c W95 FAT32 (LBA)
/dev/loop0p2 206848 12789759 12582912 1G 83 Linux
/dev/loop0p3 12789760 12810239 20480 10M a2 unknown
The second partition (rootfs) is the one to be reduced.
I opened /dev/loop0 with gparted and reduced it to 1G.
Then I tried to move the third partition (I don't know that it is nor what contains) just after the previous - otherwise it makes non sense at all!
But gparted told me that moving this partition might prevent the os to boot.
As far as I know, only the "boot" partitions (i.e. the first ones) are critical for boot itself.
Why moving the third one might prevent the boot?
|
This is probably because the partition type is a2.
A2 Hard Processor System (HPS) ARM preloader
This partition type is used for bootable images of ARM-type computers.
For a normal Linux system that uses an x86, you should be able to delete this partition.
----edit----
Because this is ARM, it is the preloader image. It is a number of 64K blocks used as first stage boot loader. Whether or not you can move it, depends a bit on your board. Some boards use the partition table to find a type 42 image partition.
The preloader is used as an intermediate step between the bootrom and the boot loader, so it runs before Linux is booted.
| Moving the third partition might prevent the boot of os |
1,622,818,609,000 |
So I recently acquired Ingenic SoC based RS-97 game, which runs MIPS instruction set. The vendor vaguely provided instruction on how to compile the linux kernel for the target SoC. So based on vendor instructions and online search the following are needed to have an image of the embedded linux for the platform.
Compile the toolchain (mipsel for mips based architecture)
Compile the linux kernel with given drivers/BSP using the toolchain
Compile the root file system - Busybox suggested (dont know why)
Compile uBoot for target SoC
Partition the storage such as sd with target specific partition table
Flash the whole image into sd
So the questions are, why root file system is separate from kernel image?
What role does busybox play in generating file system? Also if the linux image is compiled without root file system how to merge the two to have drivers in /sys directory in the root file system?
|
These are very big questions, I'll try to summarize as simply as I can.
why root file system is separate from kernel image?
The kernel image is an executable provided by kernel.org (you can modify it if you want but most people don't) which provides the framework for your embedded Linux project.
The root file system is where YOUR code and configuration goes: the kernel loads the root file system.
What role does busybox play in generating file system?
Busybox is an application that provides lots of useful functions such as a command line interface, listing files, listing processes, copying files etc. The function of Busybox changes according to how it is named: you rename the application and it performs a different function. This is a very efficient way of packing a lot of utilities into a small file system.
Also if the linux image is compiled without root file system how to merge the two to have drivers in /sys directory in the root file system
There are parameters you can give to the kernel to tell it where to find its root file system. You want to set the root parameter. See The kernel’s command-line parameters.
| From Compiling Embedded Linux Kernel to Generating Image for Target Platform |
1,622,818,609,000 |
I am trying to boot the kernel with the nfs root file system. I am suspecting that some memory issue is there. I have a kernel version 4.12.28. This version has a lot of cache changes. I am suspecting that the kernel memory is not initialized properly. This build is using Yocto Sumo with DTC version 4.7. This is a power pc 32 bits architecture. I have shared the .config file here. I am unsure on what is the problem and where to look up.
I have enabled QUOTA, which I think wasn't useful. This system has 512 MB RAM. So, I am not suspecting that it is running out of Memory. Is the dcache_bsize and icache_bsize is sufficient? Is there any thing obvious that I am missing here.
Here is the log -
*## Booting kernel from Legacy Image at f8100000 ...
Image Name: Linux-4.12.28
Created: 2019-07-22 7:01:05 UTC
Image Type: PowerPC Linux Kernel Image (gzip compressed)
Data Size: 3683596 Bytes = 3.5 MiB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
## Flattened Device Tree blob at f8000000
Booting using the fdt blob at 0xf8000000
Uncompressing Kernel Image ... OK
Loading Device Tree to 007fb000, end 007ff8e8 ... OK
Linux version 4.12.28 (oe-user@oe-host) (gcc version 7.3.0 (GCC) ) #1 Mon Jul 22 00:42:12 UTC 2019
Using MPC837x RDB/WLAN machine description
bootconsole [udbg0] enabled
-----------------------------------------------------
Hash_size = 0x0
phys_mem_size = 0x20000000
dcache_bsize = 0x20
icache_bsize = 0x20
cpu_features = 0x0000000000020460
possible = 0x0000000005a6fd77
always = 0x0000000000020000
cpu_user_features = 0x8c000000 0x00000000
mmu_features = 0x00210000
-----------------------------------------------------
mpc83xx_setup_arch()
Zone ranges:
DMA [mem 0x0000000000000000-0x000000001fffffff]
Normal empty
Movable zone start for each node
Early memory node ranges
node 0: [mem 0x0000000000000000-0x000000001fffffff]
Initmem setup node 0 [mem 0x0000000000000000-0x000000001fffffff]
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 130048
Kernel command line: console=ttyS1,115200 root=/dev/nfs rw ip=dhcp nfsroot=11.12.98.2:/home/sh/server_rootfs
PID hash table entries: 2048 (order: 1, 8192 bytes)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 512064K/524288K available (5852K kernel code, 248K rwdata, 1200K rodata, 172K init, 166K bss, 12224K reserved, 0K cma-reserved)
Kernel virtual memory layout:
* 0xfffdf000..0xfffff000 : fixmap
* 0xfdffd000..0xfe000000 : early ioremap
* 0xe1000000..0xfdffd000 : vmalloc & ioremap
NR_IRQS:512 nr_irqs:512 16
IPIC (128 IRQ sources) at e1000700
clocksource: timebase: mask: 0xffffffffffffffff max_cycles: 0x12049cd416, max_idle_ns: 440795202745 ns
clocksource: timebase mult[ccccccd] shift[24] registered
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
Oops: Exception in kernel mode, sig: 4 [#1]
MPC837x RDB/WLAN
Modules linked in:
CPU: 0 PID: 0 Comm: swapper Not tainted 4.12.28-sira-standard #1
task: c06772f0 task.stack: c06a6000
NIP: c01000fc LR: c013f414 CTR: 00000005
REGS: c06a7ce0 TRAP: 0700 Not tainted (4.12.28-sira-standard)
MSR: 00089032 <EE,ME,IR,DR,RI>
CR: 24028244 XER: 20000000
GPR00: c013f2e8 c06a7d90 c06772f0 df004e98 00000008 00000001 00000006 00000008
GPR08: 00000000 00000000 00000000 007a1200 84028242 00040000 00000000 00000001
GPR16: 00800300 df416a60 1ffbf05c df414e80 c067c480 ffffffff 00000001 00000000
GPR24: c06c0000 00000000 df416c10 00000000 c013f440 00400000 c0683ba8 df004e98
NIP [c01000fc] set_nlink+0x0/0x58
LR [c013f414] proc_get_inode+0x164/0x190
Call Trace:
[c06a7d90] [c013f2e8] proc_get_inode+0x38/0x190 (unreliable)
[c06a7db0] [c013f4e0] proc_fill_super+0xa0/0x124
[c06a7dd0] [c00e5914] mount_ns+0xa8/0x184
[c06a7e00] [c00e6728] mount_fs+0x24/0xb4
[c06a7e20] [c010581c] vfs_kern_mount.part.8+0x5c/0x158
[c06a7e50] [c0105950] kern_mount_data+0x24/0x50
[c06a7e60] [c013f960] pid_ns_prepare_proc+0x28/0x50
[c06a7e80] [c003e284] alloc_pid+0x4d4/0x4f8
[c06a7ee0] [c0022500] copy_process.isra.7.part.8+0x914/0x12a4
[c06a7f60] [c0023328] _do_fork+0xbc/0x300
[c06a7fa0] [c000409c] rest_init+0x24/0x78
[c06a7fb0] [c06499a0] start_kernel+0x304/0x330
[c06a7ff0] [00003438] 0x3438
Instruction dump:
5cec9cb4 15d573b4 01320182 c865c007 4700e2e1 9303fa22 2f6abc88 24d19205
925583f0 7e007927 f2207002 52600025 <116b5917> 21758908 ac204100 002054e1
---[ end trace 0000000000000000 ]---
Kernel panic - not syncing: Attempted to kill the idle task!
Rebooting in 180 seconds..
I want this to mount nfs root file system and run the /sbin/init successfully.*
Here is the def config.
[https://docs.google.com/document/d/11XpGHxtEhP9DezyNPYiPqIuPhIpa7y0zF_o4Pl6QkZQ/edit?usp=sharing][kernel config]
|
That looks like the kernel is getting an illegal instruction exception (700 is a Program exception - which can be a number of things, but sig: 4 is SIGILL).
There are a number of unimplemented instructions in the e300 core - double check the compiler you are using to build the kernel is correct and using the right command line options and that the correct cpu options are selected in .config (they look ok to me, but I don't know the chip).
Reading this might help (just a random article I found) and check out Appendix B of the e300coreRM.pdf.
[id]cache_bsize are the cache block (aka line) sizes for instruction and data caches - 0x20 (32 bytes) seems like a reasonable value for that sort of processor.
| Power PC TRAP - 0700 - Kernel Memory Issue? |
1,622,818,609,000 |
I wonder how design permissions in root file system should look for embedded device, with busybox onboard (buildroot environment). Several ordinary users may login to the system using ssh.
My initial concept is to remove all permissions, except x, of group (root group will be accessible by admin) and others for /etc, /usr folders, /root (in this case even x will not be set). /bin folder would be set to 755, however I'm affraid of busybox binary, since it has set-uid bit turned on.
After blocking all these resources I think of explicit setting ACL-s for particular files.
For now my open points is:
Which system resources should be accessible by ordinary users - i'm pretty sure about the /bin folder. But what about other folders like /usr, /var etc.
What should I consider regarding /bin/sh -> (-rwsr-xr-x) /bin/busybox backdoor. How to block ability of running (set-uid) shell by ordinary user (I'm not sure but probably effective uid is abandoned inside busybox)
What about /lib folder, should I explicitly define ACL for libraries used by ordinary users? Or there is simpler solution.
Should I limit permissions for sysfs and procfs, or it will break down whole system?
I will be grateful for any hints.
|
It sounds like you already know enough to choose a permission design for /home/user1, or equivalent. You're asking about the rest of the system. There are already a few discussions here, at least on a related topic:
Limit a user to his own home directory
Allow user to connect using SSH or SFTP but limit to home dir (Centos7)
How to access to specified folder via SSH/SFTP?
remove all permissions, except x, of group and others for /etc, /usr folders. But what about other folders like /usr, /var etc
Looking at the Unix DAC permissions on system directories, and making them more restrictive than the provided defaults, is not a common tactic. (With the exception of permissions on user's home directories. There is usually a configuration setting for this). The only way to answer a question as broad as -
how design permissions in root file system should look
- is that you should use the standard DAC permissions for system directories. You chould check against your favourite Linux distribution if you like. You could also look at the FHS, although that may lack a few recent updates.
Getting into buildroot specifically might make it more feasible to change them. But that does not mean you that you "should"!
I would like to have safe root group (no extra privileges), since it may be accessed with usermod -aG root someone by admin.
Not recommended. You cannot allow unrestricted useradd, because of useradd -u 0, so you need wrapper scripts or something anyway. (E.g. set sudoers to allow admin to run the wrapper script as root). Better e.g. provide a wrapper script for usermod as well, and do your protection in the script. Then you can prevent attacking other non-root "system" groups (daemon accounts) as well.
"ordinary users" (beside www-data) may login using ssh.
It looks like you're trying to run a secure multi-user Unix-like system. That's the most important part of the question.
That general problem is too broad, to ask here and get a definitive answer.
If the users are completely untrustworthy, the honest answer is that you cannot. There are various tradeoffs, strategies and tactics.
The question is really not specific to "embedded device, with busybox onboard (buildroot environment)". Except that this might narrow down which tactics are easily available to you.
Specifically, note that using buildroot is going to make it a lot more work to implement security updates, compared to standard binary distributions like Debian Linux.
Out of the possible free software distributions you could look at, I am very sceptical that buildroot is aiming for highly secured multi-user Linux systems :-). (Either multi-user network servers, used in universities and some similar environments, or multi-user PCs).
Most large organizations have similar problems with internal multi-user systems. But the simplest approach they use is to not run any one large multi-user Unix (or Windows :-) instance, that users can actually run programs on!
The common case like this is actually where you have desktop PCs that can be used by different workers ("hot-desking", or just multiple shifts). Some of the common controls here are key parts of Microsoft' business model ("Group Policy") or the wider Windows ecosystem, and some are not available as free software equivalents.
One of the most powerful controls is "application whitelisting". Providing the user with a full programming / scripting environment, like the Unix shell, is a relatively high risk. It is often not needed. (And systems can absolutely be engineered to deny access to them).
I'm afraid of busybox binary, since it has set-uid bit turned on
A few of the busybox applets are standard commands that can require setuid root to work as expected. This is designed to be secure, and officially supported.
config FEATURE_SUID
bool "Drop SUID state for most applets"
default y
help
With this option you can install the busybox binary belonging
to root with the suid bit set, enabling some applets to perform
root-level operations even when run by ordinary users
(for example, mounting of user mounts in fstab needs this).
With this option enabled, busybox drops privileges for applets
that don't need root access, before entering their main() function.
If you are really paranoid and don't want even initial busybox code
to run under root for every applet, build two busybox binaries with
different applets in them (and the appropriate symlinks pointing
to each binary), and only set the suid bit on the one that needs it.
Some applets which require root rights (need suid bit on the binary
or to be run by root) and will refuse to execute otherwise:
crontab, login, passwd, su, vlock, wall.
The applets which will use root rights if they have them
(via suid bit, or because run by root), but would try to work
without root right nevertheless:
findfs, ping[6], traceroute[6], mount.
Note that if you DO NOT select this option, but DO make busybox
suid root, ALL applets will run under root, which is a huge
security hole (think "cp /some/file /etc/passwd").
| Rootfs permissions design |
1,622,818,609,000 |
I am building a customized kernel for RPi. The problem is that the RPi bootloader requires a vfat /boot partition whereas I intend to minimize the kernel size, so need to remove vfat support from kernel.
I have read Embedded Linux Primer and Linux Kernel Development books. From what I understood, it seems that /boot partition is used by bootloader to look for kernel and initramfs, among some other important files
I tried removing vfat support from the kernel while keeping /boot formatted as vfat. The kernel booted just fine. However, systemd stuck somewhere saying that it failed to mount /boot, whoch is perfectly fine since the kernel doesnt support vfat. Systemd then gave me a rescue shell.
I was wondering that since the RPi bootloader already supports vfat, and is able to load kernel without any issue, is there any way I can ask systemd not to mount /boot at all? As per my understanding, since the kernel is already loaded by this stage, the kernel doesnt need access to the /boot partition.
Any help will be appreciated.
|
systemd will try to mount the filesystems you have listed in /etc/fstab, so if you remove /boot from /etc/fstab it shouldn't try to mount it.
(I just tested this on a Fedora system, removed it from /etc/fstab and confirmed it wasn't mounted.)
systemd does have some code to treat EFI partitions specially, so maybe that's what you have on the RPi and that's what is triggering the mount... But that is typically implemented using an auto-mount unit, in other words, it will try to mount it only if someone looks inside /boot.
The logic to mount from /etc/fstab is implemented by systemd-fstab-generator and the logic to mount the EFI partition is implemented by systemd-gpt-auto-generator.
Another useful command is systemctl status /boot (when you have it mounted with the kernel that supports vfat), which can give you more hints on where it's coming from.
| Build kernel without support for /boot's file system |
1,622,818,609,000 |
I have an embedded system with 3 operating systems (self-created Debian 9.4 with 4.14.40-rt Kernel). Each operating system is on a different partition. A bootchooser sets up the system so that when one operating system does not start, the next one is started. Furthermore, this Bootchooser can also provide these 3 partitions with an update. The Debian systems uses systemd for initialization.
This works so well. However, I now have the problem that the 3 operating systems contain a different /etc directory. However, these should be synchronized and not overwritten when updating the system.
How do you do that right?
My idea was to copy the data from /etc to another partition and linking to it does not work properly. Because /etc/fstab only lazily reads the additional partition.
|
Welcome to the Unix & Linux StackExchange.
systemd does not support /etc/ on a separate partition.
Your next best option would to be sync key files between the 3 operating systems.
You might follow the pattern of etcd and have a central repo that all 3 OSes sync from. You'll have some bootstrapping problems to deal with, for example setting up the networking connection to connect to a site to pull down details of how to setup the network connection...
Your time may be better spent working on updating your design so you only need one embedded operating system on the device.
| Get same /etc in different Operation Systems |
1,622,818,609,000 |
There's plenty of barebone PCs/servers optimized for building custom Linux/BSD based routers, VPN servers or firewalls and in general various L3 devices. However I couldn't really find anything about L2 devices with hardware switch ASICs. While I know it's possible to just use bridging it's not really practical solution.
Are there available some devices with built-in hardware switch chips that are optimized for running Linux distros like pfSense or WRT derivatives using switchdev driver to build managed switch?
|
Try the term whitebox switches for your searches. There are some vendors/distributions in that area.
| Are there any network switch platforms for Linux/BSD? [closed] |
1,622,818,609,000 |
I am running u-boot on a Beaglebone Black custom install, and have modified ./include/configs/am335x_evm.h to set the default bootdelay to 0, which was working well when I was loading my kernel and device tree off of a fat partition. But I switched partition 1 from fat to ext4, and change the fatload statements in my uEnv.txt to ext4load. Everything works just as before, except now I'm back to having a 2 second bootdelay. I don't understand why switching partition types would cause this.
Does anybody know how I can recompile u-boot to set bootdelay back to 0 in the case of me using ext4 boot partition?
Alternatively, I suppose I could figure out how to get saveenv working. Currently it gives:
=> saveenv
Saving Environment to FAT... MMC: no card present
** Bad device mmc 0 **
Failed (1)
But honestly I'd rather just change the default at compile time.
|
Download the ARM cross-compiler GCC on your PC.
wget -c https://releases.linaro.org/components/toolchain/binaries/6.4-2017.11/arm-linux-gnueabihf/gcc-linaro-6.4.1-2017.11-x86_64_arm-linux-gnueabihf.tar.xz
tar xf gcc-linaro-6.4.1-2017.11-x86_64_arm-linux-gnueabihf.tar.xz
export CC=**/path to**/gcc-linaro-6.4.1-2017.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
Make sure you have the correct path.It should be from the root, something like this /home/username/path to gcc-linaro/bin/arm-linux-gnueabihf-
Test Cross Compiler:
${CC}gcc --version
You should see this on your terminal if you have the correct path:
arm-linux-gnueabihf-gcc (Linaro GCC 6.4-2017.11) 6.4.1 20171012
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Download u-boot
git clone https://github.com/u-boot/u-boot
cd u-boot/
git checkout v2018.01 -b tmp
Get the patches (Needs internet connection)
wget -c https://rcn-ee.com/repos/git/u-boot-patches/v2018.01/0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch
wget -c https://rcn-ee.com/repos/git/u-boot-patches/v2018.01/0002-U-Boot-BeagleBone-Cape-Manager.patch
wget -c https://raw.githubusercontent.com/RobertCNelson/Bootloader-Builder/master/patches/v2018.03-rc1/0002-NFM-Production-eeprom-assume-device-is-BeagleBone-Bl.patch
Apply patches to u-boot
patch -p1 < 0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch
patch -p1 < 0002-U-Boot-BeagleBone-Cape-Manager.patch
patch -p1 < 0002-NFM-Production-eeprom-assume-device-is-BeagleBone-Bl.patch
Configure and Build
make ARCH=arm CROSS_COMPILE=${CC} distclean
make ARCH=arm CROSS_COMPILE=${CC} am335x_evm_defconfig
Now in the u-boot folder there will be .config file you can edit and change the bootdelay parameter.
Build
make ARCH=arm CROSS_COMPILE=${CC}
Attach the SD card to the computer and run ‘lsblk’ to find out the id of the SD card. In my case the id was ‘sdb’
Install:
export DISK=/dev/sdb
sudo dd if=./MLO of=${DISK} count=1 seek=1 bs=128k
sudo dd if=./u-boot.img of=${DISK} count=2 seek=1 bs=384k
| u-boot bootdelay=2 when booting ext4, and bootdelay=0 when booting fat |
1,622,818,609,000 |
I am trying to port a software on aarch64 Linux. One of the requirements of the software is perl-Net-IP library package. When I try to search for the source code of perl-Net-IP package, I get Net-IP package. Are they both same?
|
Net::IP is a Perl distribution, that you can find on MetaCPAN, you have a link in the left toolbar to download it.
When it is packaged by some Linux distribution, the name of the distribution package can be perl-Net-IP or libperl-net-ip or other variations. Hence it depends on the Linux distribution you are using the find the appropriate system package for a given Perl distribution. And you can see documentation refering you to it, based on the target system for the documentation you are reading.
In short, if you just need the Perl module as a dependency and are doing everything by hand, just grab the archive file on MetaCPAN and install it normally.
If not, you will need to provide more context.
| Is perl-Net-IP package same as Net-IP package? |
1,622,818,609,000 |
I'm currently trying to boot an Atmel Sama5d2 Xplained evaluation board from NFS server.
I'm running a Debian 9 with 4.9.0 kernel version and the nfs server is nfs-kernel-server.
Here is the NFS server configuration
/srv/tftp/xplained/rootfs *(rw,nohide,no_subtree_check,async,no_root_squash)
My NFS server succesfully exports my folders because I'm able to mount them through network on another linux.
I'm also able to retrieve both kernel image and dtb file from my tftp server.
However when the kernel starts, it's unable to boot from the exported rootfs and returns the following error
VFS: Unable to mount root fs via NFS, trying floppy.
List of all partitions:
0100 8192 ram0 (driver?)
0101 8192 ram1 (driver?)
0102 8192 ram2 (driver?)
0103 8192 ram3 (driver?)
b300 3833856 mmcblk0 driver: mmcblk
b301 112172 mmcblk0p1 00000000-01
b302 3721550 mmcblk0p2 00000000-02
b318 128 mmcblk0rpmb (driver?)
b310 1024 mmcblk0boot1 (driver?)
b308 1024 mmcblk0boot0 (driver?)
No filesystem could mount root, tried: nfs
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
Here are my kernel arguments
ip=dhcp console=ttyS0,115200 earlyprintk root=/dev/nfs rootfstype=nfs rw nfsroot=<server_ip>:/srv/tftp/xplained/rootfs
And dmesg about nfs-moutd service
oct. 09 18:10:13 PC325 rpc.mountd[566]: authenticated mount request from 192.168.128.158:788 for /srv/tftp/xplained/rootfs (/srv/tftp/xplained/rootfs)
oct. 09 18:10:18 PC325 rpc.mountd[566]: authenticated mount request from 192.168.128.158:704 for /srv/tftp/xplained/rootfs (/srv/tftp/xplained/rootfs)
oct. 09 18:10:28 PC325 rpc.mountd[566]: authenticated mount request from 192.168.128.158:796 for /srv/tftp/xplained/rootfs (/srv/tftp/xplained/rootfs)
oct. 09 18:10:48 PC325 rpc.mountd[566]: authenticated mount request from 192.168.128.158:762 for /srv/tftp/xplained/rootfs (/srv/tftp/xplained/rootfs)
I tried many things I found on the internet like checking firewall rules, locked ports etc... and it still don't works. The strangest thing is that I tried from a Ubuntu machine with the same packets and it worked.
I also tried from a fresh Debian install and it also worked.
I would like to understand why it's not working on my development computer. A possibly how to fix it
|
Thanks to @alanSchmitz and after some investigations, I finaly found where the problem came from.
Apparently I have to force the use of NFS v3 inside uboot by specifying it on kernel boot arguments as follow root=/dev/nfs rootfstype=nfs rw nfsroot=<server_ip>:/srv/tftp/xplained/rootfs,vers=3
I have tried to fix this on server side but I could not find how to force the use of NFS v3.
I'll update my answer if I found how to force the use of NFS v3 on server side for mounting shares.
| NFS boot fail on Atmel Sama5d2 xplained |
1,622,818,609,000 |
I am trying to bootstrap and configure an embedded system. I need to enable certain systemd services (e.g. networkd, resolved).
I'm working on an x86* machine while the one that I'm configuring is an ARM machine - so I (presumably) need to use the host's systemd to edit the systemd configuration stored in the ARM's file system.
How would I do the equivalent actions which these do on the x86 host, in the offline ARM system which I have mounted?
systemctl enable foo.service
systemctl disable foo.service
Presumably netctl enable <name> is still doable as systemctl enable netctl@<name>.
|
Just create the symlinks that systemctl enable would create. There's not more to it then that.
| Configure systemd in mounted root (i.e. offline) |
1,622,818,609,000 |
I use u-boot 2014.07 from denx git repository in our board. This u-boot gives me after compilation two files : u-boot.bin and MLO. MLO is first bootloader. I put both on sdcard first partition formated as FAT32.
When my board - chiliboard from grinn company - boots, SPL runs and writes 'C' many times with 1s delay. I can interrupt this process by pressing a key(sending a character on debug serial console). SPL starts booting uboot when i interrupt this process or after about 10s of waiting.
How to disable this 10s waiting time? I want to load u-boot immediately.
|
I've found an answer here -> https://e2e.ti.com/support/arm/sitara_arm/f/791/t/471656
Problem was wrong SYSBOOT settings. ROM was waiting for SPL to be sent via the serial port and producing the 'C's as part of the X-MODEM protocol.
| Disable waiting and writing 'C' in u-boot SPL? - am335x, u-boot v2014.07 |
1,622,818,609,000 |
Information about mtd partitions can be passed to the kernel via the kernel command line (mtdparts parameter) or via the device tree.
Is it possible to override this after the kernel has booted?
|
No.
del_mtd_parttions is called only during cleanup. There is no path where it is called prior to re-adding different partitions.
| Override mtdparts after kernel has booted |
1,622,818,609,000 |
A router runs firmware containing BusyBox and in addition to flash memory the device has secondary memory storage. That USB stick is mounted at both /media/Main and /opt:
# mount | grep sda
/dev/sda1 on /media/Main type ext4 (rw,noatime,data=ordered)
/dev/sda1 on /opt type ext4 (rw,noatime,data=ordered)
Duplicates in locate database
The issue is that locate updatedb indexes both /media and /opt. I wish to permanently remove these duplicates from /opt/var/locatedb without changing drive mounting. I do wish to use the updatedb command without adding options to that command from both cron and shell. An alias might be an option. Though my first search for "locate database exclude" did return a blog post that suggest to use an “/etc/updatedb.conf” for Arch Linux.
updatedb.conf
First try was to create a file /opt/etc/updatedb.conf containing:
# directories to execlude from the locate database
PRUNEPATHS="/media /mnt /tmp /var/tmp /var/cache /var/lock /var/run /var/spool"
export PRUNEPATHS
# filesystems to exclude from the locate database:
PRUNEFS="afs auto autofs binfmt_misc cifs coda configfs cramfs debugfs devpts devtmpfs ftpfs iso9660 mqueue ncpfs
nfs nfs4 proc ramfs securityfs shfs smbfs sshfs sysfs tmpfs udf usbfs vboxsf"
export PRUNEFS
That is not enough to let updatedb use the desired configuration. Next was reading GNU locate documentation. GNU updatedb documentation states:
Typically, operating systems have a shell script that “exports”
configurations for variable definitions and uses another shell script
that “sources” the configuration file into the environment and then
executes updatedb in the environment.
Does my embedded Linux export and source configuration variables?
This embedded Linux operating system might have the GNU suggested shell scripts that export configuration variables and also sources them back into the environment.
How can I verify that this OS exports and sources?
And when the OS doesn't, how to correctly export and source configuration variables here?
Environment
GNU locate was installed via opkg on this external storage medium
BusyBox v1.24.1 according to /bin/sh --version
locate (GNU findutils) 4.6.0
shell is -sh according to echo $0
/opt/home/admin/.ash_history exists
$ cat /opt/etc/profile
#!/bin/sh
export PATH='/opt/usr/sbin:/opt/sbin:/opt/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin'
export TMP='/opt/tmp'
export TEMP='/opt/tmp'
# This is for interactive sessions only
if [ "$PS1" ] ; then
export TERM=xterm
[ -d /opt/share/terminfo ] && export TERMINFO='/opt/share/terminfo'
export LANG='en_US.UTF-8'
export LC_ALL='en_US.UTF-8'
fi
export TERMINFO=/opt/share/terminfo
|
Where to export
After having read https://bitbucket.org/padavan/rt-n56u/wiki/EN/UsingCron a good way to export configuration variables for both crontab and shell usage, is to insert the /opt related variables into /opt/etc/profile.
Where and how to source
To use ("source") the variables in cron it is suggested to:
create a shell-wrapper script
source /etc/profile in that wrapper scriptnote: /etc/profile will also source /opt/etc/profile
call that wrapper script by prepending the crontab configuration content with the line: SHELL=/etc/storage/cron/shell-wrapper.sh
| How to “export” configuration variables and "source" them on embedded Linux? |
1,622,818,609,000 |
I am working with a board and when it finishes the boot, it gives us login as root user. What I want to do is to login as user or root based my requirement. Mean when the board boots up i should get a prompt which allows me to login as either root or login as user.
How can i go about this.
# Startup the system
null::sysinit:/bin/mount -o remount,rw /
null::sysinit:/bin/mount -t proc proc /proc
null::sysinit:/bin/mkdir /mnt/jffs2
null::sysinit:/bin/sh /scripts/mtd_mknod
null::sysinit:/bin/sh /scripts/mount_data_partition
null::sysinit:/bin/mount -a
null::sysinit:/bin/echo "/sbin/hotplug" > /sys/kernel/uevent_helper
# now run init.non-volatile.rcS script
::sysinit:/etc/init.d/init.non-volatile.rcS
null::sysinit:/bin/hostname -F /etc/hostname
null::sysinit:/sbin/ifconfig lo 127.0.0.1 up
null::sysinit:/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
# Ruby inbuilt kernel profiler
null::sysinit:/bin/mknod /dev/profiler c 10 149
# now run any rc scripts
::sysinit:/etc/init.d/rcS
# Ruby patch - run a shell on the serial console
console::respawn:/bin/sh -l
# Logging junk
null::sysinit:/bin/touch /var/log/messages
null::respawn:/sbin/syslogd -n -i eth1_0 -L -m 0
null::respawn:/sbin/klogd -n
#tty3::respawn:/usr/bin/tail -f /var/log/messages
|
Make sure your user and root have passwords; as root, run:
passwd user
passwd
(replacing user as appropriate). Once you've done that, you can replace
console::respawn:/bin/sh -l
which starts a shell directly, with
console::respawn:/bin/login
if you have /bin/login on your system.
Traditionally you'd use getty to manage the serial connection completely, something like
console::respawn:/sbin/getty 38400 console
(I'm not sure those are the appropriate options for your setup.)
Before you embark on all this, make sure you have a way of restoring the old way of starting a shell, or logging in over the network, to avoid locking yourself out of the system if something goes wrong...
| Enable user login, there by login can happen either as root or user based on requirement |
1,394,917,817,000 |
Im trying to create IP over GRE tunnel but i get No such device:
ip tunnel add gre0 mode gre remote 192.168.152.22 local 192.168.152.21 ttl 255
ioctl: No such device
I have compiled GRE support in my kernel:
CONFIG_NET_IPGRE_DEMUX=y
CONFIG_NET_IPGRE=y
CONFIG_NET_IPGRE_BROADCAST=y
There is not gre0 interface when interfaces are displayed via ifconfig -a where i see all available network interfaces (also those not upped yet).
My kernel version is 2.6.30.9 and iproute2 version is 2-2.6.33.
ip tunnel show displays:
ip tunnel show
ioctl: Invalid argument
tunl0: ip/ip remote any local any ttl inherit nopmtudisc
sit0: ipv6/ip remote any local any ttl 64 nopmtudisc 6rd-prefix 2002::/16
|
The problem was GRE demultiplexer module required by ip_gre. When kernel loads GRE demultiplexer driver registers protocol 47 handle so when ip_gre.c attempted to do the same it fails because it has been registered before. It is solved by modifying ip_gre.c to not register protocol GRE handle.
| GRE supported in kernel but iproute2 cant create GRE tunnel |
1,394,917,817,000 |
On my embedded device, I have this error showing up after kernel boot:
init.exe: Caught segmentation fault, core dumped
But I cannot understand why is this happening? If I do battery cut( i.e. reboot my device foricbly) then the device boots and comes up fine.
Any pointers will be extremely helpful. Is this some transient low level memory issue?
It is linux 2.6.31 on Arm architecture.
|
The output mentions it dumped core. Try doing:
gdb -c [corefile]
Then at the (gdb) prompt, do:
(gdb) bt
To get a backtrace. If the binary was not stripped, you might be in luck and at least have something to google for :-)
PS: The core file might be core.PID, where PID was the PID of init.exe when it died.
sc.
| init.exe: Caught segmentation fault, core dumped - what is the source of this error |
1,394,917,817,000 |
I am trying to create Linux input device driver and to test things I took at existing gpio-matrix-keypad driver. Using print I know that input_report_key() is called with correct keycode, but it doesn't put a correct character under the cursor.
pr_info("Print: %d\n", keycodes[code]);
input_report_key(input_dev, keycodes[code], new_state[col] & (1 << row));
Also I work with BeagleBone Black using minicom. It seems that kernel is built with required for input options enabled, e.g. CONFIG_INPUT and CONFIG_INPUT_KEYBOARD.
|
As we've discussed, the expected keys are inserted to the input subsystem correctly. They aren't getting to you via your serial connection and that's actually what should happen.
See, when you use serial connection, input and output for /dev/console come from /dev/ttyS* instead from a keyboard and a screen. This means the keyboard is not connected to the console or to the serial connection, so keys inserted via the keyboard will not get to you via serial.
However, all input from keyboards in the system get via the kbd input handler (see kbd_handler in drivers/tty/vt/keyboard.c) into vt. vt stands for 'virtual terminal' and it maintains several terminal sessions under the same screen+keyboard setup. These are the terminals you can switch to using ctrl+alt+f* on ubuntu, and these are the terminals under /dev/tty*
The same setup can be simulated by using qemu in -nographic mode. Then simulating keyboard input with sendkey in qemu's monitor, and seeing the output via the screendump monitor command.
To get the information from vt to you you can stick a shell on the vt like this: PS1='shell$ ' setsid sh -c "exec sh -i </dev/tty1 >/dev/ttyS0 2>&1".
| Keypad driver does not input character with input_report_key() |
1,394,917,817,000 |
I have made a custom Linux image with Yocto for use with CN0540 and DE10-Nano. The manufacturer of the CN0540 (Analog Devices) provides an evaluation image for the board, which works without issue, however in my custom image which is using the same kernel fork (ADI Linux fork), the same defconfig as far as I can tell (socfpga_adi_defconfig), and the same device tree (CN0540 dts), and also the same HDL is loaded on the FPGA (CN0540 HDL) I can't use the buffer from the ADC on the CN0540 (AD7768-1). I can read a single value from the ADC, either with libiio's iio_info command, or with the device file at sys/bus/iio/devices/iio:device0/in_voltage0_raw, but I can't read from the buffer of the device E.g iio_readdev ad7768-1 returns Unable to refill buffer: Connection timed out (110), or doing
> echo 1 > scan_elements/in_voltage0_en
> echo 1 > buffer/enable
> cat /dev/iio:device0 | hexdump
which causes the device to crash, unless I set the length of the buffer to 1 with echo 1 > buffer/length which causes the device to output
[ 441.310599] rcu: INFO: rcu_sched self-detected stall on CPU
[ 441.316258] rcu: 0-....: (2099 ticks this GP) idle=10f/1/0x40000002 softirq=2509/2509 fqs=1033
[ 441.325163] (t=2100 jiffies g=497 q=7)
[ 441.329057] NMI backtrace for cpu 0
[ 441.332592] CPU: 0 PID: 163 Comm: cat Not tainted 5.15.0-yocto-standard-adi #1
[ 441.339927] Hardware name: Altera SOCFPGA
[ 441.343988] Backtrace:
[ 441.346453] [<c0d914b0>] (dump_backtrace) from [<c0d916fc>] (show_stack+0x20/0x24)
[ 441.354073] r7:c010edfc r6:00000000 r5:60070193 r4:c143b218
[ 441.359801] [<c0d916dc>] (show_stack) from [<c0d94ecc>] (dump_stack_lvl+0x48/0x54)
[ 441.367360] [<c0d94e84>] (dump_stack_lvl) from [<c0d94ef0>] (dump_stack+0x18/0x1c)
[ 441.374907] r5:00000000 r4:20070193
[ 441.378525] [<c0d94ed8>] (dump_stack) from [<c05850fc>] (nmi_cpu_backtrace+0xe0/0x114)
[ 441.386424] [<c058501c>] (nmi_cpu_backtrace) from [<c0585218>] (nmi_trigger_cpumask_backtrace+0xe8/0x134)
[ 441.395965] r7:c010edfc r6:c0e01ee4 r5:c170469c r4:00000000
[ 441.401597] [<c0585130>] (nmi_trigger_cpumask_backtrace) from [<c010fd68>] (arch_trigger_cpumask_backtrace+0x20/0x24)
[ 441.412180] r9:c1703f10 r8:c0e01ee0 r7:c1835438 r6:00000000 r5:c1703fa4 r4:c171e840
[ 441.419886] [<c010fd48>] (arch_trigger_cpumask_backtrace) from [<c0d9340c>] (rcu_dump_cpu_stacks+0x144/0x174)
[ 441.429922] [<c0d932c8>] (rcu_dump_cpu_stacks) from [<c0198490>] (rcu_sched_clock_irq+0x6a8/0xa58)
[ 441.438860] r10:2e138000 r9:c1702d00 r8:c1693f40 r7:c18361a0 r6:00000000 r5:ef7cbf40
[ 441.446784] r4:c171e840
[ 441.449304] [<c0197de8>] (rcu_sched_clock_irq) from [<c01a354c>] (update_process_times+0x98/0xc4)
[ 441.458174] r10:c1702d80 r9:c1702d40 r8:c184fd40 r7:2e138000 r6:c1702d00 r5:00000000
[ 441.465969] r4:ef7c5540
[ 441.468524] [<c01a34b4>] (update_process_times) from [<c01b74e0>] (tick_sched_timer+0x88/0x2d8)
[ 441.477198] r7:c1ea9dc0 r6:00000066 r5:bf87a4da r4:ef7c6128
[ 441.482830] [<c01b7458>] (tick_sched_timer) from [<c01a4260>] (__hrtimer_run_queues+0x1fc/0x36c)
[ 441.491730] r10:ef7c5e14 r9:ef7c6128 r8:20070193 r7:00000000 r6:c01b7458 r5:ef7c5dc0
[ 441.499645] r4:ef7c5e00
[ 441.502183] [<c01a4064>] (__hrtimer_run_queues) from [<c01a5158>] (hrtimer_interrupt+0x13c/0x2c8)
[ 441.511041] r10:ef7c5e98 r9:ef7c5e70 r8:ef7c5e48 r7:ef7c5dcc r6:00000003 r5:20070193
[ 441.518836] r4:ef7c5dc0
[ 441.521357] [<c01a501c>] (hrtimer_interrupt) from [<c0110744>] (twd_handler+0x44/0x4c)
[ 441.529394] r10:c1ea8000 r9:c1ea9dc0 r8:f080210c r7:c1d08240 r6:00000018 r5:c17046b4
[ 441.537301] r4:00000001
[ 441.539821] [<c0110700>] (twd_handler) from [<c01838c8>] (handle_percpu_devid_irq+0x9c/0x200)
[ 441.548321] r5:c17046b4 r4:c1d09000
[ 441.551888] [<c018382c>] (handle_percpu_devid_irq) from [<c017ced4>] (handle_domain_irq+0x6c/0x88)
[ 441.560961] r7:0000001d r6:00000000 r5:00000000 r4:c1692a14
[ 441.566593] [<c017ce68>] (handle_domain_irq) from [<c0101300>] (gic_handle_irq+0x88/0x9c)
[ 441.574767] r7:c1692a20 r6:f0802100 r5:c177a344 r4:c17046b4
[ 441.580494] [<c0101278>] (gic_handle_irq) from [<c0100afc>] (__irq_svc+0x5c/0x78)
[ 441.587952] Exception stack(0xc1ea9dc0 to 0xc1ea9e08)
[ 441.593047] 9dc0: c28b3700 00000000 00000000 00000003 00001000 c28b3700 c2b47f40 befe9c04
[ 441.601193] 9de0: c28b3774 befe9c04 c1ea8000 c1ea9e24 c1ea9e28 c1ea9e10 c0a95530 c0a949ac
[ 441.609342] 9e00: 20070013 ffffffff
[ 441.612863] r9:c1ea8000 r8:c28b3774 r7:c1ea9df4 r6:ffffffff r5:20070013 r4:c0a949ac
[ 441.620699] [<c0a949a0>] (iio_dma_buffer_dequeue) from [<c0a95530>] (iio_dma_buffer_read+0x148/0x19c)
[ 441.629894] r5:c28b3700 r4:00001000
[ 441.633452] [<c0a953e8>] (iio_dma_buffer_read) from [<c0952618>] (iio_buffer_read+0x178/0x228)
[ 441.642168] r10:c1ea8000 r9:befe9c04 r8:00001000 r7:00000400 r6:00000002 r5:c1e43000
[ 441.649962] r4:c28b3700
[ 441.652483] [<c09524a0>] (iio_buffer_read) from [<c0954b24>] (iio_buffer_read_wrapper+0x2c/0x38)
[ 441.661248] r10:00000003 r9:c0954af8 r8:00001000 r7:00000001 r6:c1ea8000 r5:c1ea9f60
[ 441.669050] r4:c2b28540
[ 441.671571] [<c0954af8>] (iio_buffer_read_wrapper) from [<c02b2da8>] (vfs_read+0xc4/0x320)
[ 441.679817] [<c02b2ce4>] (vfs_read) from [<c02b348c>] (ksys_read+0x74/0xec)
[ 441.686766] r10:00000003 r9:00000000 r8:00000000 r7:befe9c04 r6:c1ea8000 r5:c2b28540
[ 441.694560] r4:c2b28540
[ 441.697081] [<c02b3418>] (ksys_read) from [<c02b351c>] (sys_read+0x18/0x1c)
[ 441.704027] r9:c1ea8000 r8:c0100244 r7:00000003 r6:b6f681a0 r5:befe9c04 r4:00001000
[ 441.711733] [<c02b3504>] (sys_read) from [<c0100060>] (ret_fast_syscall+0x0/0x48)
[ 441.719310] Exception stack(0xc1ea9fa8 to 0xc1ea9ff0)
[ 441.724344] 9fa0: 00001000 befe9c04 00000003 befe9c04 00001000 00000000
[ 441.732488] 9fc0: 00001000 befe9c04 b6f681a0 00000003 00000000 01000000 00000003 befe9c04
[ 441.740769] 9fe0: 00000003 befe9bb8 b6e6070f b6de1ae6
and that output repeats every ~20 seconds.
The device is supposed to send an interrupt to the OS when the buffer is ready, so I probed the DRDY pin (which is the pin for the interrupt) of the device with an MCU, and the pin never goes high.
I also tried switching the libiio version I was using to the same as the evaluation image, 0.23 to 0.21 and the error when running iio_readdev ad7768-1 changed from Unable to refill buffer: Connection timed out (110) to
Unable to refill buffer: Connection timed out
ERROR: Error during buffer disable: No such file or directory
which I'm pretty sure is functionally the same error, so I changed the libiio version back to 0.23
I patched the device driver and libiio in an attempt to find the problem and found out that the problem line from calling iio_readdev ad7768-1 in libiio is this one ret = poll(pollfd, 2, timeout_rel);, and the problem function in the device driver seems to be this one hw_submit_block.
What is causing the timed out error?
|
Finally, found a solution.
U-boot needed to have some handoff files generated.
$ python ./arch/arm/mach-socfpga/cv_bsp_generator/cv_bsp_generator.py \
-i <path_to_qpds_handoff>/hps_isw_handoff/soc_system_hps_0 \
-o board/altera/cyclone5-socdk/qts/
Docs for this are in the /doc/README.socfpga file.
| IIO Unable to refill buffer: Connection timed out (110) error when running iio_readdev |
1,394,917,817,000 |
I am using Debian desktop for Lichee Pi and I am new this platform(linux). I communicate serial with lichee pi using putty. I made the lichee pi connection with the keyboard using microusb to usb converter, but my keyboard is not working. How can I solve this? My setup looks like this:
|
after use a micro usb to usb converter, it worked. I think female-female usb cable is not supported for this ecosystem
| I can not use keyboard for Debian |
1,643,747,634,000 |
Depending on the detected hardware I need to start one of two executables of psplash with different images, so in my psplash_%.bbappend I have
SPLASH_IMAGES = "file://bootscreen1.png;outsuffix=type1 \
file://bootscreen2.png;outsuffix=type2"
And if I bitbake it, I find a psplash-type1 and psplash-type2 executable in the tmp/work/.../psplash/build as well as in package and packages-split and even in image, but it doesn't get included in the final rootfs (there I only find psplash-write).
Do I really need to explicitly install the executables, while a psplash-default along with the psplash link is created automatically and the custom executables are also created magically?
|
Okay, I found out myself and I'll answer it myself, because I couldn't find the answer anywhere in the web:
By giving outsuffixes other than default, you create separate installables to be included separately in the image recipe
IMAGE_INSTALL_append += " \
psplash \
psplash-type1 \
psplash-type2 \
"
This is even an advantage, if you want to have different splashscreens in different images. You just need to know that there is even more magic than you see at the first sight.
| yocto: psplash custom executables do not get installed |
1,643,747,634,000 |
I have a small cpp application which will reboot the system. This works very well so far.
sync(); //need for data safety
reboot(RB_AUTOBOOT);
Unless you are connected via SSH and run this program on the connected device. Then the SSH connection hangs.
If you are connected via SSH and use the CLI commands
sudo reboot
or
sudo shutdown -r now
The SSH connection will be terminated with the following message
Connection to xxx.xxx.xxx.xxx closed by remote host.
Connection to xxx.xxx.xxx.xxx closed.
How do I get the same behaviour with the cpp reboot method?
I read https://man7.org/linux/man-pages/man2/reboot.2.html and search the internet, but didn't found something about this topic.
|
The Solution is to use kill(1, SIGINT) instead of reboot(RB_AUTOBOOT)
More details in https://stackoverflow.com/a/69042761/6729765
| SSH session does not get terminated with cpp reboot comand |
1,643,747,634,000 |
I am trying to convince a sound card to work on a custom HW similar to an Avnet ZED Board.
The original driver example was based on a heavily (a patch to vanilla is about 180k lines) modified 3.14.12 kernel and was called zed_adau1761. The "sound card" is not handled within one driver, it is divided into three logical parts:
Codec driver adau1761-i2c.c,
A driver taking care about streaming data axi-i2s.c,
A driver setting up the two above to work together, zed_adau1761.c.
Unlike the first two drivers, the third one was probably never mainlined, and existed only in one branch of now probably defunct part of Analog Devices Github fork of a kernel.
The development board is still sold according an Avnet web page, so there might be some hackers using it.
My problem is that today tools are not able to work with such an old kernel as was the one about 7 years ago, and at the same time the old kernel is full of other problems, but the old driver is not included with the newer kernels and neither works with newer kernels.
Is the 3. driver mainlined under a different name? Or am I trying the wrong way to make the soundcard work?
Thank to anybody with a better insight into the problem!
|
An attitude to SoC drivers has changed over the years in a way.
The support to OF (Open Firmware - in other words for configuration in device tree) has been reworked, improved and extended in the area of sound card drivers.
It's preferred to use a general solution instead of writing a number of machine drivers (the "glue" driver - 3. in my question). In this case it's a "simple-audio-card" machine driver and an appropriate configuration in device tree:
zed_sound {
compatible = "simple-audio-card";
simple-audio-card,format = "i2s";
simple-audio-card,name = "ZED ADAU1761";
simple-audio-card,dai-link@0 {
format = "i2s";
cpu {
sound-dai = <&axi_i2s_0>;
};
codec {
sound-dai = <&adau1761>;
};
};
};
This solution works with up to date kernel. Tested with long-term stable - 5.10.x at the time of the test.
| (The lack of) ZED board sound card support in GNU/Linux |
1,643,747,634,000 |
I have the U-boot image called:
rootfs.13cy.initramfs.bzip2.uboot
I want to see what's inside of it.
Whats dumpimage cmd shows me:
dumpimage -l rootfs.13cy.initramfs.bzip2.uboot
Image Name: Ramdisk Image
Created: Sun Oct 25 00:39:27 2020
Image Type: ARM Linux RAMDisk Image (bzip2 compressed)
Data Size: 1251896 Bytes = 1222.55 KiB = 1.19 MiB
Load Address: 00000000
Entry Point: 00000000
whats binwalk cmd shows me:
binwalk rootfs.13cy.initramfs.bzip2.uboot
DECIMAL HEXADECIMAL DESCRIPTION
--------------------------------------------------------------------------------
0 0x0 uImage header, header size: 64 bytes,
header CRC: 0x98E059B1, created: 2020-10-24 22:39:27, image size: 1251896 bytes,
Data Address: 0x0, Entry Point: 0x0, data CRC: 0x9F716869, OS: Linux, CPU: ARM,
image type: RAMDisk Image, compression type: bzip2, image name: "Ramdisk Image"
So it is a RAMDisk image and seems like it is not Kernel, can I look inside of it?
any ideas, please
|
You can uncompress the image with bzip2. Read man bzip2.
You can mount the uncompressed image with mount's -o loop option, read man mount.
| How to unzip the U-boot image? |
1,643,747,634,000 |
I've configured my busybox in menuconfig and made it as a static binary (no shared libs) + forced no MMU build.
I'm using the prebuilt arm cross compiler and when I enter the below command, it gave me error while building the source code.
sudo make -j8 ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
it gave me this log:
LINK busybox_unstripped
Static linking against glibc, can't use --gc-sections
Trying libraries: m resolv
Failed: -Wl,--start-group -lm -lresolv -Wl,--end-group
Output of:
arm-linux-gnueabi-gcc -Wall -Wshadow -Wwrite-strings -Wundef -Wstrict-prototypes -Wunused -Wunused-parameter -Wunused-function -Wunused-value -Wmissing-prototypes -Wmissing-declarations -Wno-format-security -Wdeclaration-after-statement -Wold-style-definition -fno-builtin-strlen -finline-limit=0 -fomit-frame-pointer -ffunction-sections -fdata-sections -fno-guess-branch-probability -funsigned-char -static-libgcc -falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1 -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-builtin-printf -Os -static -o busybox_unstripped -Wl,--sort-common -Wl,--sort-section,alignment -Wl,--start-group applets/built-in.o archival/lib.a archival/libarchive/lib.a console-tools/lib.a coreutils/lib.a coreutils/libcoreutils/lib.a debianutils/lib.a klibc-utils/lib.a e2fsprogs/lib.a editors/lib.a findutils/lib.a init/lib.a libbb/lib.a libpwdgrp/lib.a loginutils/lib.a mailutils/lib.a miscutils/lib.a modutils/lib.a networking/lib.a networking/libiproute/lib.a networking/udhcp/lib.a printutils/lib.a procps/lib.a runit/lib.a selinux/lib.a shell/lib.a sysklogd/lib.a util-linux/lib.a util-linux/volume_id/lib.a archival/built-in.o archival/libarchive/built-in.o console-tools/built-in.o coreutils/built-in.o coreutils/libcoreutils/built-in.o debianutils/built-in.o klibc-utils/built-in.o e2fsprogs/built-in.o editors/built-in.o findutils/built-in.o init/built-in.o libbb/built-in.o libpwdgrp/built-in.o loginutils/built-in.o mailutils/built-in.o miscutils/built-in.o modutils/built-in.o networking/built-in.o networking/libiproute/built-in.o networking/udhcp/built-in.o printutils/built-in.o procps/built-in.o runit/built-in.o selinux/built-in.o shell/built-in.o sysklogd/built-in.o util-linux/built-in.o util-linux/volume_id/built-in.o -Wl,--end-group -Wl,--start-group -lm -lresolv -Wl,--end-group
==========
/usr/lib/gcc-cross/arm-linux-gnueabi/9/../../../../arm-linux-gnueabi/bin/ld: libbb/lib.a(inet_common.o): in function `INET6_resolve':
inet_common.c:(.text.INET6_resolve+0x50): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc-cross/arm-linux-gnueabi/9/../../../../arm-linux-gnueabi/bin/ld: coreutils/lib.a(mktemp.o): in function `mktemp_main':
mktemp.c:(.text.mktemp_main+0x9c): warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
/usr/lib/gcc-cross/arm-linux-gnueabi/9/../../../../arm-linux-gnueabi/bin/ld: networking/lib.a(ipcalc.o): in function `ipcalc_main':
ipcalc.c:(.text.ipcalc_main+0x238): warning: Using 'gethostbyaddr' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc-cross/arm-linux-gnueabi/9/../../../../arm-linux-gnueabi/bin/ld: libbb/lib.a(inet_common.o): in function `INET_resolve':
inet_common.c:(.text.INET_resolve+0x50): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc-cross/arm-linux-gnueabi/9/../../../../arm-linux-gnueabi/bin/ld: networking/lib.a(inetd.o): in function `reread_config_file':
inetd.c:(.text.reread_config_file+0x3b0): warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc-cross/arm-linux-gnueabi/9/../../../../arm-linux-gnueabi/bin/ld: networking/lib.a(netstat.o): in function `ip_port_str':
netstat.c:(.text.ip_port_str+0x50): warning: Using 'getservbyport' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc-cross/arm-linux-gnueabi/9/../../../../arm-linux-gnueabi/bin/ld: util-linux/lib.a(rdate.o): in function `rdate_main':
rdate.c:(.text.rdate_main+0xec): undefined reference to `stime'
/usr/lib/gcc-cross/arm-linux-gnueabi/9/../../../../arm-linux-gnueabi/bin/ld: coreutils/lib.a(date.o): in function `date_main':
date.c:(.text.date_main+0x248): undefined reference to `stime'
collect2: error: ld returned 1 exit status
Note: if build needs additional libraries, put them in CONFIG_EXTRA_LDLIBS.
Example: CONFIG_EXTRA_LDLIBS="pthread dl tirpc audit pam"
make: *** [Makefile:718: busybox_unstripped] Error 1
|
Use Linaro arm toolchain instead of glibc. the default arm gnu compiler on ubuntu is not stable.
https://releases.linaro.org/components/toolchain/binaries/latest-7/arm-linux-gnueabihf/
| cannot cross-compile busybox for arm |
1,643,747,634,000 |
I want to create a image file that contains two partitions:
100MB FAT Boot partition that contains my kernel zImage and dtb(device tree blob) files.
900MB EXT4 Rootfs partition that contains my root file system.
Then I want to be able to flash that image file to any sdcard to boot may linux board.
How can I do this and what tools I need? (I prefer cli based tools rather than GUI)
Note: I have my kernel zImage and DTB and rootfs already and I need to make an sdcard bootable image of all of them to easily burn it on any sdcard. But for now I don't have an sdcard. I'll buy my sdcards later. first I want to have the image ready and when I buy them I'll flash the image on all of them swiftly.
|
It's an easy task! Just follow these 15 steps.
steps:
Allocate a file space with fallocate -l 500M sd.img.
Use fdisk(dos partition table) or gdisk(gpt(guided partition table)) to create partition table sudo fdisk sd.img.
After opening fdisk, create a partition by pressing n and then press p to create a primary partition and then just press enter to leave everything by default, except the "Last sector" option. enter +100M to create a 100MB partition.
Redo the third step to create the second partition.
Enter w to save and exit.
Create loop device of your image using sudo kpartx -av sd.img.
Format the partitions sudo mkfs.fat /dev/mapper/loop0p1 and sudo mkfs.ext4 /dev/mapper/loop0p2.
Create a mounting points sudo mkdir /mnt/temp_part1/ & sudo mkdir /mnt/temp_part2/.
Mount the partitions sudo mount /dev/mapper/loop0p1 /mnt/temp_part1/ and sudo mount /dev/mapper/loop0p2 /mnt/temp_part2/ .
copy your content into the mounting points.
sync sudo sync.
Unmount them sudo umount /dev/mapper/loop0p1 /mnt/temp_part1/ and sudo umount /dev/mapper/loop0p2 /mnt/temp_part2/
Delete loop devices sudo kpartx -d sd.img
Flash your image on your sdcard using any flasher software on any OS. I use BalenaEtcher.
Enjoy your SD Card!
| How to create linux sdcard image? |
1,643,747,634,000 |
I want to boot uCLinux on the stm32f4 but I don't have enough knowledge about Barebox. is it possible to port Barebox for cortex m4? if yes, how?
|
The short answer is no. but the barebox community is working on it to bring barebox to cortex m devices too. I suggest you to use u-boot for now because it supports many cortex m socs (m3, m4 and m7).
you can easily port barebox for any cortex m mcu. you can use u-boot drivers to port them to barebox.
you must have a deep knowledge about linux/u-boot driver model.
| does Barebox bootloader works on cortex m4? |
1,643,747,634,000 |
On an embedded system, we need to boot a Linux partition in several "flavors":
an operational mode where sensitive services are disabled (e.g. sshd);
an integration mode where such services are enabled.
The expected process is to detect specific GPIOs signals at startup.
The bootloader is U-Boot, and already reads those GPIOs.
I was thinking of letting U-Boot pass some specific argument to the Linux kernel, and then let startup scripts parse /proc/cmdline in order to alter their behaviour accordingly.
The other obvious solution would be to let the startup scripts reacquire the GPIOs once they are started, but this solution doesn't seem robust to signal jitters (some of them are dependant on an operator holding a button...)
Are there any drawbacks to the "kernel argument" solution ?
Did I miss any other simple solutions ?
Sincerely,
Vincent
|
Are there any drawbacks to the "kernel argument" solution ?
I don't think so.
Did I miss any other simple solutions ?
I would go on the kernel solution and use a specific runlevel.
If i understood well your needs, the integration mode will implement the same things than production/operation mode but with stuff added (ssh, etc...).
So i would use runlevel 4 for operation mode and runlevel 5 for integration mode.
See manpage for runlevel and more globally for boot
| Booting Linux with different security configurations |
1,643,747,634,000 |
I am setting up an embedded linux device which should grab its IP-address and its MAC address at boot from files in the filesystem. Lets say there is a file /root/ipaddress with the only content "192.168.10.10" and /root/macaddress with "02:02:02:02:02:02" . The rest of the configuration should not be configurable.
Currently the the network configuration is done via ifup -i /etc/interfaces -a, where the IP-address is defined in the stanza:
# The loopback network interface
#auto lo
#iface eth0 inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.10.10
netmask 255.255.255.0
I have tried to use environment variables in the /etc/interfaces file without success.
I could build a script using ip commands where I would bring down the interface again, configure IP and MAC address, and bring it up again. However that seems quite inefficient.
|
ifupdown set of scripts isn't designed to work that way.
Instead, you may:
Stop using ifupdown and manage to configure the networking by yourself inside a dedicated script. (i would probably choose this option)
Use the post-up feature of ifupdown, that way:
iface eth0 inet static
pre-up ifconfig eth0 hw ether `cat /root/macaddress`
address 0.0.0.0
netmask 255.255.255.0
post-up ifconfig eth0 `cat /root/ipaddress`
Note that i didn't tested if post-up is able to manage the backtick construct. ..
Maybe you can also dig around the manual methods (instead of static) ...
| Alternative way to configure IP address |
1,643,747,634,000 |
I am on a custom board using an i.MX6. I am using Yocto (Pyro) to build my kernel (4.14.16).
I am using the generic imx6qdl.dtsi device tree entry for PWM2 to drive the fan and it appears to work fine. The fan has a Tachometer input, which is connected to GPIO2_7. How do I read the fan speed? I have seen device tree blobs for cooling devices, but none of the examples seem to have a tachometer to monitor the fan's speed.
|
I was unable to find a device tree solution, but found enough code snippets to make an application to read it. Basically I just set up an interrupt on the GPIO and used clock_gettime to measure the period between edges. It requires a lot of filtering, but I am only using it to make sure the fan is running so that is fine.
| How to read back a fan speed? |
1,548,861,490,000 |
I'm confused about the partitions size of a flash memory in my embedded linux device:
/ # cat /proc/partitions
major minor #blocks name
240 0 93184 ndda
240 1 85168 ndda1
240 2 7000 ndda2
240 3 1000 ndda3
I know the partitions corresponding to ndda2 and ndda3 were created to have 7000 kB and 1000 kB of size respectively.
I see ndda is 16 kB larger than the sizes of ndda1 + ndda2 + ndda3.
That is, 93184 - (85168 + 7000 + 1000) = 16.
What is responsible for those 16 kB and where can I get to know more about it?
Now, if I mount ndda1 on a directory, called /nand1, I get:
/ # df
Filesystem 1k-blocks Used Available Use% Mounted on
tmpfs 27044 0 27044 0% /dev/shm
/dev/ndda1 84928 64288 20640 76% /nand1
Its size (84928 kB?) is 240 kB less than what is reported by /proc/partitions.
Again, what structure is responsible for that?
The partition was mounted as vfat.
|
Partitions are generally started on a boundary of 2MB to align the filesystem blocks with the physical blocks (which may be 16kB, 64kB or even larger, depending on the device). Misaligned blocks mean that when one filesystem block is updated, two device blocks need to be fetched, the last part of the first block gets updated, and the first part of the second block gets updated, and both blocks are written back. This is two block reads and one block write more than with a properly aligned filesystem.
At the very beginning of the device, you find the partition table itself. That is why the first partition can't begin at block 0.
As to your second question (why is the filesystem smaller than the device): the filesystem needs its management data (e.g. list of free blocks) which is reserved space, and hence not available for direct data storage.
| Interpreting /proc/partitions |
1,548,861,490,000 |
I have an embedded linux system that has limited commands available. VI being the only text editor I found so far. I can run SH to run a script but again, limited abilities.
I need to ftpget a text file from a remote address, read said text file, then update a specific line that starts with syslocation in a different text file.
So:
text file 1 (snmpd.conf) has this on line 16: syslocation NO GPS INFO
text file 2 (gps.txt) has the GPS info on line 1: 51.5073509,-0.127758
If you have links on examples of updating this, I would be most thankful.
Regards
|
Check if you have vi configured to be able to be invoked as ex, which sounds exactly what you want. ex is vi in non-interactive mode. See the answer here: https://vi.stackexchange.com/questions/457/does-ex-mode-have-any-practical-use
See also the answer here for practical examples: https://vi.stackexchange.com/questions/788/how-to-edit-files-non-interactively-e-g-in-pipeline
Both links themselves include many useful other links.
| Embedded linux to read text and append it to another file [closed] |
1,548,861,490,000 |
I'm trying to interface LCD for my new WaRP (imx7s-solo). (we can found both LCD and WaRP7 here LCD and WaRP7 product) The problem is I can not have enough knowledge to verify my work is right or wrong. (I'm an application developer actually...). My work are below:
First try: I build & install core-image-sato on board. After checking boot log, I see there are driver is loaded, the result is LCD is ON but only white screen. Logs are
backlight supply power not found, using dummy regulator
MIPI DSI driver module loaded
30760000.mipi-dsi supply disp-power-on not found, using dummy regulator mxc_mipi_dsi_samsung 30760000.mipi-dsi: i.MX MIPI DSI driver probed MIPI DSI driver module loaded
30730000.lcdif supply lcd not found, using dummy regulator mxc_mipi_dsi_samsung 30760000.mipi-dsi: MIPI DSI dispdrv inited!
mxsfb 30730000.lcdif: registered mxc display driver mipi_dsi_samsung
Console: switching to colour frame buffer device 40x40
mxsfb 30730000.lcdif: initialized
Next I tried to build and run few things to check that I can display something on screen before continue to work. use some commands "startx", "cp /dev/urandom /dev/fb0"..etc but screen still remains white only.
Other tried, I run Qt Helloworld application on WaRP7 and it keep showing error "Bus error" nothing more....
=> If possible, please help me clarify few thing
which is the right path should I follow ?
with the steps above, is there any chance or additional step to display something on LCD (console or anything)
Note: this is only the most positive way (I think). I've google-ed it & try many other ways for weeks. (For example: use fbtft notro driver, writing driver....etc)
|
I am currently working on the LCD Display integration on the WaRP7, and it's working well but not yet merged on the linux-warp7 kernel. I maintain the official Yocto/OE layer for WaRP7 (with some examples), and there are some features for LCD have been already merged.
I just opened a pull request to push the unofficial patch (until the official patch is merged): https://github.com/WaRP7/meta-warp7-distro/pull/37
| How to interface LCD for new WaRP7 (imx7s-solo)? |
1,548,861,490,000 |
Recently I tried to make my own cross-compile toolchain for a arm platform. I noticed with the autoconf script of GCC, I have to pass variables like:
--with-cpu=cortex-m4 \
--with-fpu=fpv4-sp-d16 \
--with-float=hard \
--with-mode=thumb \
So it seems different ARM platforms should have different tool chain/compiler cause I have to configure the cpu, fpu etc.
But then I found there's some sort of pre-made binaries of these tool chain.
https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads
I tried this tool chain and compiled a hello world program and tried it on my target ARM board, then it shows "segmentation fault."
OK, at least it's not "cannot execute binary file: Exec format error"
But I am still wondering, how come it does not work? Or is it suppose to work actually?
|
When building the toolchain itself, you have to configure which features to support. You can build a "slim" compiler, supporting just the features you need for the target you want.
But you can also support everything the ARM platform has to offer and get a clumsy compiler.
For the features themselves, you should differ between different types:
Optimization flags like -mcpu are not required, they are only to optimize the code for a certain ARM processor
The fpu feature of your ARM core on the other hand has to be available to use the fpu at all.
Your float=hard depends on the operating system, not on the processor: it allows to pass floats to functions in floating registers which can be a big speedup because transfer between ARM registers and float registers are slow. But for linkage, the system needs to agree on that.
Support for thumb is somehow optional, too. You can use either if the core supports it, but nowadays it would be stupid not to let the compiler choose thumb mode.
| Does ARM platform have a universal tool chain / compiler? |
1,548,861,490,000 |
I am trying to build a embedded Linux system for karo imx6 8033 som with 4GB SD card on it by using buildroot to build rootfs, Configuring kernel 4.11. I am using mfg tool to write the system on module. After flashing the SD card, I see that rootfs partition is just 300MB.
# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 282.5M 136.7M 130.8M 51% /
devtmpfs 342.1M 0 342.1M 0% /dev
uboot
TX6DL U-Boot > mmc part
Partition Map for MMC device 0 -- Partition Type: DOS
Part Start Sector Num Sectors UUID Type
1 2048 30720 0cc66cc0-01 0c
2 32768 614400 0cc66cc0-02 83
3 647168 7086080 0cc66cc0-03 83
Each block is 512B so 614400*512=300MB. It is not enough for my work.
I want to learn in which step this configuration of partition is set while configuring rootfs, kernel or u-boot? MFG tool also has configuration file. If this partition is set while sending rootfs, kernel and U-boot, which parameter of MFG tool should I change to enhance the rootfs partition?
there is a way at this link after flashing the SD card. But I need a solution before flashing it.
|
I find the solution.
In my case, I have chanced script named ucl2.xml file in Profiles/TX6/OS FIRMWARE in MFG Tool file. karo TX6 board has 4 GB MMC, so I made changes under "LINUX-MMC" In line 104
<CMD state="Updater" type="push" body="$ [ -b /dev/emmc ] && (echo label-id:0x0cc66cc0; echo size=30720,type=c; echo size=614400,type=83; echo type=83) | sfdisk /dev/emmc"> Partitioning...</CMD>
first "echo size" represents first partition above. second represents second partition. just add second partition "Num Sectors" with third partition "Num Sectors" and change the 614400 with 7700480
| Partition for embedded linux before flashing the SD card |
1,548,861,490,000 |
I am working on an embedded system built around Atmel ARM926EJ-S based on rather old ARM core ARMv5TEJ. I have a Debian 8 system that used to work for that hardware until I had to update the kernel from 3.11.6 to 4.1.18. The update was needed in order to add support for certain USB hardware.
The update gave me what I wanted with one exception: reboot is not working anymore. More precisely put, when I write command reboot into console, the system shuts itself down, but in the end, instead of actually rebooting the CPU, it just halts, requiring use of the power switch to get the system up again.
What could cause this? Are there any typical issues that I could check?
Here are the last lines of the debug console:
systemd-shutdown[1]: Sending SIGTERM to remaining processes...
systemd-journald[721]: Received SIGTERM from PID 1 (systemd-shutdow).
systemd-shutdown[1]: Sending SIGKILL to remaining processes...
systemd-shutdown[1]: Unmounting file systems.
systemd-shutdown[1]: Unmounting /sys/kernel/debug.
EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
systemd-shutdown[1]: All filesystems unmounted.
systemd-shutdown[1]: Deactivating swaps.
systemd-shutdown[1]: All swaps deactivated.
systemd-shutdown[1]: Detaching loop devices.
systemd-shutdown[1]: All loop devices detached.
systemd-shutdown[1]: Detaching DM devices.
systemd-shutdown[1]: All DM devices detached.
systemd-shutdown[1]: Rebooting.
reboot: Restarting system
Reboot failed -- System halted
|
I tried kernel version 4.11.0 which is the latest stable version at the moment, as suggested in the comments to the question. There were some new options regarding reboot and it works now.
I didn't investigate the details further so I can't tell whether something had been broken and then got fixed again or if version 4.1.18 could have been fixed with proper configuration.
| How to fix reboot broken by kernel update |
1,548,861,490,000 |
An embedded device, running eCos OS, with FTP Lite Client. I want download file from device to local PC via FTP during terminal session. FTP transfer initiates device, it ask to specify the FTP IP address, file name, user name and password. Once details entered, it starts FTP transfer. Device not allow connect FTP client from outside to initiate a file download request, it allow only transfer in one direction, from device to remote FTP host.
How to setup FTP application on Ubuntu for this purpose?
|
How to setup FTP application on Ubuntu for this purpose?
You need an FTP server that will allow uploads.
I recommend vsftpd; here is a page that explains how to configure it for upload:
https://www.centos.org/forums/viewtopic.php?t=39485
| FTP download question |
1,548,861,490,000 |
I have a small device that runs a light weight embedded linux. I can telnet and ssh to the device. This device has no package management utility on it that I can tell.
I am trying to install a pre-compiled audio recorder such as LAME, however I am having a hard time getting details on this device to find a package that I can use.
How can I tell details about the distribution it is running so i can find packages that I can use? Additional are there other consideration to look at such as hardware for a pre-compiled linux application?
|
Passing the commands below as root will give you an overview of the device's hardware and the kernel and drivers running on the device, maybe the name of the distribution too.
uname -a
dmesg
cat /etc/issue
cat /etc/lsb-release
The current LAME source code can be obtained from https://sourceforge.net/projects/lame/files/lame/3.99/
You can scp the extracted tarball to your device and attempt to compile it yourself locally. Compiling instructions are in the INSTALL file.
| Embedded Linux Distribution |
1,548,861,490,000 |
I have a linux media player that was very common before android's age. It is a MIPS running Linux Venus 2.6.12.6 and has 2 sata, 2 usb and 1 sdcard port. Since the flash memory is very limited, I installed optware, ssh and nano on sdcard and put in
ln -s /tmp/usbmounts/sdb1/opt /opt
The sdcard can remain plugged for good since I won't use sdcard for media. It works very well if I do not have other usb plugged or if I plug other usb after boot. But if I plug other usb before boot, the sdcard port always be mounted to sdc or sdd and of course the link won't work. I (kind of) resolved this by putting a script at boot to locate /opt and link accordingly. However, I found that there is other activity that can change the mount point after boot.
The player mainly runs a software called Dvdplayer. This software has a menu on screen for user to choose media to play. Every time when this menu is called up, the mount point seems to change, EVEN WITHOUT any additional usb plug in. Say if after boot, my sdcard is mounted to sdb, after calling up the menu, it changed to sdc (sdb has nothing). Calling up the menu again, it becomes sdd (sdb and sdc has nothing). Call the menu the 3rd time, it goes back to sdc and then to and fore between sdc and sdd, never sdb again.
Searching the internet, I understand this is hotplugging and I am able to locate the software. But different from the usual linux hotplug, the softare is an executable elf file instead of a script, and I cannot find any system variables related the hotplug, such as SUBSYSTEM, ACTION, PRODUCT, TYPE, INTERFACE, DEVICE etc. Instead, it has a sequence number in /sys/kernel/hotplug_seqnum. It has empty folders like /tmp/lock/hotplug/convert_tmp, ...mount_tmp, ...rename_tmp and ...volume_lock. mount_tmp is the only folder that has its date changed, but still is always empty.
I've tried to trap the hotplug by moving the /sbin/hotplug to /sbin/sbin/hotplug and put in my own hotplug script in /sbin/hotplug. The script looks like this
mount / -o remount,rw
echo $* >> /usr/local/etc/init.d/hotplug.log
/sbin/sbin/hotplug $*
But it doesn't work: after calling the menu, nothing was logged and all plug-in mounts were lost.
All I wanted to do now is to trap the hotplug activities and relink my /opt correctly. Appreciate any help or a better method of ensuring the correct link for /opt.
|
Better to explicitly say that this is a shell script and I wish to use ${@} instead of $*:
#!/bin/sh
mount -o remount,rw /
echo ${@} >/tmp/log.txt
echo >>/tmp/log.txt
env >>/tmp/log.txt # if /tmp is writable or tmpfs
exec /sbin/sbin/hotplug "${@}"
If the system is sane, this should work. Many embedded, however, are not. Beware.
| Embedded linux hotplug changed mount point |
1,548,861,490,000 |
I'm working on a embedded system. I have multiple SD cards to save copy of Linux rootfs on (kernel saved in nand). On a original SD card, where is located a system, and from this card the system is copied to another - everything works nice. Init service is working as it should.
But there is a problem on copied system on another SD cards - system is working, but it's not turning on init service, where is located for example network, sshd init, needed for a application.
Two things - when I was copying system not all of files wanted to copy (especially from /dev/, but it is normal, beacuse of aim of this files). But maybe another files weren't coppied properly?
Second thing - i'm mounting:
/var
/tmp
/var/tmp
On tmpfs (RAM) - but i think it's not a problem (it's working good on original SD card).
Maybe I shouldn't copy rootfs, and do something else?
|
Had to do some copy/paste things. First, I've downloaded minimal ELDK distribution (i'm using it), copied all with rsync. Next i've rsynced copy of system and copied it on SD card on fresh system. All worked.
| Embedded Linux and Init problem - Init won't start |
1,548,861,490,000 |
I am trying to boot linux from flash on an powerpc board. In u-boot I set bootargs with:
setenv bootargs root=/dev/mtdblock1 rootfstype=ext2 rw console=ttyS0,115200 ramdisk_image=\${rd_size}
I also tried rootfstype=ext3 and jfs2; and root=/dev/mtdblockn (n from 0 to 6) and root=/dev/ram without rootfstype
The rd_size is another environment variable set to 12000.
Then each time I entered bootm with appropriate arguments, but each time I faced the error mentioned in title.
|
I used the setenv command that ltib prints at the end of building images and the error vanished.
It seems that you should instruct system of size of your disk with that command.
setenv ramdisksize=90000,...
| kernel panic not syncing: vfs :unable to mount root fs on unknown block(31,1) |
1,548,861,490,000 |
From the answers to this question I have discovered that the embedded Linux distribution provided to me, by my hardware supplier, was not built with kernel support. If I am to use this distribution I have to be able to install drivers for some CANBUS hardware that will be attached. The source for the drivers is provided by the CANBUS part manufacturer but since the OS I have been given does not have gcc installed on it and does not support loadable modules, I have no idea how to continue.
Is there anything at all I can do to try get around this problem? The alternative is to use DOS as the OS on the embedded device which I am very keen to avoid so any potential solutions would be gratefully received.
|
By definition, if the kernel does not support loadable modules, you cannot load a module.
As you have already been told, there is something you can do: install a kernel compiled by someone else or recompile a kernel, with loadable modules and all the extra drivers you like.
I recommend that you first try installing an existing Linux distribution. This is a lot easier than compiling your own kernel, especially if you don't have enough technical information about exactly what hardware is in it.
You do not need to have GCC installed on the device to recompile a kernel. The kernel is designed to make cross-compilation easy. In fact, since your device has an x86 processor, all you need to do is compile a kernel with the right options on your PC.
Determining the right options can be difficult, and putting the kernel in the right place to be booted can be difficult. Feel free to ask on this site if you need help with those. In your question, be sure to give as much information as you can about your device.
| Installing a .ko module on an embedded Linux system that does not support modules |
1,548,861,490,000 |
I am just a newbie that is trying to learn. I can't see anything in the OLED display (ssd0303).
I am just using this demo: https://www.freertos.org/portlm3s811keil.html
as you can see it says that:
The print task is the only task permitted to access the LCD - thus
ensuring mutual exclusion and consistent access to the resource. Other
tasks do not access the LCD directly, but instead send the text they
wish to display to the print task. The print task spends most of its
time blocked - only waking when a message is queued for display.
but actually, if I compile using make and running using qemu-system-arm -M lm3s811evb -kernel gcc/RTOSDemo.bin I can only see that black screen.
Why? Is there something I am not considering? It should work out of the box, since it's also writen in the official doc that I mentioned. So why I see black screen?
Probably there is something I am not considering because I am a newbie
|
I fixed by compiling via Keil instead of gcc:
https://forums.freertos.org/t/i-am-trying-to-emulate-a-board-which-has-a-oled-display-but-cant-see-anything-can-you-tell-me-if-there-is-something-important-i-am-not-considering/18689/3
| I am trying to emulate a board which has a OLED display, but can't see anything. Can you tell me if there is something important I am not considering? [closed] |
1,548,861,490,000 |
My Target Setup:
SOC: STM32H743 (Cortex m7 single core)
Internal Flash: 2MB
Board: Waveshare CoreH7XXI
On-board DRAM: 8MB, Start_Address: 0xd0000000, Size_in_bytes: 0x7A1200
SDCARD: 1GB
Bootloader: mainline u-boot (only I've modified the device tree and added my board files, almost everything is default)
kernel: mainline linux (compiled with stm32_defconfig configuration + some tweaks in menuconfig)
My Host (PC) Setup:
OS: Ubuntu 20 LTS on windows10 WSL2
Text Editor: VSCode (Visual Studio Code)
Debug Probe: STLink V2
Debug Software: Openocd + gdb-multiarch integrated in VSCode
Raw U-boot serial console:
U-Boot 2020.07-00610-g610e1487c8-dirty (Sep 07 2020 - 22:06:45 +0430)
Model: Waveshare STM32H743i-Coreh7 board
DRAM: 7.6 MiB
MMC: STM32 SD/MMC: 0
In: serial@40004400
Out: serial@40004400
Err: serial@40004400
Hit SPACE in 3 seconds to stop autoboot.
stm32_sdmmc2_send_cmd: cmd 6 failed, retrying ...
stm32_sdmmc2_send_cmd: cmd 6 failed, retrying ...
stm32_sdmmc2_send_cmd: cmd 6 failed, retrying ...
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
U-Boot > fatload mmc 0:1 ${kernel_addr_r} zImage
1403424 bytes read in 326 ms (4.1 MiB/s)
U-Boot > fatload mmc 0:1 ${fdt_addr_r} stm32h743i-coreh7.dtb
15116 bytes read in 14 ms (1 MiB/s)
U-Boot > setenv bootargs console=ttySTM1,115200n8
U-Boot > bootz ${kernel_addr_r} - ${fdt_addr_r}
Kernel image @ 0xd0008000 [ 0x000000 - 0x156a20 ]
## Flattened Device Tree blob at d0408000
Booting using the fdt blob at 0xd0408000
Loading Device Tree to d064f000, end d0655b0b ... OK
Starting kernel ...
Even I made a uImage with the below command but again it didn't boot.
mkimage -A arm -O linux -T kernel -C none -a 0xd0008000 -e 0xd0008000 -n "Linux kernel" -d arch/arm/boot/zImage uImage
u-boot log:
U-Boot > bootm ${kernel_addr_r} - ${fdt_addr_r}
## Booting kernel from Legacy Image at d0008000 ...
Image Name: Linux kernel
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1403424 Bytes = 1.3 MiB
Load Address: d0008000
Entry Point: d0008000
Verifying Checksum ... OK
## Flattened Device Tree blob at d0408000
Booting using the fdt blob at 0xd0408000
Loading Kernel Image
U-boot Env:
U-Boot > printenv
arch=arm
baudrate=115200
board=coreh7
board_name=coreh7
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf}
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_syslinux_conf=extlinux/extlinux.conf
boot_targets=mmc0
bootcmd=run distro_bootcmd
bootcmd_mmc0=devnum=0; run mmc_boot
bootdelay=3
bootfstype=fat
cpu=armv7m
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
fdt_addr_r=0xD0408000
fdtcontroladdr=d06572a0
fdtfile=stm32h743i-coreh7.dtb
kernel_addr_r=0xD0008000
loadaddr=0xD0400000
mmc_boot=if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part; fi
pxefile_addr_r=0xD0428000
ramdisk_addr_r=0xD0438000
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done; setenv devplist
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${boot_syslinux_conf}; then echo Found ${prefix}${boot_syslinux_conf}; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done
scriptaddr=0xD0418000
soc=stm32h7
stderr=serial@40004400
stdin=serial@40004400
stdout=serial@40004400
vendor=waveshare
Environment size: 1873/8188 bytes
you can download my kernel .config file from here (default config: stm32_defconfig).
you can download my u-boot .config file from here.
you can download my modified device tree from here.
you can download my u-boot specific modified device tree from here.
|
You aren't passing any bootargs to the kernel, and since you're bypassing the logic to have a regular Linux distribution provide that for you, you need to pass in something that says where the console is, to Linux, so it will print out messages, as well as your root device.
| u-boot stuck at Starting Kernel |
1,421,080,145,000 |
Received my Jetson TK1 yesterday. After unboxing it and configuring the Linux GUI, rebooting the device with a mouse (cordless) attached to its USB 3.0 port takes it to some sort of Command line page where it probably loads some files and then the screen starts printing " [ . ] ". Nothing happens beyond that until I restart the board without any USB peripheral and then the device boots into the normal Linux GUI. Unable to figure out what's wrong with my board and why is it not working properly.
P.S.: Connecting the monitor via HDMI after switching on the device gives no visual output, just a blank screen. Is it possible to connect the device via network adapter for remote access even it the screen is running blank?
|
You should make sure you are not using serial console. Please check your /boot/extlinux/extlinux.conf and the "console=" line. If you have such a line, please remove it. It's blocking the HDMI output according to our testing.
| Jetson TK1 boot issues |
1,421,080,145,000 |
I've been trying to get gps data from an embedded system. This is the command I use:
gpscat /dev/ttyS2
And I get a continuous stream of output like this:
$GLGSV,1,1,03,70,14,098.6102,E,121853.000,A,A*50
$GPRMC,121853.000,A,59480,N,00604.6102,E,AA,10,1.0,203.6,47.6,,*64
$04.6102,E,121854.000,A,A*57
$GPRMC,121854.000,A$GPGSV,2,1,08,05,11,032,40,16,55,300,14,18,17,14GLL,5046.9480,N,00604.6102,E,121855.000,A,A*56
+GPSPVT:0,12:18:57,17/07/2017,3D FIX,N 050 46'5604.6102,E,121857.000,A,A*54
$GPRMC,121857.000,A6,35,20,31,075,35*7D
$GPGSV,2,2,08,21,74,133,29GLL,5046.9480,N,00604.6102,E,121858.000,A,A*5B
*59 $GLGSA,A,3,70,85,,,,,,,,,,,,,,1.0,*25 $GNGGLL,5046.9480,N,00604.6102,E,121859.000,A,A*5A
,16,18,20,21,26,29,31,,,,,1.6,1.0,1.2*2E
$GNGSA5046.9480,N,00604.6102,E,0.0,321.6,170717,,,A*61.88",E 006
04'36.61",+0203m
$GPVTG,321.6,T,,M,0GLL,5046.9480,N,00604.6102,E,121903.000,A,A*54
,031,40,16,56,299,17,18,19,145,35,20,31,074,35*74.6102,E,121904.000,A,A*53
$GPRMC,121904.000,A,,080,37,31,16,203,21*7E
$GLGSV,1,1,03,70,15,09704.6102,E,121905.000,A,A*52
$GPRMC,121905.000,A8,05,10,031,40,16,56,299,18,18,19,145,35,20,31,0,*62
$GNGSA,A,3,05,16,18,20,21,26,29,31,,,,,1.6.88",E 006 04'36.61",+0203m
$GPGGA,12
Can you explain how I would interpret this?
|
read about NMEA protocol its raw of them, details here, and here.
each line is frame of protocol:
$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A
Where:
RMC Recommended Minimum sentence C
123519 Fix taken at 12:35:19 UTC
A Status A=active or V=Void.
4807.038,N Latitude 48 deg 07.038' N
01131.000,E Longitude 11 deg 31.000' E
022.4 Speed over the ground in knots
084.4 Track angle in degrees True
230394 Date - 23rd of March 1994
003.1,W Magnetic Variation
*6A The checksum data, always begins with *
Note that, as of the 2.3 release of NMEA, there is a new field
| How do I interpret the results of gpscat? [closed] |
1,350,499,117,000 |
In Linux I can create a SHA1 password hash using sha1pass mypassword. Is there a similar command line tool which lets me create sha512 hashes? Same question for Bcrypt and PBKDF2.
|
Yes, you're looking for mkpasswd, which (at least on Debian) is part of the whois package. Don't ask why...
anthony@Zia:~$ mkpasswd -m help
Available methods:
des standard 56 bit DES-based crypt(3)
md5 MD5
sha-256 SHA-256
sha-512 SHA-512
Unfortunately, my version at least doesn't do bcrypt. If your C library does, it should (and the manpage gives a -R option to set the strength). -R also works on sha-512, but I'm not sure if its PBKDF-2 or not.
If you need to generate bcrypt passwords, you can do it fairly simply with the Crypt::Eksblowfish::Bcrypt Perl module.
| How to create SHA512 password hashes on command line |
1,350,499,117,000 |
When I installed Ubuntu 10.04 and, now, 10.10, I was offered the option of enabling "encrypted LVM" for my hard drive.
After choosing that option, I am prompted for my password during boot to decrypt the LVM.
Now, I am thinking about setting up a headless server that runs Linux (not necessarily Ubuntu), but I am worried that since the server is headless I won't be able to decrypt it during startup. Would I be able to SSH in during boot to enter my password for the encrypted LVM? If so how do I set it up? Or is there another solution? Again this question is NOT specific to Ubuntu.
Thanks.
|
For newer versions of Ubuntu, for example, 14.04, I found a combination of @dragly and these blogposts' answers very helpful. To paraphrase:
(On server) Install Dropbear
sudo apt-get install dropbear
(On server) Copy and assign permissions for root public/private key login
sudo cp /etc/initramfs-tools/root/.ssh/id_rsa ~/.
sudo chown user:user ~/id_rsa
Remember to change user to your username on the server.
(On client) Fetch private key from server
scp [email protected]:~/id_rsa ~/.ssh/id_rsa_dropbear
(On client) Add an entry to ssh config
Host parkia
Hostname 192.168.11.111
User root
UserKnownHostsFile ~/.ssh/know_hosts.initramfs
IdentityFile ~/.ssh/id_rsa_dropbear
Remember to change parkia to whatever you'd like to type ssh my-box to be.
(On server) Create this file at /etc/initramfs-tools/hooks/crypt_unlock.sh
(On server) Make that file executable
sudo chmod +x /etc/initramfs-tools/hooks/crypt_unlock.sh
Update the initramfs
sudo update-initramfs -u
Disable the dropbear service on boot so openssh is used after partition is decrypted
sudo update-rc.d dropbear disable
You're done. Try it out. Check the blog post linked above for instructions about how to configure the server with a static IP address if that is something you'd need to do.
| SSH to decrypt encrypted LVM during headless server boot? |
1,350,499,117,000 |
Security team of my organization told us to disable weak ciphers due to they issue weak keys.
arcfour
arcfour128
arcfour256
But I tried looking for these ciphers in ssh_config and sshd_config file but found them commented.
grep arcfour *
ssh_config:# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
Where else I should check to disable these ciphers from SSH?
|
If you have no explicit list of ciphers set in ssh_config using the Ciphers keyword, then the default value, according to man 5 ssh_config (client-side) and man 5 sshd_config (server-side), is:
aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,
[email protected],[email protected],
[email protected],
aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,
aes256-cbc,arcfour
Note the presence of the arcfour ciphers. So you may have to explicitly set a more restrictive value for Ciphers.
ssh -Q cipher from the client will tell you which schemes your client can support. Note that this list is not affected by the list of ciphers specified in ssh_config. Removing a cipher from ssh_config will not remove it from the output of ssh -Q cipher. Furthermore, using ssh with the -c option to explicitly specify a cipher will override the restricted list of ciphers that you set in ssh_config and possibly allow you to use a weak cipher. This is a feature that allows you to use your ssh client to communicate with obsolete SSH servers that do not support the newer stronger ciphers.
nmap --script ssh2-enum-algos -sV -p <port> <host> will tell you which schemes your server supports.
| SSH: How to disable weak ciphers? |
1,350,499,117,000 |
I need to password protect my PDF file(s), because I am going to send them through email and I want anyone who would view my PDF file(s) to be prompted for a password.
How can I add a password to a PDF in Linux Mint 17.1?
|
You can use the program pdftk to set both the owner and/or user password
pdftk input.pdf output output.pdf owner_pw xyz user_pw abc
where owner_pw and user_pw are the commands to add the passwords xyz and abc respectively (you can also specify one or the other but the user_pw is necessary in order to prohibit opening).
You might also want to ensure that encryption strength is 128 bits by adding (though currently 128 bits is default):
.... encrypt_128bit
If you cannot run pdftk as it is no longer in every distro, you can try qpdf. Using qpdf --help gives information on the syntax. Using the same "values" as for pdftk:
qpdf --encrypt abc xyz 256 -- input.pdf output.pdf
| How to set password for pdf files? |
1,350,499,117,000 |
Using command line, I know that I can encrypt a directory with the following command:
zip -er Directory.zip /path/to/directory
However, this does not encrypt the filenames themselves. If someone runs:
unzip Directory.zip
and repeatedly enters a wrong password, the unzip command will loop through all of the contained filenames until the correct password is entered. Sample output:
unzip Directory.zip
Archive: Directory.zip
creating: Directory/
[Directory.zip] Directory/sensitive-file-name-1 password:
password incorrect--reenter:
password incorrect--reenter:
skipping: Directory/sensitive-file-name-1 incorrect password
[Directory.zip] Directory/sensitive-file-name-2 password:
password incorrect--reenter:
password incorrect--reenter:
skipping: Directory/sensitive-file-name-2 incorrect password
[Directory.zip] Directory/sensitive-file-name-3 password:
password incorrect--reenter:
password incorrect--reenter:
skipping: Directory/sensitive-file-name-3 incorrect password
and so on.
Using command line, is there a way to zip a directory with encryption while also encrypting or hiding the filenames themselves?
Thank you.
|
In a zip file, only file contents is encrypted. File metadata, including file names, is not encrypted. That's a limitation of the file format: each entry is compressed separately, and if encrypted, encrypted separately.
You can use 7-zip instead. It supports metadata encryption (-mhe=on with the Linux command line implementation).
7z a -p -mhe=on Directory.7z /path/to/directory
There are 7zip implementations for all major operating systems and most minor ones but that might require installing extra software (IIRC Windows can unzip encrypted zip files off the box these days). If requiring 7z for decryption is a problem, you can rely on zip only by first using it to pack the directory in a single file, and then encrypting that file. If you do that, turn off compression of individual files and instruct the outer zip to compress the zip file, you'll get a better compression ratio overall.
zip -0 -r Directory.zip /path/to/directory
zip -e -n : encrypted.zip Directory.zip
| How to zip directory with encryption for file names? |
1,350,499,117,000 |
I have Alice's public key. I want to send Alice an RSA encrypted message.
How can I do it using the openssl command?
The message is:
Hi Alice! Please bring malacpörkölt for dinner!
|
In the openssl manual (openssl man page), search for RSA, and you'll see that the command for RSA encryption is rsautl. Then read the rsautl man page to see its syntax.
echo 'Hi Alice! Please bring malacpörkölt for dinner!' |
openssl rsautl -encrypt -pubin -inkey alice.pub >message.encrypted
The default padding scheme is the original PKCS#1 v1.5 (still used in many procotols); openssl also supports OAEP (now recommended) and raw encryption (only useful in special circumstances).
Note that using openssl directly is mostly an exercise. In practice, you'd use a tool such as gpg (which uses RSA, but not directly to encrypt the message).
| How to encrypt messages/text with RSA & OpenSSL? |
1,350,499,117,000 |
I try to find a script to decrypt (unhash) the ssh hostnames in the known_hosts file by passing a list of the hostnamses.
So, to do exactly the reverse of:
ssh-keygen -H -f known_hosts
Or also, to do the same as this if the ssh config HashKnownHosts is set to No:
ssh-keygen -R know-host.com -f known_hosts
ssh-keyscan -H know-host.com >> known_hosts
But without re-downloading the host key (caused by ssh-keyscan).
Something like:
ssh-keygen --decrypt -f known_hosts --hostnames hostnames.txt
Where hostnames.txt contains a list of hostnames.
|
Lines in the known_hosts file are not encrypted, they are hashed. You can't decrypt them, because they're not encrypted. You can't “unhash” them, because that what a hash is all about — given the hash, it's impossible¹ to discover the original string. The only way to “unhash” is to guess the original string and verify your guess.
If you have a list of host names, you can pass them to ssh-keygen -F and replace them by the host name.
while read host comment; do
found=$(ssh-keygen -F "$host" | grep -v '^#' | sed "s/^[^ ]*/$host/")
if [ -n "$found" ]; then
ssh-keygen -R "$host"
echo "$found" >>~/.ssh/known_hosts
fi
done <hostnames.txt
¹ In a practical sense, i.e. it would take all the computers existing today longer than the present age of the universe to do it.
| How to decrypt hostnames of a crypted .ssh/known_hosts with a list of the hostnames? |
1,350,499,117,000 |
Today I got this warning issued by OpenSSL in Cygwin after updating some packages, I believe openssl was included:
*** WARNING : deprecated key derivation used.
Using -iter or -pbkdf2 would be better.
The OpenSSL version used in Cygwin was:
OpenSSL 1.1.1b 26 Feb 2019
This happened while decrypting my Backup on BluRay, which I created on Linux Mint 19.1, where the OpenSSL version is significantly older:
OpenSSL 1.1.0g 2 Nov 2017
The command used to encrypt and decrypt (just add -d to the end) was:
openssl enc -aes-256-cbc -md sha256 -salt -in "$InputFilePath" -out "$OutputFilePath"
What does this warning mean and can I do anything to avoid it in the future backups?
|
Comparing the Synopsys of the two main and recent versions of OpenSSL, let me quote the man pages.
OpenSSL 1.1.0
openssl enc -ciphername [-help] [-ciphers] [-in filename] [-out filename] [-pass arg] [-e] [-d] [-a/-base64] [-A] [-k password] [-kfile filename] [-K key] [-iv IV] [-S salt] [-salt] [-nosalt] [-z] [-md digest] [-p] [-P] [-bufsize number] [-nopad] [-debug] [-none] [-engine id]
OpenSSL 1.1.1
openssl enc -cipher [-help] [-ciphers] [-in filename] [-out filename] [-pass arg] [-e] [-d] [-a] [-base64] [-A] [-k password] [-kfile filename] [-K key] [-iv IV] [-S salt] [-salt] [-nosalt] [-z] [-md digest] [-iter count] [-pbkdf2] [-p] [-P] [-bufsize number] [-nopad] [-debug] [-none] [-rand file...] [-writerand file] [-engine id]
There obviously are some greater differences, namely considering this question, there are these two switches missing in the 1.1.0:
pbkdf2
iter
You have basically two options now. Either ignore the warning or adjust your encryption command to something like:
openssl enc -aes-256-cbc -md sha512 -pbkdf2 -iter 1000000 -salt -in InputFilePath -out OutputFilePath
Where these switches:
-aes-256-cbc is what you should use for maximum protection or the 128-bit version; the 3DES (Triple DES) got abandoned some time ago, see Triple DES has been deprecated by NIST in 2017, while AES gets accelerated by all modern CPUs by a lot; you can simply verify if your CPU has the AES-NI instruction set for example using grep aes /proc/cpuinfo; win, win
-md sha512 is a bit the faster variant of SHA-2 functions family compared to SHA-256 while it might be a bit more secure; win, win, but that likely changes with the new SHA instruction set in modern CPUs
-pbkdf2: use PBKDF2 (Password-Based Key Derivation Function 2) algorithm
-iter 1000000 is overriding the default count of iterations (which is 10000) for the password, quoting the man page:
Use a given number of iterations on the password in deriving the encryption key. High values increase the time required to brute-force the resulting file. This option enables the use of PBKDF2 algorithm to derive the key.
The default value of iterations is not documented, but specified in apps/enc.c file like this:
case OPT_PBKDF2:
pbkdf2 = 1;
if (iter == 0)
iter = 10000;
break;
Decryption is issued simply by adding -d switch to the end of the original command-line.
| OpenSSL 1.1.1b warning: Using -iter or -pbkdf2 would be better while decrypting a file encrypted using OpenSSL 1.1.0g |
1,350,499,117,000 |
I tried removing LUKS encryption on my home directory using the following command:
cryptsetup luksRemoveKey /dev/mapper/luks-3fd5-235-26-2625-2456f-4353fgdgd
But it gives me an error saying:
Device /dev/mapper/luks-3fd5-235-26-2625-2456f-4353fgdgd is not a
valid LUKS device.
Puzzled, I tried the following:
cryptsetup status luks-3fd5-235-26-2625-2456f-4353fgdgd
And it says:
/dev/mapper/luks-3fd5-235-26-2625-2456f-4353fgdgd is active and is in use.
type: LUKS1
cipher: ...
It seems the encrypted device is active, but not valid. What could be wrong here?
|
ANSWER FROM 2013 - See other answers for happy times
Backup
Reformat
Restore
cryptsetup luksRemoveKey would only remove an encryption key if you had more than one. The encryption would still be there.
The Fedora Installation_Guide Section C.5.3 explains how luksRemoveKey works.
That it's "impossible" to remove the encryption while keeping the contents is just an educated guess. I base that on two things:
Because the LUKS container has a filesystem or LVM or whatever on top of it, just removing the encryption layer would require knowledge of the meaning of the data stored on top of it, which simply is not available. Also, a requirement would be that overwriting a part of the LUKS volume with its decrypted counterpart, would not break the rest of the LUKS content, and I'm not sure if that can be done.
Implementing it would solve a problem that is about as far away from the purpose of LUKS as you can get, and I find it very unlikely that someone would take the time to do that instead of something more "meaningful".
| How to remove LUKS encryption? |
1,350,499,117,000 |
I would like to password protect or encrypt a directory and all the files within it (for the whole directory tree below it). I do not want to bother the whole home directory, I want a specific directory with some files and folders in it. I would like to be able to encrypt the directory or decrypt it using a password. Command line would be nicest to use. I don't want to have to create a new file as an encrypted version and then, delete the previous ones which are the non-encrypted version.
|
Use encfs (available as a package on most distributions). To set up:
mkdir ~/.encrypted ~/encrypted
encfs ~/.encrypted ~/encrypted
# enter a passphrase
mv existing-directory ~/encrypted
The initial call to encfs sets up an encrypted filesystem. After that point, every file that you write under ~/encrypted is not stored directly on the disk, it is encrypted and the encrypted data is stored under ~/.encrypted. The encfs command leaves a daemon running, and this daemon handles the encryption (and decryption when you read a file from under ~/encrypted).
In other words, for files under ~/encrypted, actions such as reads and writes do not translate directly to reading or writing from the disk. They are performed by the encfs process, which encrypts and decrypts the data and uses the ~/.encrypted directory to store the ciphertext.
When you've finished working with your files for the time being, unmount the filesystem so that the data can't be accessed until you type your passphrase again:
fusermount -u ~/encrypted
After that point, ~/encrypted will be an empty directory again.
When you later want to work on these files again, mount the encrypted filesystem:
encfs ~/.encrypted ~/encrypted
# enter your passphrase
This, again, makes the encrypted files in ~/.encrypted accessible under the directory ~/encrypted.
You can change the mount point ~/encrypted as you like: encfs ~/.encrypted /somewhere/else (but mount the encrypted directory only once at a time). You can copy or move the ciphertext (but not while it's mounted) to a different location or even to a different machine; all you need to do to work on the files is pass the location of the ciphertext as the first argument to encfs and the location of an empty directory as the second argument.
| Simplest way to password protect a directory and its contents without having to create new files? |
1,350,499,117,000 |
How can I verify if a hard drive is encrypted in Fedora 20?
If not, does it mean I have to re install Fedora to encrypt it?
|
Assuming that the drive is /dev/sdb, and the partition you want to check is /dev/sdb1, run this command:
$ blkid /dev/sdb1
the output will change if the partition is encrypted or not:
/dev/sdb1: UUID="xxxxxxxxxxxx" TYPE="crypto_LUKS" #encrypted
/dev/sdb1: UUID="xxxxxxxxxxxx" TYPE="ext4" #not encrypted, fs is ext4
If the partition is not encrypted, and assuming that you are NOT trying to encrypt the / partition, you have to:
Make a backup of the data on that partition
Initialize the partition as encrypted
$ cryptsetup luksFormat /dev/sdb1
BEWARE: this command will wipe all the contents of the partition!!!
It will ask you for a passphrase to open the volume; now if you try to run blkid, the output should be TYPE="crypto_LUKS"
Open the encrypted partition to use it
$ cryptsetup luksOpen /dev/sdb1 secret
where "secret" is the name of the volume we are opening
Format the new "secret" volume
$ mkfs.ext4 /dev/mapper/secret
Mount it providing the passphrase created before
$ mount /dev/mapper/secret /whereyouwant
Now you should be able to use the encrypted partition!
Optionally, if you want to mount it at reboot, you should edit /etc/crypttab and insert a line similar to this (it will request the password at boot):
secret /dev/sdb1 none
Where secret is the name of the volume we created before.
Or something like this, if you want to put your password in some plain text file:
secret /dev/sdb1 /whereyouwant-sdb1-luks-pwdfile
Just keep in mind for this, you also have to add the key:
$ cryptsetup luksAddKey /dev/sdb1 /whereyouwant-sdb1-luks-pwdfile
And edit the /etc/fstab and insert a line similar to this:
/dev/mapper/secret /whereyouwant ext4 defaults 1 2
| Verify if a hard drive is encrypted on Linux |
1,350,499,117,000 |
What's the fastest method to backup and restore a luks encrypted device (e.g. a full encrypted usb-device to a image-file).
The usb-device can be decrypted/accessed. I'm looking for a solution to mount the backup image as a file (encryped). Can it be possible?
Keep it simple, stupid.
|
cryptsetup handles image files just as well as block devices, if that was your question. So if you make a dd image (which will be freaking huge) it will work. And if it didn't, you could just create the loop device yourself.
Best practice (if you want to keep the backup encrypted) is to encrypt the backup disk also, then open both containers, then run any backup solution of your choice as you would with unencrypted filesystems. It won't be the fastest method as it'd decrypt data from the source disk and then re-encrypt it for the backup disk. On the other hand it allows for incremental backup solutions, so it should still beat the dd-image-creation on average.
If you want to stick to dd, the only way to make something faster than dd would be a partimage of sorts which takes LUKS header and offset into account, so it would only store the encrypted data that is actually in use by the filesystem.
If the source disk is a SSD and you allow TRIM inside LUKS, and the SSD shows trimmed regions as zeroes, you get this behaviour for free with dd conv=sparse. It's still not something I'd recommend, though.
| Best practice to backup a LUKS encrypted device |
1,350,499,117,000 |
Are there any Linux boot loaders supporting full disk encryption (a la TrueCrypt). I know there was work towards adding encryption support to GRUB2, but this does not seem to be ready yet. Any other options?
(Note that I am really referring to full disk encryption here—including /boot)
Most of the answers describe a setup where /boot is not encrypted, and some of them try to explain why an unencrypted /boot should be OK.
Without getting into a discussion on why I actually need /boot to be encrypted, here is an article that describes exactly what I need, based on a modified version of GRUB2:
http://xercestech.com/full-system-encryption-for-linux.geek
The problem with this is that these modifications apparently are not supported in the current GRUB2 codebase (or maybe I am overlooking something).
|
I think the current version of GRUB2 does not have support for loading and decrypting LUKS partitions by itself (it contains some ciphers but I think they are used only for its password support). I cannot check the experimental development branch, but there are some hints in the GRUB page that some work is planned to implement what you want to do.
Update (2015): the latest version of GRUB2 (2.00) already includes code to access LUKS and GELI encrypted partitions. (The xercestch.com link the OP provided mention the first patches for that, but they are now integrated in the latest release).
However, if you are trying to encrypt the whole disk for security reasons, please note that an unencrypted boot loader (like TrueCrypt, BitLocker or a modified GRUB) offers no more protection than an unencrypted /boot partition (as noted by JV in a comment above). Anybody with physical access to the computer can just as easily replace it with a custom version. That is even mentioned in the article at xercestech.com you linked:
To be clear, this does not in any way make your system less vulnerable to offline attack, if an attacker were to replace your bootloader with their own, or redirect the boot process to boot their own code, your system can still be compromised.
Note that all software-based products for full disk encryption have this weakness, no matter if they use an unencrypted boot loader or an unencrypted boot/preboot partition. Even products with support for TPM (Trusted Platform Module) chips, like BitLocker, can be rooted without modifying the hardware.
A better approach would be to:
decrypt at the BIOS level (in motherboard or disk adapter or external hardware [smartcard], with or without a TPM chip), or
carry the PBA (preboot authorization) code (the /boot partition in this case) in a removable device (like a smartcard or an USB stick).
To do it the second way, you can check the Linux Full Disk Encryption (LFDE) project at: http://lfde.org/ which provides a post-install script to move the /boot partition to an external USB drive, encrypting the key with GPG and storing it in the USB too. In that way, the weaker part of the boot pathway (the non-encrypted /boot partition) is always with you (you will be the only one with physical access to the decrypting code AND the key). (Note: this site has been lost and the author's blog also disappeared, however you can find the old files at https://github.com/mv-code/lfde just note the last development was done 6 years ago). As a lighter alternative, you can install the unencrypted boot partition in an USB stick while installing your OS.
Regards, MV
| Linux boot loaders supporting full disk encryption? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.