Identifying a Raspberry Pi host with configure - linux

I work on a cross-platform project, and recently added support for the Raspberry Pi. The project, to make sure it is available at as wide as possible audience, has a premake, a cmake and an autotools build system. I have set up cross-compilation for the RPi, and everything works great.
Recently, I also set up a Raspberry Pi VM (Until I get a real RPi) trying to build the library. From Linux, I run './configure --host=arm-raspberry-linux-gnueabihf', and configure takes it from there. On the RPi however (Rasbian 7), the default host found by config.guess is 'armv61-unknown-linux-gnueabihf'. For that reason, even natively on the Pi, I have to run './configure --host=arm-raspberry-linux-gnueabihf'. So, my question sums up to this:
Currently, I currently have something like this in my configure script:
case "$host" in
armv61-unknown-linux-gnueabihf)
if [[ -f /usr/bin/rpi-update ]]; then
on_raspberry=yes
fi
;;
## other hosts here
esac
So, my question sums up to this:
Is 'armv61-unknown-linux-gnueabihf' only reported on the Raspberry Pi? If not, how can configure make sure that it is really on RPi? Is checking for rpi-update sufficient? Do different distros (Arch Linux, Pidora, ...) also have rpi-update?
Are there any other possible host triplets like this that are reported by different versions of the Pi?
Thanks in advance

Is 'armv61-unknown-linux-gnueabihf' only reported on the Raspberry Pi?
Other platforms could use that as well.
If not, how can configure make sure that it is really on RPi?
It can't really (e.g. running it on a RPi VM). configure is just a shell script.
Is checking for rpi-update sufficient?
See above.
Do different distros (Arch Linux, Pidora, ...) also have rpi-update?
Current Pidora and Arch images don't have /usr/bin/rpi-update. Neither does old Rasbpian images at least as far back as 10 Aug 2012.
Are there any other possible host triplets like this that are reported by different versions of the Pi?
There are 3 triplets for the RPi cross compilers, so it would not be surprising if there were others.
EDIT: so basically what is wanted is a way for configure to detect when it's building on a Raspberry Pi. Easy as pie:
configure.ac
# need to detect build...
AC_CANONICAL_BUILD
...
AC_MSG_CHECKING([if build is on Raspberry Pi])
# The test for 'BCM2708' might be sufficient,
# but the presence of Serial is definitely part of
# the Pi firmware for codec licensing.
# See this thread
# <http://www.raspberrypi.org/phpBB3/viewtopic.phpf=29&t=28304&p=252357#p251536>.
AS_CASE("$build",
[arm*-*-linux*],
[on_rpi=`awk -v r=0 '/^Hardware#<:# \t#:>#+:#<:# \t#:>#+BCM2708/ { ++r;} /^Serial#<:# \t#:>#+:/ { ++r; } END { print ((r > 1) ? "yes" : "no");}' /proc/cpuinfo`],
[on_rpi="no"])
AC_MSG_RESULT($on_rpi)
Detects on Raspbian, Pidora, should work on Arch. Arch doesn't seem to include a compiler in its current install image, so configure failed when I tried it. All detected build as armv6l-unknown-linux-gnueabihf when running ./configure. I have not tried this on any kind of RPi emulator or VM.

BCM2708 in /proc/cpuinfo might be unique for RPi.
From File /proc/cpuinfo
Processor : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS : 697.95
Features : swp half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xb76
CPU revision : 7
Hardware : BCM2708
Revision : 000d
Serial : 00000000db690cb4

Related

Ubuntu 16.04.3 intel skylake i915 external monitor not detected

My external monitor, connected via HDMI was working fine but now is not being detected (it says 'No video input'). I'm pretty sure I didn't make any changes to make it stop - it was working on the same setup yesterday.
I'm a pretty new linux user and also don't know much about graphics hardware and drivers. Appreciate any help, I'd like to understand what's going on!
I'm running Ubuntu 16.04.3 kernel 4.10.0-33
lshw -c video gives:
*-display
description: VGA compatible controller
product: Sky Lake Integrated Graphics
vendor: Intel Corporation
physical id: 2
bus info: pci#0000:00:02.0
version: 07
width: 64 bits
clock: 33MHz
capabilities: pciexpress msi pm vga_controller bus_master cap_list rom
configuration: driver=i915 latency=0
resources: irq:124 memory:f0000000-f0ffffff memory:e0000000-efffffff ioport:e000(size=64) memory:c0000-dffff
I've tried booting from grub into kernel 4.8.0 and the monitor still wasn't detected.
I've also tried to no avail:
sudo apt-get update
sudo apt-get install --reinstall xserver-xorg-video-intel xserver-xorg-core
sudo dpkg-reconfigure xserver-xorg
I've also tried running the Intel graphics update tool and this also hasn't solved anything.
EDIT: It seems like I get the 'No video input' probelm if I plug in the HDMI cord before the computer has finished booting.
Pretty much the only answer one can give here based on the available information is, try checking the display cables, and, if that doesn't help, file a bug. Debugging display problems like this can be fairly involved, with several cycles of requesting and providing more information. That doesn't really work all that well here.
The alternatives for filing the bug are Ubuntu Launchpad and drm/i915 upstream. Upstream has the best knowledge about the driver and the hardware, but, depending on the issue, you might be expected to build and run the userspace components or the kernel from upstream git repositories.
I come across the problem and solve it with exactly the same card (i had same lshw -c video) by searching the NVIDIA X-Server settings (search inside apps) on my Ubuntu 16 LTS and activate the NVIDIA drivers for this card (I have a NVIDIA GEFORCE GTX)
After i log out and i have a bad errors display and i was blocked " this computer is running in low display mode" .
I just switch off the computer and restart it...and taatatatat HDMI was working and was able to display on my external Sansumg 27''
I had the exact same issue as OP. lshw not showing HDMI port, nada. Reinstalling xserver* did not work either.
May the gods of stack overflow smile upon you for that EDIT line, because plugging only after boot was complete, it did work for me as well.
This is quite interesting, as I am running 20.04. This issue came out of nowhere, just turned on the computer and voila, it was not working. There had been no updates, no changes that could affect this during previous session.
Would love to know if someone else has bumped into this problem.

Network simulation tool supporting Bluetooth

We'd like to perform a Bluetooth network simulation.
As far as we have researched, Bluetooth module has not been implemented in ns-3 and ns-2 modules recommended in this question have not been updated for years. We have not found any other simulation tool supporting this protocol apart from this mention to Qualnet, which I have not been able to verify on their website.
Is there any current network simulation tool that includes a Bluetooth module or should we still use ns-2?
All the Bluetooth examples in ns-2.29/ucbt-0.9.8.2a/test/ are working OK :
$ ns-nist-pmipv6 1f.tcl etc. etc.
( Except tcp.tcl, which causes "Segmentation fault", when the old executable 'ns-nist-pmipv6' is used with a contemporary "Linux OS".)
Examples are :
1f.tcl mr5n.tcl pico-3mb.tcl scat-form-law.tcl test_inq.tcl
2sco_inq.tcl ms5n1.tcl pico.tcl tcp.tcl test_sco.tcl
3f.tcl ms5n.tcl rphsi.tcl tdrp.tcl test_sdp.tcl
dsdv.tcl multislot.tcl rs.tcl test_fh.tcl udp.tcl
Code : ns-2.29-nist-mob-022707.tgz ( + pmip6-for-ns-2.29-nist.patch )
NIST-MOB info :
. https://groups.google.com/forum/?fromgroups#!searchin/ns-users/nist|sort:date
. http://www.linuxquestions.org/questions/tags/nist-mob/
The compat-gcc-34-**-3.4.6 compilers from CentOS ( RHEL ) which can compile the old nist-mob code have been repacked to Debian packages. Versions are available for Ubuntu 10.04 + 10.10 and for Ubuntu 11.10 .. 15.04 .

Can I copy the pi1b system to pi2b?

I have a Raspberry Pi 1b, AMD recently bought a Pi2b. So I wonder if I can use image tools to copy pi1system to pi2? I may copy pi1's SD card to a .img file, then use the file to create the data of pi2's micro SD card.
I knew that the CPU of both Pis are different. So is that available? Did someone tried?
If so, will there be some hidden bugs inside the system which we can't find immediately but affect the system work properly?
Any suggestion will be appreciated!
Short Answer
Yes you can, make sure your OS has an ARMv7 kernel.
Long Answer
Some quotes from the official Raspberry Pi blog:
Broadcom were willing to step up with a new SoC, BCM2836. This retains all the features of BCM2835, but replaces the single 700MHz ARM11 with a 900MHz quad-core ARM Cortex-A7 complex: everything else remains the same, so there is no painful transition or reduction in stability.
Note: ARMv7 is backwards compatible with ARMv6, the quote below proves it.
At launch, we are using the same ARMv6 Raspbian userland on both Raspberry Pi 1 and 2
There could be some hidden issues
It won't be caused by upgrading from Pi 1 model B to Pi 2 model B. It will be caused from copying the image. If you or your system hardcoded your network interface's MAC address it could potentially cause a problem. I know it's not the best example, but sometime people don't think and hardcode things that can change. It all depends on your OS.
Short how-to for installing the new kernel on raspbian
It's good idea to backup your SD card before making these changes, if something goes wrong it could prevent your Pi from booting.
To backup your SD card on Linux/OS X you can use (remember to select the correct device (sda/sdb/sdc):
sudo dd bs=4M if=/dev/sdX of=raspbian.img
To install ARMv7 kernel:
sudo apt-get update
sudo apt-get install linux-image-rpi2-rpfv
sudo apt-get install linux-headers-rpi2-rpfv
Check /boot to make sure you've got kernel7.img:
ls -lsa /boot
Result of ls:
3861 -rwxr-xr-x 1 root root 3953492 Feb 24 20:55 kernel.img
3818 -rwxr-xr-x 1 root root 3908696 Feb 24 20:55 kernel7.img
If that does not work you can try forcing the kernel name by modifying your /boot/config.txt see http://elinux.org/RPiconfig#Boot for more options.
Other Issues
Kernel modules like wifi drivers or streaming cam in this case can also cause problems on your new ARMv7 kernel if it is not supported by default see http://l0l.org.uk/2015/02/headaches-whilst-upgrading-to-raspberry-pi-2/

Build a minimum system with Qt embedded and run on Qemu for x86

My aim: Trying to
Build a minimal Qt based GUI system with a single window and sensor connected on USB
demonstrate this using Qemu and later on embedded board with atom
to build it from scratch
Use buildroot to build the rootfilesystem
My experience Have experience in Linux kernel development for device drivers, qemu, Buildroot, USB but has no experience on GUI and framebuffers.
My attempts:Build kernel and rootfile system
with buildroot using the command make qemu_x86_defconfig
Framebuffer support on Linux kernel is enabled along with the following CONFIG_FB, CONFIG_FRAMEBUFFER_CONSOLE, and CONFIG_LOGO (all the options below this are also enabled)
As the first milestone I expected to see the TUX logo when I run the image with the command
qemu-system-i386 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext2 -append root=/dev/sda -vga std but i donot.
Am I making a mistake at the Qemu command or the framebuffer is not enabled?
P.S. A similar question Qt application GUI -- automatic start -- linux. But i am not planning to use the X window as suggested by most users.
I missed the cirrus graphics board driver. Qemu emulates Cirrus CLGD 5446 PCI VGA card or dummy VGA card with Bochs VESA extensions (hardware level, including all non standard modes for i386.
So the steps are:
Download buildroot
make clean
make qemu_x86_defconfig
make linux-menuconfig to configure kernel and in Device drivers->Graphics support->Support for frame buffer devices enable Cirrus Logic support
Save the configuration and run make
Once make is complete run the command in board/qemu/x86/readme.txt
Where did you see that Buildroot has a i386_defconfig? You seem to be confusing kernel defconfigs and Buildroot defconfigs. I would recommend you to start with:
make clean
make qemu_x86_defconfig
make
and then read board/qemu/x86/readme.txt to see how to run the generated system.

About compiling Linux kernel in Debian Live

This is my first time compiling Linux kernel. I am using Debian Live. I used kernel-package to compile and I also added a new system call to return an arbitrary integer value greater than zero.
Everything went fine and I got both headers and image .deb files. When I tried to install them with dpkg, there was a warning that said I needed to configure LILO. I then aborted the installation and looked for LILO to find out that Debian Live got neither LILO nor GRUB. I installed GRUB, but it was not installed on my sda1 (USB disk running Debain Live), it said that it was not a proper block device. Debian Live uses squashfs (a file system).
Then, I ignored bootloader and installed the custom kernel. After I rebooted my computer, I was directly booted to the old Debain Live and my system call returns -1.
Please provide some solutions guys.
Thanks,
Debian Live is not a suitable base for you do to your own kernel development on. As you've found, it doesn't contain the tools needed to rebuild itself (that's not what its designed to do).
Install the regular Debian distribution (perhaps inside a virtualisation environment like VMWare Server or VirtualBox). Do your kernel development there.

Resources