RealTime kernel on Raspberry Pi 4 - linux-kernel

I'm trying to install a realtime kernel version of Linux on a Raspberry Pi 4 using Raspbian 32 bit, but following this procedure I encounter some problems:
~$ mkdir ~/rpi-kernel
~$ cd ~/rpi-kernel
~rpi-kernel$ mkdir rt-kernel
~/rpi-kernel$ git clone https://github.com/raspberrypi/linux.git -b rpi-4.19.y-rt
~/rpi-kernel$ git clone https://github.com/raspberrypi/tools.git
~/rpi-kernel$ ARCH=arm
~/rpi-kernel$ CROSS_COMPILE=~/rpi-kernel/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-
~/rpi-kernel$ INSTALL_MOD_PATH=~/rpi-kernel/rt-kernel
~/rpi-kernel$ INSTALL_DTBS_PATH=~/rpi-kernel/rt-kernel
~/rpi-kernel$ KERNEL=kernel7l
~/rpi-kernel$ cd ~/rpi-kernel/linux/
~/rpi-kernel/linux/$ make bcm2711_defconfig
~/rpi-kernel/linux$ make -j4 zImage
~/rpi-kernel/linux$ make -j4 modules
~/rpi-kernel/linux$ make -j4 dtbs
~/rpi-kernel/linux$ make -j4 modules_install
~/rpi-kernel/linux$ make -j4 dtbs_install
~/rpi-kernel/linux$ sudo cp arch/arm/boot/dts/*.dtb /boot/
~/rpi-kernel/linux$ sudo cp arch/arm/boot/dts/overlays/.dtb /boot/overlays
~/rpi-kernel/linux$ sudo cp arch/arm/boot/dts/overlays/README /boot/overlays
~/rpi-kernel/linux$ sudo cp arch/arm/boot/zImage /boot/kernelname.img
Assign "kernel=kernelname.img" into /boot/config.txt
Reboot the system.
But when I reboot the system, it promps "cgroup2: unknown option "memory_recursiveprot" and I don't see the desktop (only black screen), but the processor still performs some activities (green light that lights up occasionally).
What am I wrong? If I perform the same operations using a 5.10 kernel version everything is fine.

Related

unrecognized option --gc-keep-exported on arm ld

Right now, I'm trying to integrate a GitHub Action that checks if some code on a pull request compiles properly (VEX Robotics for anyone interested). However, when it gets to running the make command, I get this error:
Building Project
make: Entering directory '/github/workspace/V5'
Adding timestamp [OK]
Creating cold package with libpros,okapilib [ERRORS]
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: unrecognized option '--gc-keep-exported'
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
make: *** [bin/cold.package.elf] Error 1
common.mk:200: recipe for target 'bin/cold.package.elf' failed
I'm extremely confused as to why this is occurring? --gc-keep-exported is a real option, and this code compiles perfectly on my local machine. I've tried changing the ubuntu version and updating the VEX SDK to see if it helps, but I keep on getting the same error. What should I do?
Code:
Dockerfile:
FROM ubuntu:18.04
RUN apt-get update
# Install GCC & Clang
RUN apt-get install build-essential -y
RUN apt-get install clang -y
# Install needed ARM deps
RUN apt-get install gcc-arm-none-eabi -y
RUN apt-get install binutils-arm-none-eabi -y
# Install 7z & cURL
RUN apt-get install p7zip-full -y
RUN apt-get install curl -y
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
entrypoint.sh:
echo "Downloading VEX SDK"
# Get VEX SDK and put it in ~/sdk
curl -L https://content.vexrobotics.com/vexcode/v5code/VEXcodeProV5_2_0_1.dmg -o _vexcode_.dmg
7z x _vexcode_.dmg || :
7z x Payload~ ./VEXcode\ Pro\ V5.app/Contents/Resources/sdk -osdk_temp || :
mkdir ~/sdk
mv sdk_temp/VEXcode\ Pro\ V5.app/Contents/Resources/sdk/* ~/sdk
rm -fR _vex*_ _vex*_.dmg sdk_temp/ Payload~
ls ~/sdk # ls just for testing
echo "Building Project"
# Now make the makefile in the set path
make --directory=$1
The reason this was happening was because I used an old version of gcc-arm-none-eabi. The version on apt is super outdated (v6.3.1 vs v10.2.1).
I was able to use the new version by downloading the tarball available on their site and using the direct paths to compile my code.
There is a newer GCC version available for a newer Ubuntu version, you could browse for another one, or be lazy and enjoy some malpractice with me:
FROM ubuntu:latest

Using GCC10 with Qt on KDE Neon 18

I would like to play around with some very new C++20 features. Some of them are supported by GCC10 only. Unfortunately the most current release is GCC9.3 so I need to use the unreleased version of GCC10.
I did the following to install it:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt install gcc-10 g++-10
This worked fine. However I am unable to make it the default compiler. As usual I tried:
sudo update-alternatives --config gcc
This says there would be no alternatives. Why?
You can do it manually:
cd /usr/local/bin
sudo ln -s /usr/bin/gcc-10 gcc
sudo ln -s /usr/bin/g++-10 g++
Then open a new terminal windows and gcc should refers to gcc-10. It should work for simple cases. If it does not, you will have to create all the appropriate symbolic links for all GCC 10 ecutables and libraries...
I think the best option is to compile yourself GCC 10 and install it in your home directory. This is what I do on my minimalist Gentoo installation, I suppose it will work too on Ubuntu:
mkdir ~/src
cd ~/src
git clone https://github.com/gcc-mirror/gcc.git
mkdir gcc_build
cd gcc_build
../gcc/configure --enable-libsanitizer --prefix=~/usr --with-gcc-major-version-only --disable-bootstrap --enable-language=c,c++,lto
make -j16
make install -j16
Compilation may last about 10 minutes. Consider to adapt the -j16 option to your machine: this is the number of jobs launched simultaneously by make. Using twice the number of parallel thread supported by your CPU is a good choice. Then add appropriate environment variables to your ~/.bashrc file:
export LD_LIBRARY_PATH=~/usr/lib64:~/usr/lib:$LD_LIBRARY_PATH
export LIBRARY_PATH=~/usr/lib64:~/usr/lib:$LIBRARY_PATH
export LD_RUN_PATH=~/usr/lib64:~/usr/lib:$LD_RUN_PATH
export PATH=~/usr/bin:$PATH
When you do not want to use gcc-10 any more comment out these lines and open a new terminal.

Step by Step walk through on how to use swupdate on Raspberry Pi or any Embedded board for system update

Stackoverflow community. I am trying to design an OTA update system and would like to use swupdate for raspberry pi to update. I have found very limited to none information regarding on how to implement that. It would be great if anybody can let me know how it is done. Thank you
Here's a good example of OTA using SWUpdate on raspberry pi.
https://mkrak.org/2018/01/26/updating-embedded-linux-devices-part2/
I had to make a few changes to use the latest zeus release. Below is step by step commands on ubuntu 18.04. (This alway worked with master branch as of Mar-22-2020)
Install all required dependencies. (installation script below from https://medium.com/#shantanoodesai/run-docker-on-a-raspberry-pi-4-with-yocto-project-551d6b615c0b)
sudo apt-get update
sudo apt-get install \
gawk wget git-core diffstat unzip texinfo gcc-multilib \
build-essential chrpath socat cpio \
python python3 python3-pip python3-pexpect \
xz-utils debianutils iputils-ping \
python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev
Clone all meta-layers
mkdir yocto && cd yocto
mkdir layers && cd layers
git clone git://git.yoctoproject.org/poky -b zeus
git clone git://github.com/openembedded/meta-openembedded.git -b zeus
git clone https://github.com/agherzan/meta-raspberrypi.git -b zeus
git clone https://github.com/sbabic/meta-swupdate -b zeus
git clone https://github.com/sbabic/meta-swupdate-boards.git -b master
cd ..
. layers/poky/oe-init-build-env build
Add layers. If this fails modify build/conf/bblayers.conf manually to include all the layers specified below
bitbake-layers add-layer ../layers/meta-openembedded/meta-oe
bitbake-layers add-layer ../layers/meta-openembedded/meta-python
bitbake-layers add-layer ../layers/meta-openembedded/meta-networking
bitbake-layers add-layer ../layers/meta-openembedded/meta-multimedia
bitbake-layers add-layer ../layers/meta-raspberrypi
bitbake-layers add-layer ../layers/meta-swupdate
bitbake-layers add-layer ../layers/meta-swupdate-boards
Add the following to build/conf/local.conf (Raspberry pi doesn't use uboot bootloader by default. swupdate requires ext4.gz image.)
RPI_USE_U_BOOT = "1"
IMAGE_FSTYPES = "rpi-sdimg ext4.gz"
PREFERRED_PROVIDER_u-boot-fw-utils = "libubootenv"
Now finally bake it. meta-swupdate-boards contains example for a few hardware. I was able to copy raspberrypi3 board implementation to support raspberrypi2 easily.
MACHINE=raspberrypi3 bitbake update-image
This should create core-image-full-cmdline-raspberrypi3.rpi-sdimg and update-image-raspberrypi3.swu files under build/tmp/deploy/image/raspberrypi3/.
Lets burn core-image-full-cmdline-raspberrypi3.rpi-sdimg image to sd card and use update-image-raspberrypi3.swu to update it.
Update to your flash using UI tool like Balena Etcher or via command line. Please note the target file system /dev/disk2 may be different.
sudo dd if=core-image-full-cmdline-raspberrypi3.rpi-sdimg of=/dev/disk2 bs=1m
Once the pi starts up, goto pi_ipaddress:8080. Drag and drop update-image-raspberrypi3.swu to update the firmware.

How to remove a newly installed kernel?

I just installed this kernel manually kernel-3.10.26. But I am not able to remove it as it's not getting listed with yum or rpm.
How do I remove this kernel permanently???
I followed the following steps for installing this kernel:
Untarred the tar.bz2 file downloaded from kernel.org
added a value to EXTRAVERSION = in the Makefile
make gconfig (to create the .config file)
make -j4
make modules_install
make install
reboot
OS Platform is Scientific Linux 6.5. I can boot into this kernel but I want to remove it now. How do I do it ?
Delete *3.10.26* from /boot. This is what got installed. Delete /lib/modules/*3.10.36* as well. This is what got modules_installed. Run update-grub afterwards.
Note: before deleting, do an echo with the paths that I gave you to make sure they correspond to a single kernel and that is the kernel you want.
These steps are generally work for me, first make sure you boot into the desired version of the kernel you would want to remove:
rm /boot/{config-,initrd.img-,System.map-,vmlinuz-}`uname -r`
rm -rf /lib/modules/`uname -r`
sudo update-grub
reboot - this should not reboot you back to the previous version of the kernel
This is what worked for me on Pop!_OS:
rm /lib/modules/<kernel-version>
cd /boot
mv vmlinuz.old vmlinuz
mv initrd.img.old initrd.img
sudo su
cd /boot/efi/EFI/Pop_OS-c505351a-07f6-4bcf-ab64-273c66fc0f5e
mv initrd-previous.img initrd.img
mv vmlinuz-previous.img vmlinuz.img
rm /boot/efi/loader/entries/Pop_OS-previous.conf

How to compile Clisp 2.46?

When I try to compile the newest version of Clisp on Ubuntu 8.04 I always get this error after running configure:
Configure findings:
FFI: no (user requested: default)
readline: yes (user requested: yes)
libsigsegv: no, consider installing GNU libsigsegv
./configure: libsigsegv was not detected, thus some features, such as
generational garbage collection and
stack overflow detection in interpreted Lisp code
cannot be provided.
Please do this:
mkdir tools; cd tools; prefix=`pwd`/i686-pc-linux-gnu
wget http://ftp.gnu.org/pub/gnu/libsigsegv/libsigsegv-2.5.tar.gz
tar xfz libsigsegv-2.5.tar.gz
cd libsigsegv-2.5
./configure --prefix=${prefix} && make && make check && make install
cd ../..
./configure --with-libsigsegv-prefix=${prefix} --with-readline --with-unicode --with-module=i18n --with-module=gdbm --with-module=pcre --with-module=readline --with-module=regexp
If you insist on building without libsigsegv, please pass
--ignore-absence-of-libsigsegv
to this script:
./configure --ignore-absence-of-libsigsegv --with-readline --with-unicode --with-module=i18n --with-module=gdbm --with-module=pcre --with-module=readline --with-module=regexp
I've tried doing as requested, but it didn't help: it seems to ignore the --with-libsigsegv-prefix option. I also tried putting installing libsigsegv in a standard location (/usr/local). Oh, and of course, Ubuntu tells me that libsigsegv and libsigsegv-dev are installed in the system.
I'd really like to be able to compile this version of Clips, as it introduces some serious improvements over the version shipped with Ubuntu (I'd also like to have PCRE).
Here are my notes from compiling CLISP on Ubuntu in the past, hope this helps:
sudo apt-get install libsigsegv-dev libreadline5-dev
# as of 7.10, Ubuntu's libffcall1-dev is broken and I had to get it from CVS
# and make sure CLISP didn't use Ubuntu's version.
sudo apt-get remove libffcall1-dev libffcall1
cvs -z3 -d:pserver:anonymous#cvs.sv.gnu.org:/sources/libffcall co -P ffcall
cd ffcall; ./configure; make
sudo make install
cvs -z3 -d:pserver:anonymous#clisp.cvs.sourceforge.net:/cvsroot/clisp co -P clisp
cd clisp
./configure --with-libffcall-prefix=/usr/local --prefix=/home/luis/Software
ulimit -s 16384
cd src; make install
If you look at 'config.log' it might tell you why configure is not finding libsigsegv

Resources