question

johnny-brusevold avatar image
johnny-brusevold asked

Kernel source for last Venus-os

@mvader (Victron Energy)

Is it possible to download venus-os kernel source 4.19.81-v7l somewhere ?

modifications
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

3 Answers
mvader (Victron Energy) avatar image
mvader (Victron Energy) answered ·

Hi @Johnny Brusevold , you mean the one we use for the RaspberryPis? Yes, that source is defined here:

https://github.com/victronenergy/meta-victronenergy/blob/master/meta-bsp/recipes-kernel/linux/linux-raspberrypi_4.19.bb

And, per the SRC_URI variable in that .bb file, that refers to here:

https://github.com/victronenergy/linux/tree/rpi_4.19.81

And then adds on patch on top, see .bb file for what I mean, ie the SRC_URI += etcetera line. File to be found by clicking back and forth a bit.


The rest of the GX devices is at 5.10.something. Defined here: https://github.com/victronenergy/meta-victronenergy/blob/master/meta-bsp/recipes-kernel/linux/linux-venus.bb, where refers to here:
https://github.com/victronenergy/linux/tree/venus-5.10.42..


If I find the peace and time someday, then my approach in getting the rpis to 5.10 would be to:

a) get the 5.10 branch from raspberrypi themselves. Rather than a standard 5.10 kernel I mean.

b) check our raspberrypi-4.19.81 branch for commits that need adding.

c) check out the above linked venus-5.10.42 branch for commits that need adding.

Build that, test it on the various rpis.

And if it works, have it in a repo, and then start working on the .bb file.



51 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Thank you for your answer @mvader (Victron Energy)

I downloaded the desired version and added some debug

instructions and compiled kernel to find usb issue.


I think it's in the 'old pci' driver that is causing the problem. But for me it is too much work to fix this on the venus kernel. There is a lot of difference in many of the drivers that are tied together.


So for now I go for the original raspberry pi kernel tree. with some of the patches from the venus kernel. I still have not had any problems, slowdown, high energy consumption after running 3 units in test for a few weeks now. This is only in demo mode and without net.


Today I moved one of the devices to live system, so I will see how it works when I now implement some more devices.

0 Likes 0 ·
Hi, thats exactly what I meant to say as well:

Rather than fixing 4.19 kernel, better prepare and switch to 5.10

0 Likes 0 ·
johnny-brusevold avatar image johnny-brusevold mvader (Victron Energy) ♦♦ ·

@mvader (Victron Energy)

I have now also compiled the kernel and tested it on pi 2 pi 3 and pi 3b + (replaced org kenel in venus os) and can only state that it works without any error messages either during compile or use of venus-os on raspberry pi.

I also found out late at night by a 'small' fault connection that a raspberry pi 4 does not handle 14.4 volts straight from a car battery ;)

0 Likes 0 ·
Sorry for the pi!
0 Likes 0 ·

Hi @Johnny Brusevold , which raspberrypi kernel are you using as a source?

and did you push your work somewhere?

0 Likes 0 ·
johnny-brusevold avatar image johnny-brusevold mvader (Victron Energy) ♦♦ ·

@mvader (Victron Energy)


I used this directly and added two patches locally


https://github.com/raspberrypi/linux

Patch 1

https://github.com/victronenergy/linux/commit/c65023cf4bbf86955c6c52bc72376e6fe32ad41c

Patch 2

https://github.com/victronenergy/linux/commit/fb01a308bf550ea244bcf2b465a01a0f19c6dd63

I have little experience with git, since the group I worked with some years ago used svn with a graphical interface.

0 Likes 0 ·
bathnm avatar image bathnm mvader (Victron Energy) ♦♦ ·

@mvader (Victron Energy) Hi there. I have a version compiling using the RPI branch rip-5.10.y, which is at .92. Not yet pushed to a git repository as not tested on an RPI 4, as still waiting for it to arrive. Pulled/merged with what I hope is the required additions from the Victron Venus-5.10.42 branch.

as per @Johnny Brusevold mine has been running for a few days on an RPI3 with no issues or problems.

My RPI3 boots OK. Have started modifying the recipe sources/meta-victronenergy/meta-bsp/recipes-kernel/linux/ in the hope of building a Venus image.

Happy to push it all to a repository so you can make a copy.



0 Likes 0 ·

@Bathnm

5.10.92-v7 is the version I have tested now on pi2 pi3b + and pi4b v1.4 8GB

seems to work very well

So I hope it becomes a standard in upcoming venus-os images

Not that it is so much work to change the kernel, but there are probably many in the future who will only have access to just buy pi4 v1.4. Tried to get some pi3b +, but all are sold out. Just got a pair of pi4 4GB now

0 Likes 0 ·
bathnm avatar image bathnm johnny-brusevold ·

@Johnny Brusevold I have a git repository for 5.10.y (created from Victrons Linux repository) which has all their additions, fixes, configuration updates etc. I have not been able to test on an RPI4 as I am still airings or one. Would there be any chance you can download and test?


https://github.com/nmbath/linux/tree/rpi-5.10.y

0 Likes 0 ·

Hi, @Bathnm

I know nothing about git without cloning a directory. So all patches I have done manually with the MELD program in ubuntu.

If you can explain to me how I clone the kernel with all the patches I am grateful.

I have tried to read the manual, but there are too many projects underway. Notice that things take longer to learn now that age sets in.

It's been 25 years since I did programming that there were essentially wifi drivers for the linux kernel with firmware.

0 Likes 0 ·
bathnm avatar image bathnm johnny-brusevold ·

@Johnny Brusevold

Hope you are good with the command line... So in a terminal

git clone -b rip-5.10.y https://github.com/nmbath/linux.git

This will clone the rpi-5.10.y branch with all the changes needed.

cd linux

make bcm2711_defconfig

make -j 4 kernel modules dtbs

hope that helps.

Regards

0 Likes 0 ·

@Bathnm


$git clone -b rip-5.10.y https://github.com/nmbath/linux.git

Cloning into 'linux'...

fatal: Remote branch rip-5.10.y not found in upstream origin

0 Likes 0 ·
bathnm avatar image bathnm johnny-brusevold ·
@Johnny Brusevold type... should be rpi-5.10.y rather rip-....
0 Likes 0 ·

@Bathnm


Has compiled the kernel, which went without any error messages.

kernel installed on Venus OS 2.82 (latest)


Just a quick test.

pi4.v1.4 boot clean

bluetooth log in and pin change works

Bluetooth works as it should

bluetooth sensors work

usb keyboard works

wifi 4G and 5G work


but no victron logo :)

0 Likes 0 ·
bathnm avatar image bathnm johnny-brusevold ·
Many thanks. Will look into that tomorrow.
0 Likes 0 ·

@Bathnm

Have posted this a couple of other places, so I can update you on this as well

After getting a lot of bluetooth error messages in message log the last few weeks, it escalated when I got 2 ruuvi tags, so I started looking for the error

set up a pi with only 2 ruuvi tags (nothing else)

Venus OS v2.82 (latest). Both sensors are located 50cm from pi.

Gets the same error message in log as with the older images. pi2 and pi3b+ stock venus-os kernel and pi4 from my kernel compile

Previous Venus OS (v2.82-5) run for 24 hours provides 1.5MB error log, as well as 54 grayed out ruuvi tags in bluetooth sensor list.

These are not existing sensors, because I have scanned for other sensors, and they do not exist. The range should not be a problem, since pi and the sensors are in the same room, but I can sit here in a building next to reading both sensors.

Have also tested with usb dongle and disabled internal bluetooth with the same result.

                              
  1. raspberrypi2 user.err kernel: [  522.738478] Bluetooth: hci0: Malicious advertising data. Stopping processing

the fix was a small bug in /net/bluetooth/hci_event.c

Patched your git version and tested, and error is gone

@@ -5920,6 +5920,11 @@ static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb)
 struct hci_ev_le_advertising_info *ev = ptr;
 s8 rssi;
 
+if (ptr > (void *)skb_tail_pointer(skb) - sizeof(*ev)) {
+bt_dev_err(hdev, "Malicious advertising data.");
+break;
+}
+
 if (ev->length <= HCI_MAX_AD_LENGTH &&
     ev->data + ev->length <= skb_tail_pointer(skb)) {
 rssi = ev->data[ev->length];
@@ -5931,11 +5936,6 @@ static void hci_le_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb)
 }
 
 ptr += sizeof(*ev) + ev->length + 1;
-
-if (ptr > (void *) skb_tail_pointer(skb) - sizeof(*ev)) {
-bt_dev_err(hdev, "Malicious advertising data. Stopping processing");
-break;
-}
 }
 
 hci_dev_unlock(hdev);
-- 


https://lore.kernel.org/linux-bluetooth/20211124201628.405647-1-brian.gix@intel.com/

0 Likes 0 ·
bathnm avatar image bathnm johnny-brusevold ·

@Johnny Brusevold, applied to the branch. Do a git pull and it should refresh. You can check it has with a "git log" and the top item should be

commit 85f0b6c3df6869be400e16e56e3871360ea07249 (HEAD -> rpi-5.10.y, rpi-5.10.y/rpi-5.10.y)

Author: Brian Gix <brian.gix@intel.com>

Date: Wed Nov 24 12:16:28 2021 -0800


Bluetooth: refactor malicious adv data check

commit 899663be5e75dc0174dc8bda0b5e6826edf0b29a upstream.

Check for out-of-bound read was being performed at the end of while

num_reports loop, and would fill journal with false positives. Added

check to beginning of loop processing so that it doesn't get checked

after ptr has been advanced.

Signed-off-by: Brian Gix <brian.gix@intel.com>

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>

Cc: syphyr <syphyr@gmail.com>

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


Thanks for catching. Time to plow through all the recent 5.10.y commits (36) and see if there is anything to be concerned about.

0 Likes 0 ·
Show more comments

@Bathnm I have the 2.82 large image from @Johnny Brusevold running on a Pi 4 v1.5 2Gbytes and have been usin with Node_RED. I have been trying to follow through this thread and have run into a problem. Having cloned I end up with:

make bcm2711_defconfig
 HOSTCC scripts/basic/fixdep
 HOSTCC scripts/kconfig/conf.o
 HOSTCC scripts/kconfig/confdata.o
 HOSTCC scripts/kconfig/expr.o
 LEX scripts/kconfig/lexer.lex.c
 YACC scripts/kconfig/parser.tab.[ch]
 HOSTCC scripts/kconfig/lexer.lex.o
 HOSTCC scripts/kconfig/parser.tab.o
 HOSTCC scripts/kconfig/preprocess.o
 HOSTCC scripts/kconfig/symbol.o
 HOSTCC scripts/kconfig/util.o
 HOSTLD scripts/kconfig/conf
***
*** Can't find default configuration "arch/x86/configs/bcm2711_defconfig"!
***
make[1]: *** [scripts/kconfig/Makefile:88: bcm2711_defconfig] Error 1
make: *** [Makefile:603: bcm2711_defconfig] Error 2

I have done a search and found a couple of versions of bcm2711_defconfig in linux/arch/arm/configs and linux/arch/arm64/configs which are different sizes. Any advice as it is a long time since I have done much with kernels?

0 Likes 0 ·
@pcurtis What are you trying to do? If your trying to build a kernel, you need to look for my branch on the Victron Linux git repository. What device are you building this on? You need to get the Venus SDK and ensure you set all the paths and environment based on the SDK. For the PI4, the config file is bcm2711_defconfig and if you look at the GIT hsiotlroy for it you will see various modification to support the VenusOS.


Please note other files such as the boot-files in the /u-boot directory might need updating.

0 Likes 0 ·

I was following your instructions above namely:

Hope you are good with the command line... So in a terminal

git clone -b rip-5.10.y https://github.com/nmbath/linux.git

This will clone the rpi-5.10.y branch with all the changes needed.

cd linux

make bcm2711_defconfig

make -j 4 kernel modules dtbs


I am building on a Linux Mint (Ubuntu/Debian flavour) machine (Linux version 5.4.0-99-generic (buildd@lgw01-amd64-007) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #112-Ubuntu SMP Thu Feb 3 13:50:55 UTC 2022 (Ubuntu 5.4.0-99.112-generic 5.4.162)) and was hoping to be able to eventually generate fresh kernels and images for the Venus large versions as @Johnny Brusevold only generated a standard image the last time and it seemed a sensible first step to follow through the path you are taking here.

Where do I find the Venus SDK if need it as have none of that set up? I did some patching of kernels a very long time ago and do not recall needing anything like that, just various standard build utilities .

There is absolutely no urgency as I have a working 3b+ system on the boat and only bought a Pi 4 as a backup for general development rather than risk my only working Pi 3 and I like to keep the brain alive!

My Pi 4 seems to be working fine under 2.82 large including Node-RED but has yet to meet the Victron devices on the boat. EDIT All the Victron Devices checked and working in Node-RED although some had to be set up a second time before they connected.

0 Likes 0 ·

@pcurtis

It will be much easier for you if you build the kernel from the raspberrypi tree, than from the venus-os tree, where you are required to have the venus-os build invirement installed, which also has some private libraries.

For now, you just need to patch smp.c for everything to work on venus-os on pi4.

So follow this thread,

https://www.raspberrypi.com/documentation/computers/linux_kernel.html

but note that not all files should be installed to the disks / folders listed here.

I have made a recipe for this somewhere else here in the forum, which also contains 1 error. (smp.c download) You can no longer use it directly.

0 Likes 0 ·
pcurtis avatar image pcurtis johnny-brusevold ·

@Johnny Brusevold Thank you, it has all become very much more clear and I have done most of the stages without any error messages short of the copy onto the SD card. I had gone part way before but until reading your recipe at https://community.victronenergy.com/comments/114287/view.html I did not have the correct packages for the cross-compiling.

One quick question. What does one start with as a system on the SD card into which you copy the new kernel and other files if one eventually wants a large system with Node-RED (like you produced for 2.82).

0 Likes 0 ·

@pcurtis

cut and past from my note book

the easy way. expand ext4 on target sd card to 1.2GB 
already monted in linux/mnt/ext4

cpio -iv < ./venus-swu-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-large-XX.swu
 
gzip -d venus-image-large-raspberrypi4.ext4.gz


sudo mkdir /mnt/virtual
sudo mount -o loop venus-image-large-raspberrypi4.ext4 /mnt/virtual
sudo rm -rf /mnt/virtual/boot/zImage*
sudo rm -rf /mnt/virtual/lib/modules/*
sudo cp -r /mnt/virtual/*  linux/mnt/ext4/

make image
sudo dd if=/dev/sdb of=venus-image-raspberrypi4v1.4-vX.XX_XX-Large.rootfs.img bs=1024 count=1627153
sudo pishrink.sh venus-image-raspberrypi4v1.4-vX.XX_XX-Large.rootfs.img
 
 gzip -k9 venus-image-raspberrypi4v1.4-vX.XX_XX.rootfs.img
0 Likes 0 ·
Show more comments

@mvader (Victron Energy) thanks for your reply to @Johnny Brusevold, I've been searching for the kernel source tree for the RPi and could not find it anywhere until I found the above.

One additional question: where can I find the *_defconfig files (bcmrpi_defconfig, bcm2709_defconfig, bcm2711_defconfig)?

Thanks in advance.

0 Likes 0 ·

@durval

You will find them in this folder

./linux/arch/arm/configs/


For Pi 2, Pi 3, Pi 3+, or Compute Module 3:
KERNEL=kernel7
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig


For Raspberry Pi 4:
KERNEL=kernel7l
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2711_defconfig
1 Like 1 ·
durval avatar image durval johnny-brusevold ·
Thanks for the clarification, @johnny-brusevold!
0 Likes 0 ·
bathnm avatar image
bathnm answered ·

@Johnny Brusevold, did you compile using a native armv7l or the Venus SDK? I have had to change the default RPI options file to have "# CONFIG_GCC_PLUGINS is not set". Without this I get compile errors.

2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

bathnm avatar image bathnm johnny-brusevold ·
Great. At least I know that the issue with plugins is likely the SDK.
0 Likes 0 ·
Rob Duthie avatar image
Rob Duthie answered ·

Testing your ver 2.82 on a raspi4 ver1.4 this version the lcd_rotate=x won't rotate like the old version 2.80.41 i have tested as well.

When i change the config txt file? I know the raspi4 uses a different video driver compared to the raspi3 model.

Most other things are going except for the analog ports under the IO page

not showing up. Just found out a missing iio folder in sys/bus/iio is not there like the older ver <2.41 which has the that folder for the analog tom work.

I have checked the dbus-adc.conf file is in place and which it is.

Regards

Rob D

NZ

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.