All of lore.kernel.org
 help / color / mirror / Atom feed
* J1939 kernel for Raspberry Pi
@ 2017-05-10 11:50 Paul Bongaerts
  2017-05-10 15:03 ` Patrick Menschel
  2017-05-11 19:29 ` Kurt Van Dijck
  0 siblings, 2 replies; 14+ messages in thread
From: Paul Bongaerts @ 2017-05-10 11:50 UTC (permalink / raw)
  To: linux-can

After struggling for the last 5 days i keep failing in building a
working custom  jessie lite based j1939 arm kernel. for a raspberrypi
(b.t.w. i'm certainly no expert on kernel building)

Tried  local and  crosscompiled builds with different setting

Goal is to build a kernel according to the Raspberrypi kernel building guide
https://www.raspberrypi.org/documentation/linux/kernel/building.md

And merge this with a J1939 kernel according to this elinux j1939 guide.
http://elinux.org/J1939

Because this takes several hours per build and over a day on the pi i
could use some help in the right direction



Br, Paul




Failed attempts summary :

Compile a working kernel with no j1939 support on rpi locally
(modprobe can-j1939 Fails)
Crosscompile unbootable kernels with j1939 support on ubuntu (Fails to boot)


#########################################################################
Native compile
rapsberry pi zero w    16 GB SD Card
#########################################################################


Setup the build environment

sudo apt-get install git bc
git clone --depth=1 https://github.com/raspberrypi/linux
cd linux
    git remote add j1939 git://github.com/kurt-vd/linux
    git remote update j1939 |& tee -a ~/j1939update.log


Merge j1939-v4.7 with rpi-master takes several hours

    git merge j1939/j1939d-v4.7 |& tee -a ~/j1939merge.log
    (jessie image uses uname -r 4.9.24+  so 4.7 is closest lower version)

cd ~/linux
KERNEL=kernel
make bcmrpi_defconfig

Build the kernel, modules and devicetree overlays.  time ~ 24h

make zImage modules dtbs

Install the modules

sudo make modules_install

Copy the files to the right locations

sudo cp arch/arm/boot/dts/*.dtb /boot/
sudo cp arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/
sudo cp arch/arm/boot/dts/overlays/README /boot/overlays/
sudo cp arch/arm/boot/zImage /boot/$KERNEL.img
sudo reboot
sudo modprobe can-j1939
modprobe: FATAL: Module can-j1939 not found.


#########################################################################
Crosscompile j1939-v4.7 > rpi kernel
ubuntu-16.04.2-server-amd64.iso
#########################################################################

cd /usr/src

Get crosscompile Toolchain

git clone git://github.com/raspberrypi/tools.git --depth=1

Get j1939-v4.7 branch kernel sources

git clone -b j1939d-v4.7 git://github.com/kurt-vd/linux --depth=1

cd /usr/src/linux

export PATH

export PATH=$PATH:/usr/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin

Clean the kernel source

make mrproper



Now login to a running rpi (Clean raspbian-jessie-lite, uname -a r 4.9.24+ )

Create config.gz

pi@raspberrypi:~ $ sudo modprobe configs

Copy the config.gz to build server

pi@raspberrypi:~ $ scp /proc/config.gz user@server.local:/usr/src/linux



Back on Server

gunzip -c config.gz > .config

Set kernel varialble

KERNEL=kernel


Build Kernel Image, Modules and Devicetreeoverlays (select: SAE J1939
as module, debug SAE J1939 yes, CAN_IFI_CANFD as module)

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs


copy files to SD according to raspberry's kernelbuildingguide and boot
(fails to boot)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: J1939 kernel for Raspberry Pi
  2017-05-10 11:50 J1939 kernel for Raspberry Pi Paul Bongaerts
@ 2017-05-10 15:03 ` Patrick Menschel
  2017-05-11 19:29 ` Kurt Van Dijck
  1 sibling, 0 replies; 14+ messages in thread
From: Patrick Menschel @ 2017-05-10 15:03 UTC (permalink / raw)
  To: Paul Bongaerts; +Cc: linux-can

[-- Attachment #1: Type: text/plain, Size: 4024 bytes --]

Hello Paul,

just for the record, socketcan itself works on your pi, yes?

Further question would be if the file can-j1939.ko really is in the
modules folder.

If yes, my first try would be "depmod -A" . See if the module is found then.

Regards,

Patrick


Am 10.05.2017 um 13:50 schrieb Paul Bongaerts:
> After struggling for the last 5 days i keep failing in building a
> working custom  jessie lite based j1939 arm kernel. for a raspberrypi
> (b.t.w. i'm certainly no expert on kernel building)
>
> Tried  local and  crosscompiled builds with different setting
>
> Goal is to build a kernel according to the Raspberrypi kernel building guide
> https://www.raspberrypi.org/documentation/linux/kernel/building.md
>
> And merge this with a J1939 kernel according to this elinux j1939 guide.
> http://elinux.org/J1939
>
> Because this takes several hours per build and over a day on the pi i
> could use some help in the right direction
>
>
>
> Br, Paul
>
>
>
>
> Failed attempts summary :
>
> Compile a working kernel with no j1939 support on rpi locally
> (modprobe can-j1939 Fails)
> Crosscompile unbootable kernels with j1939 support on ubuntu (Fails to boot)
>
>
> #########################################################################
> Native compile
> rapsberry pi zero w    16 GB SD Card
> #########################################################################
>
>
> Setup the build environment
>
> sudo apt-get install git bc
> git clone --depth=1 https://github.com/raspberrypi/linux
> cd linux
>     git remote add j1939 git://github.com/kurt-vd/linux
>     git remote update j1939 |& tee -a ~/j1939update.log
>
>
> Merge j1939-v4.7 with rpi-master takes several hours
>
>     git merge j1939/j1939d-v4.7 |& tee -a ~/j1939merge.log
>     (jessie image uses uname -r 4.9.24+  so 4.7 is closest lower version)
>
> cd ~/linux
> KERNEL=kernel
> make bcmrpi_defconfig
>
> Build the kernel, modules and devicetree overlays.  time ~ 24h
>
> make zImage modules dtbs
>
> Install the modules
>
> sudo make modules_install
>
> Copy the files to the right locations
>
> sudo cp arch/arm/boot/dts/*.dtb /boot/
> sudo cp arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/
> sudo cp arch/arm/boot/dts/overlays/README /boot/overlays/
> sudo cp arch/arm/boot/zImage /boot/$KERNEL.img
> sudo reboot
> sudo modprobe can-j1939
> modprobe: FATAL: Module can-j1939 not found.
>
>
> #########################################################################
> Crosscompile j1939-v4.7 > rpi kernel
> ubuntu-16.04.2-server-amd64.iso
> #########################################################################
>
> cd /usr/src
>
> Get crosscompile Toolchain
>
> git clone git://github.com/raspberrypi/tools.git --depth=1
>
> Get j1939-v4.7 branch kernel sources
>
> git clone -b j1939d-v4.7 git://github.com/kurt-vd/linux --depth=1
>
> cd /usr/src/linux
>
> export PATH
>
> export PATH=$PATH:/usr/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
>
> Clean the kernel source
>
> make mrproper
>
>
>
> Now login to a running rpi (Clean raspbian-jessie-lite, uname -a r 4.9.24+ )
>
> Create config.gz
>
> pi@raspberrypi:~ $ sudo modprobe configs
>
> Copy the config.gz to build server
>
> pi@raspberrypi:~ $ scp /proc/config.gz user@server.local:/usr/src/linux
>
>
>
> Back on Server
>
> gunzip -c config.gz > .config
>
> Set kernel varialble
>
> KERNEL=kernel
>
>
> Build Kernel Image, Modules and Devicetreeoverlays (select: SAE J1939
> as module, debug SAE J1939 yes, CAN_IFI_CANFD as module)
>
> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs
>
>
> copy files to SD according to raspberry's kernelbuildingguide and boot
> (fails to boot)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-can" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3709 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: J1939 kernel for Raspberry Pi
  2017-05-10 11:50 J1939 kernel for Raspberry Pi Paul Bongaerts
  2017-05-10 15:03 ` Patrick Menschel
@ 2017-05-11 19:29 ` Kurt Van Dijck
  2017-05-14 17:57   ` Paul Bongaerts
  1 sibling, 1 reply; 14+ messages in thread
From: Kurt Van Dijck @ 2017-05-11 19:29 UTC (permalink / raw)
  To: Paul Bongaerts; +Cc: linux-can

> Because this takes several hours per build and over a day on the pi i
> could use some help in the right direction

My principle is that I need indeed to decrease the
'modify-build-reload' time before problems get solved.

> Merge j1939-v4.7 with rpi-master takes several hours

restrict yourself to cross-compile then. git merge should take 1.2.3
seconds. A minute at most.

See my further comments inline below:

--- Original message ---
> Date:   Wed, 10 May 2017 13:50:25 +0200
> From: Paul Bongaerts <pauluzs@gmail.com>
> To: linux-can@vger.kernel.org
> Subject: J1939 kernel for Raspberry Pi
> 
> After struggling for the last 5 days i keep failing in building a
> working custom  jessie lite based j1939 arm kernel. for a raspberrypi
> (b.t.w. i'm certainly no expert on kernel building)
> 
> Tried  local and  crosscompiled builds with different setting
> 
> Goal is to build a kernel according to the Raspberrypi kernel building guide
> https://www.raspberrypi.org/documentation/linux/kernel/building.md
> 
> And merge this with a J1939 kernel according to this elinux j1939 guide.
> http://elinux.org/J1939
> 
> Because this takes several hours per build and over a day on the pi i
> could use some help in the right direction
> 
> 
> 
> Br, Paul
> 
> 
> 
> 
> Failed attempts summary :
> 
> Compile a working kernel with no j1939 support on rpi locally
> (modprobe can-j1939 Fails)
> Crosscompile unbootable kernels with j1939 support on ubuntu (Fails to boot)
> 
> 
> #########################################################################
> Native compile
> rapsberry pi zero w    16 GB SD Card
> #########################################################################

I stripped the native compile, it takes too much time, but should not be
different.

> #########################################################################
> Crosscompile j1939-v4.7 > rpi kernel
> ubuntu-16.04.2-server-amd64.iso
> #########################################################################
> 
> cd /usr/src
> 
> Get crosscompile Toolchain
> 
> git clone git://github.com/raspberrypi/tools.git --depth=1
> 
> Get j1939-v4.7 branch kernel sources
> 
> git clone -b j1939d-v4.7 git://github.com/kurt-vd/linux --depth=1

(1) You should not clone 2 repo's, but use remotes
(2) using '--depth=1' ignores history, but you will need the history for
the merge. 'git clone' takes time once, spending it enables you to
benefit of the git features.

> 
> cd /usr/src/linux
> 
> export PATH
> 
> export PATH=$PATH:/usr/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
> 
> Clean the kernel source
> 
> make mrproper
> 
> 
> 
> Now login to a running rpi (Clean raspbian-jessie-lite, uname -a r 4.9.24+ )
> 
> Create config.gz
> 
> pi@raspberrypi:~ $ sudo modprobe configs
> 
> Copy the config.gz to build server
> 
> pi@raspberrypi:~ $ scp /proc/config.gz user@server.local:/usr/src/linux
> 
> 
> 
> Back on Server
> 
> gunzip -c config.gz > .config
> 
> Set kernel varialble
> 
> KERNEL=kernel
> 
> 
> Build Kernel Image, Modules and Devicetreeoverlays (select: SAE J1939
> as module, debug SAE J1939 yes, CAN_IFI_CANFD as module)
> 
> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs
> 
> 
> copy files to SD according to raspberry's kernelbuildingguide and boot
> (fails to boot)

Which files did you copy?

I suspect you should make a (temporary) directory where you install
kernel & modules to. That directory is to be copies recursively to the
RPI.

Kind regards,
Kurt

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: J1939 kernel for Raspberry Pi
  2017-05-11 19:29 ` Kurt Van Dijck
@ 2017-05-14 17:57   ` Paul Bongaerts
  2017-05-14 22:30     ` Paul Bongaerts
  0 siblings, 1 reply; 14+ messages in thread
From: Paul Bongaerts @ 2017-05-14 17:57 UTC (permalink / raw)
  To: Paul Bongaerts, linux-can

Hi Kurt

Found some tiime to look into this again,

Just to be sure:

>> git clone -b j1939d-v4.7 git://github.com/kurt-vd/linux --depth=1

>(1) You should not clone 2 repo's, but use remotes
>(2) using '--depth=1' ignores history, but you will need the history for
>the merge. 'git clone' takes time once, spending it enables you to
>benefit of the git features.

(1) Should I clone the kernel repo and and remote add your repo or
remote add both?
(2) Because that history do i clone/add the whole repo or would just
using the 4.9 kernel branch and your 4.7 branch be sufficient?

>>
>> cd /usr/src/linux


......

>Which files did you copy?

Copy the files to the right locations:

sudo cp arch/arm/boot/dts/*.dtb /boot/
sudo cp arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/
sudo cp arch/arm/boot/dts/overlays/README /boot/overlays/
sudo cp arch/arm/boot/zImage /boot/$KERNEL.img

Btw the can hardware to answer patricks question:

> just for the record, socketcan itself works on your pi, yes?

Yes the hardware and socketcan are working candump and cansend work
like they should

Br Paul

2017-05-11 21:29 GMT+02:00 Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>:
>> Because this takes several hours per build and over a day on the pi i
>> could use some help in the right direction
>
> My principle is that I need indeed to decrease the
> 'modify-build-reload' time before problems get solved.
>
>> Merge j1939-v4.7 with rpi-master takes several hours
>
> restrict yourself to cross-compile then. git merge should take 1.2.3
> seconds. A minute at most.
>
> See my further comments inline below:
>
> --- Original message ---
>> Date:   Wed, 10 May 2017 13:50:25 +0200
>> From: Paul Bongaerts <pauluzs@gmail.com>
>> To: linux-can@vger.kernel.org
>> Subject: J1939 kernel for Raspberry Pi
>>
>> After struggling for the last 5 days i keep failing in building a
>> working custom  jessie lite based j1939 arm kernel. for a raspberrypi
>> (b.t.w. i'm certainly no expert on kernel building)
>>
>> Tried  local and  crosscompiled builds with different setting
>>
>> Goal is to build a kernel according to the Raspberrypi kernel building guide
>> https://www.raspberrypi.org/documentation/linux/kernel/building.md
>>
>> And merge this with a J1939 kernel according to this elinux j1939 guide.
>> http://elinux.org/J1939
>>
>> Because this takes several hours per build and over a day on the pi i
>> could use some help in the right direction
>>
>>
>>
>> Br, Paul
>>
>>
>>
>>
>> Failed attempts summary :
>>
>> Compile a working kernel with no j1939 support on rpi locally
>> (modprobe can-j1939 Fails)
>> Crosscompile unbootable kernels with j1939 support on ubuntu (Fails to boot)
>>
>>
>> #########################################################################
>> Native compile
>> rapsberry pi zero w    16 GB SD Card
>> #########################################################################
>
> I stripped the native compile, it takes too much time, but should not be
> different.
>
>> #########################################################################
>> Crosscompile j1939-v4.7 > rpi kernel
>> ubuntu-16.04.2-server-amd64.iso
>> #########################################################################
>>
>> cd /usr/src
>>
>> Get crosscompile Toolchain
>>
>> git clone git://github.com/raspberrypi/tools.git --depth=1
>>
>> Get j1939-v4.7 branch kernel sources
>>
>> git clone -b j1939d-v4.7 git://github.com/kurt-vd/linux --depth=1
>
> (1) You should not clone 2 repo's, but use remotes
> (2) using '--depth=1' ignores history, but you will need the history for
> the merge. 'git clone' takes time once, spending it enables you to
> benefit of the git features.
>
>>
>> cd /usr/src/linux
>>
>> export PATH
>>
>> export PATH=$PATH:/usr/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
>>
>> Clean the kernel source
>>
>> make mrproper
>>
>>
>>
>> Now login to a running rpi (Clean raspbian-jessie-lite, uname -a r 4.9.24+ )
>>
>> Create config.gz
>>
>> pi@raspberrypi:~ $ sudo modprobe configs
>>
>> Copy the config.gz to build server
>>
>> pi@raspberrypi:~ $ scp /proc/config.gz user@server.local:/usr/src/linux
>>
>>
>>
>> Back on Server
>>
>> gunzip -c config.gz > .config
>>
>> Set kernel varialble
>>
>> KERNEL=kernel
>>
>>
>> Build Kernel Image, Modules and Devicetreeoverlays (select: SAE J1939
>> as module, debug SAE J1939 yes, CAN_IFI_CANFD as module)
>>
>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs
>>
>>
>> copy files to SD according to raspberry's kernelbuildingguide and boot
>> (fails to boot)
>
> Which files did you copy?
>
> I suspect you should make a (temporary) directory where you install
> kernel & modules to. That directory is to be copies recursively to the
> RPI.
>
> Kind regards,
> Kurt

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: J1939 kernel for Raspberry Pi
  2017-05-14 17:57   ` Paul Bongaerts
@ 2017-05-14 22:30     ` Paul Bongaerts
  2017-05-15  7:14       ` Kurt Van Dijck
  0 siblings, 1 reply; 14+ messages in thread
From: Paul Bongaerts @ 2017-05-14 22:30 UTC (permalink / raw)
  To: Paul Bongaerts, linux-can

Still getting a error when trying to cross compile



Go into src dir

cd /usr/src

Get crosscompile Toolchain

git clone git://github.com/raspberrypi/tools.git

Next get raspberry sources

git clone git://github.com/raspberrypi/linux.git

Go into linux dir

cd /usr/src/linux

Remote add the j1939 sources

git remote add j1939 git://github.com/kurt-vd/linux

Update j1939 remote

git remote update j1939

Merge j1939-v4.7 with rpi-master

    git merge j1939/j1939d-v4.7
    (Rpi jessie image uses uname -r 4.9.24+  so 4.7 is closest lower
J1939 version)

export crosscompile toolchain path

To build on 32 bit system
export PATH=$PATH:/usr/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin
To build on 64 bits system
export PATH=$PATH:/usr/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin

Clean the kernel source

make mrproper

Set kernel type

For Rapberry Pi 1/compute/zero (w)
KERNEL=kernel
For Raspberry Pi 2/3
KERNEL=kernel7

Use default config

For Rapberry Pi 1/compute/zero(w)
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig
For Raspberry Pi 2/3
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig

Enable j1939 can kernel modeles

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig

Go into Networking Support Select SAE J1939 as module, enable debug.
Go into CAN Device Drivers and select your device drivers

<M>   CAN bus subsystem support  --->
--- CAN bus subsystem support
<M>   Raw CAN Protocol (raw access with CAN-ID filtering)
<M>   Broadcast Manager CAN Protocol (with content filtering)
<M>   CAN Gateway/Router (with netlink configuration)
<M>   SAE J1939
[*]     debug SAE J1939
CAN Device Drivers  --->

Exit menuconfig and save the config

Build Kernel Image, Modules and Devicetreeoverlays

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtb

  ......
  CC [M]  net/bridge/br_netfilter_hooks.o
  CC [M]  net/bridge/br_netfilter_ipv6.o
  LD [M]  net/bridge/br_netfilter.o
  LD      net/can/built-in.o
  CC [M]  net/can/af_can.o
  CC [M]  net/can/proc.o
  LD [M]  net/can/can.o
  CC [M]  net/can/raw.o
  LD [M]  net/can/can-raw.o
  CC [M]  net/can/bcm.o
  LD [M]  net/can/can-bcm.o
  CC [M]  net/can/gw.o
  LD [M]  net/can/can-gw.o
  LD      net/can/j1939/built-in.o
  CC [M]  net/can/j1939/address-claim.o
  CC [M]  net/can/j1939/bus.o
  CC [M]  net/can/j1939/main.o
net/can/j1939/main.c: In function ‘j1939_netdev_start’:
net/can/j1939/main.c:238:10: error: too few arguments to function
‘can_rx_register’
          j1939_can_recv, priv, "j1939");
          ^
In file included from net/can/j1939/main.c:25:0:
./include/linux/can/core.h:57:5: note: declared here
 int can_rx_register(struct net_device *dev, canid_t can_id, canid_t mask,
     ^
scripts/Makefile.build:293: recipe for target 'net/can/j1939/main.o' failed
make[3]: *** [net/can/j1939/main.o] Error 1
scripts/Makefile.build:544: recipe for target 'net/can/j1939' failed
make[2]: *** [net/can/j1939] Error 2
scripts/Makefile.build:544: recipe for target 'net/can' failed
make[1]: *** [net/can] Error 2
Makefile:988: recipe for target 'net' failed
make: *** [net] Error 2
user@jessie:/usr/src/linux$


2017-05-14 19:57 GMT+02:00 Paul Bongaerts <pauluzs@gmail.com>:
> Hi Kurt
>
> Found some tiime to look into this again,
>
> Just to be sure:
>
>>> git clone -b j1939d-v4.7 git://github.com/kurt-vd/linux --depth=1
>
>>(1) You should not clone 2 repo's, but use remotes
>>(2) using '--depth=1' ignores history, but you will need the history for
>>the merge. 'git clone' takes time once, spending it enables you to
>>benefit of the git features.
>
> (1) Should I clone the kernel repo and and remote add your repo or
> remote add both?
> (2) Because that history do i clone/add the whole repo or would just
> using the 4.9 kernel branch and your 4.7 branch be sufficient?
>
>>>
>>> cd /usr/src/linux
>
>
> ......
>
>>Which files did you copy?
>
> Copy the files to the right locations:
>
> sudo cp arch/arm/boot/dts/*.dtb /boot/
> sudo cp arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/
> sudo cp arch/arm/boot/dts/overlays/README /boot/overlays/
> sudo cp arch/arm/boot/zImage /boot/$KERNEL.img
>
> Btw the can hardware to answer patricks question:
>
>> just for the record, socketcan itself works on your pi, yes?
>
> Yes the hardware and socketcan are working candump and cansend work
> like they should
>
> Br Paul
>
> 2017-05-11 21:29 GMT+02:00 Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>:
>>> Because this takes several hours per build and over a day on the pi i
>>> could use some help in the right direction
>>
>> My principle is that I need indeed to decrease the
>> 'modify-build-reload' time before problems get solved.
>>
>>> Merge j1939-v4.7 with rpi-master takes several hours
>>
>> restrict yourself to cross-compile then. git merge should take 1.2.3
>> seconds. A minute at most.
>>
>> See my further comments inline below:
>>
>> --- Original message ---
>>> Date:   Wed, 10 May 2017 13:50:25 +0200
>>> From: Paul Bongaerts <pauluzs@gmail.com>
>>> To: linux-can@vger.kernel.org
>>> Subject: J1939 kernel for Raspberry Pi
>>>
>>> After struggling for the last 5 days i keep failing in building a
>>> working custom  jessie lite based j1939 arm kernel. for a raspberrypi
>>> (b.t.w. i'm certainly no expert on kernel building)
>>>
>>> Tried  local and  crosscompiled builds with different setting
>>>
>>> Goal is to build a kernel according to the Raspberrypi kernel building guide
>>> https://www.raspberrypi.org/documentation/linux/kernel/building.md
>>>
>>> And merge this with a J1939 kernel according to this elinux j1939 guide.
>>> http://elinux.org/J1939
>>>
>>> Because this takes several hours per build and over a day on the pi i
>>> could use some help in the right direction
>>>
>>>
>>>
>>> Br, Paul
>>>
>>>
>>>
>>>
>>> Failed attempts summary :
>>>
>>> Compile a working kernel with no j1939 support on rpi locally
>>> (modprobe can-j1939 Fails)
>>> Crosscompile unbootable kernels with j1939 support on ubuntu (Fails to boot)
>>>
>>>
>>> #########################################################################
>>> Native compile
>>> rapsberry pi zero w    16 GB SD Card
>>> #########################################################################
>>
>> I stripped the native compile, it takes too much time, but should not be
>> different.
>>
>>> #########################################################################
>>> Crosscompile j1939-v4.7 > rpi kernel
>>> ubuntu-16.04.2-server-amd64.iso
>>> #########################################################################
>>>
>>> cd /usr/src
>>>
>>> Get crosscompile Toolchain
>>>
>>> git clone git://github.com/raspberrypi/tools.git --depth=1
>>>
>>> Get j1939-v4.7 branch kernel sources
>>>
>>> git clone -b j1939d-v4.7 git://github.com/kurt-vd/linux --depth=1
>>
>> (1) You should not clone 2 repo's, but use remotes
>> (2) using '--depth=1' ignores history, but you will need the history for
>> the merge. 'git clone' takes time once, spending it enables you to
>> benefit of the git features.
>>
>>>
>>> cd /usr/src/linux
>>>
>>> export PATH
>>>
>>> export PATH=$PATH:/usr/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
>>>
>>> Clean the kernel source
>>>
>>> make mrproper
>>>
>>>
>>>
>>> Now login to a running rpi (Clean raspbian-jessie-lite, uname -a r 4.9.24+ )
>>>
>>> Create config.gz
>>>
>>> pi@raspberrypi:~ $ sudo modprobe configs
>>>
>>> Copy the config.gz to build server
>>>
>>> pi@raspberrypi:~ $ scp /proc/config.gz user@server.local:/usr/src/linux
>>>
>>>
>>>
>>> Back on Server
>>>
>>> gunzip -c config.gz > .config
>>>
>>> Set kernel varialble
>>>
>>> KERNEL=kernel
>>>
>>>
>>> Build Kernel Image, Modules and Devicetreeoverlays (select: SAE J1939
>>> as module, debug SAE J1939 yes, CAN_IFI_CANFD as module)
>>>
>>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs
>>>
>>>
>>> copy files to SD according to raspberry's kernelbuildingguide and boot
>>> (fails to boot)
>>
>> Which files did you copy?
>>
>> I suspect you should make a (temporary) directory where you install
>> kernel & modules to. That directory is to be copies recursively to the
>> RPI.
>>
>> Kind regards,
>> Kurt

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: J1939 kernel for Raspberry Pi
  2017-05-14 22:30     ` Paul Bongaerts
@ 2017-05-15  7:14       ` Kurt Van Dijck
  2017-05-15 10:50         ` Paul Bongaerts
  0 siblings, 1 reply; 14+ messages in thread
From: Kurt Van Dijck @ 2017-05-15  7:14 UTC (permalink / raw)
  To: Paul Bongaerts; +Cc: linux-can

Hey,

I was just looking your previous email, but I see here below that you
all got it right.
> 
> Still getting a error when trying to cross compile
> 
> 
> 
> Go into src dir
> 
> cd /usr/src
> 
> Get crosscompile Toolchain
> 
> git clone git://github.com/raspberrypi/tools.git
> 
> Next get raspberry sources
> 
> git clone git://github.com/raspberrypi/linux.git
> 
> Go into linux dir
> 
> cd /usr/src/linux
> 
> Remote add the j1939 sources
> 
> git remote add j1939 git://github.com/kurt-vd/linux
> 
> Update j1939 remote
> 
> git remote update j1939
> 
> Merge j1939-v4.7 with rpi-master
> 
>     git merge j1939/j1939d-v4.7
>     (Rpi jessie image uses uname -r 4.9.24+  so 4.7 is closest lower
> J1939 version)
> 
> export crosscompile toolchain path
> 
> To build on 32 bit system
> export PATH=$PATH:/usr/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin
> To build on 64 bits system
> export PATH=$PATH:/usr/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
> 
> Clean the kernel source
> 
> make mrproper
> 
> Set kernel type
> 
> For Rapberry Pi 1/compute/zero (w)
> KERNEL=kernel
> For Raspberry Pi 2/3
> KERNEL=kernel7
> 
> Use default config
> 
> For Rapberry Pi 1/compute/zero(w)
> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig
> For Raspberry Pi 2/3
> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
> 
> Enable j1939 can kernel modeles
> 
> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
> 
> Go into Networking Support Select SAE J1939 as module, enable debug.
> Go into CAN Device Drivers and select your device drivers
> 
> <M>   CAN bus subsystem support  --->
> --- CAN bus subsystem support
> <M>   Raw CAN Protocol (raw access with CAN-ID filtering)
> <M>   Broadcast Manager CAN Protocol (with content filtering)
> <M>   CAN Gateway/Router (with netlink configuration)
> <M>   SAE J1939
> [*]     debug SAE J1939
> CAN Device Drivers  --->
> 
> Exit menuconfig and save the config
> 
> Build Kernel Image, Modules and Devicetreeoverlays
> 
> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtb
> 
>   ......
>   CC [M]  net/bridge/br_netfilter_hooks.o
>   CC [M]  net/bridge/br_netfilter_ipv6.o
>   LD [M]  net/bridge/br_netfilter.o
>   LD      net/can/built-in.o
>   CC [M]  net/can/af_can.o
>   CC [M]  net/can/proc.o
>   LD [M]  net/can/can.o
>   CC [M]  net/can/raw.o
>   LD [M]  net/can/can-raw.o
>   CC [M]  net/can/bcm.o
>   LD [M]  net/can/can-bcm.o
>   CC [M]  net/can/gw.o
>   LD [M]  net/can/can-gw.o
>   LD      net/can/j1939/built-in.o
>   CC [M]  net/can/j1939/address-claim.o
>   CC [M]  net/can/j1939/bus.o
>   CC [M]  net/can/j1939/main.o
> net/can/j1939/main.c: In function ‘j1939_netdev_start’:
> net/can/j1939/main.c:238:10: error: too few arguments to function
> ‘can_rx_register’
>           j1939_can_recv, priv, "j1939");
>           ^
> In file included from net/can/j1939/main.c:25:0:
> ./include/linux/can/core.h:57:5: note: declared here
>  int can_rx_register(struct net_device *dev, canid_t can_id, canid_t mask,
>      ^
> scripts/Makefile.build:293: recipe for target 'net/can/j1939/main.o' failed

This is a code problem, not a git problem.
Between 4.7 & 4.9, can_rx_register may have changed prototype.
You didn't do anything wrong.
I'll have to prepare a 4.9 branch with a small fix ...

> make[3]: *** [net/can/j1939/main.o] Error 1
> scripts/Makefile.build:544: recipe for target 'net/can/j1939' failed
> make[2]: *** [net/can/j1939] Error 2
> scripts/Makefile.build:544: recipe for target 'net/can' failed
> make[1]: *** [net/can] Error 2
> Makefile:988: recipe for target 'net' failed
> make: *** [net] Error 2
> user@jessie:/usr/src/linux$

To continue in between, when you don't add j1939 to the kernel, are you
able to boot you own kernel? You can grab the version with 'uname -a'.

Kurt

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: J1939 kernel for Raspberry Pi
  2017-05-15  7:14       ` Kurt Van Dijck
@ 2017-05-15 10:50         ` Paul Bongaerts
  2017-05-15 10:53           ` Paul Bongaerts
  0 siblings, 1 reply; 14+ messages in thread
From: Paul Bongaerts @ 2017-05-15 10:50 UTC (permalink / raw)
  To: Paul Bongaerts, linux-can

Hi,

I'll wait for your 4.9 fix.

My own kernel is 4.9.24. only without the J1939
That's what the question about branching was about.

Is it possible to use the 4.7 branch?
Like :
git clone git://github.com/raspberrypi/linux/tree/rpi-4.7.y
Or:
git clone -b rpi-4.7.y git://github.com/raspberrypi/linux

Instead of :
git clone git://github.com/raspberrypi/linux.git

Or does this mess up the history as well?

Same goes for adding your remote
would just the 4.7 branch be enough?
Like:
git clone -b j1939d-v4.7 git://github.com/kurt-vd/linux
Or does this mess up the history as well?

2017-05-15 9:14 GMT+02:00 Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>:
> Hey,
>
> I was just looking your previous email, but I see here below that you
> all got it right.
>>
>> Still getting a error when trying to cross compile
>>
>>
>>
>> Go into src dir
>>
>> cd /usr/src
>>
>> Get crosscompile Toolchain
>>
>> git clone git://github.com/raspberrypi/tools.git
>>
>> Next get raspberry sources
>>
>> git clone git://github.com/raspberrypi/linux.git
>>
>> Go into linux dir
>>
>> cd /usr/src/linux
>>
>> Remote add the j1939 sources
>>
>> git remote add j1939 git://github.com/kurt-vd/linux
>>
>> Update j1939 remote
>>
>> git remote update j1939
>>
>> Merge j1939-v4.7 with rpi-master
>>
>>     git merge j1939/j1939d-v4.7
>>     (Rpi jessie image uses uname -r 4.9.24+  so 4.7 is closest lower
>> J1939 version)
>>
>> export crosscompile toolchain path
>>
>> To build on 32 bit system
>> export PATH=$PATH:/usr/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin
>> To build on 64 bits system
>> export PATH=$PATH:/usr/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
>>
>> Clean the kernel source
>>
>> make mrproper
>>
>> Set kernel type
>>
>> For Rapberry Pi 1/compute/zero (w)
>> KERNEL=kernel
>> For Raspberry Pi 2/3
>> KERNEL=kernel7
>>
>> Use default config
>>
>> For Rapberry Pi 1/compute/zero(w)
>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig
>> For Raspberry Pi 2/3
>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
>>
>> Enable j1939 can kernel modeles
>>
>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
>>
>> Go into Networking Support Select SAE J1939 as module, enable debug.
>> Go into CAN Device Drivers and select your device drivers
>>
>> <M>   CAN bus subsystem support  --->
>> --- CAN bus subsystem support
>> <M>   Raw CAN Protocol (raw access with CAN-ID filtering)
>> <M>   Broadcast Manager CAN Protocol (with content filtering)
>> <M>   CAN Gateway/Router (with netlink configuration)
>> <M>   SAE J1939
>> [*]     debug SAE J1939
>> CAN Device Drivers  --->
>>
>> Exit menuconfig and save the config
>>
>> Build Kernel Image, Modules and Devicetreeoverlays
>>
>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtb
>>
>>   ......
>>   CC [M]  net/bridge/br_netfilter_hooks.o
>>   CC [M]  net/bridge/br_netfilter_ipv6.o
>>   LD [M]  net/bridge/br_netfilter.o
>>   LD      net/can/built-in.o
>>   CC [M]  net/can/af_can.o
>>   CC [M]  net/can/proc.o
>>   LD [M]  net/can/can.o
>>   CC [M]  net/can/raw.o
>>   LD [M]  net/can/can-raw.o
>>   CC [M]  net/can/bcm.o
>>   LD [M]  net/can/can-bcm.o
>>   CC [M]  net/can/gw.o
>>   LD [M]  net/can/can-gw.o
>>   LD      net/can/j1939/built-in.o
>>   CC [M]  net/can/j1939/address-claim.o
>>   CC [M]  net/can/j1939/bus.o
>>   CC [M]  net/can/j1939/main.o
>> net/can/j1939/main.c: In function ‘j1939_netdev_start’:
>> net/can/j1939/main.c:238:10: error: too few arguments to function
>> ‘can_rx_register’
>>           j1939_can_recv, priv, "j1939");
>>           ^
>> In file included from net/can/j1939/main.c:25:0:
>> ./include/linux/can/core.h:57:5: note: declared here
>>  int can_rx_register(struct net_device *dev, canid_t can_id, canid_t mask,
>>      ^
>> scripts/Makefile.build:293: recipe for target 'net/can/j1939/main.o' failed
>
> This is a code problem, not a git problem.
> Between 4.7 & 4.9, can_rx_register may have changed prototype.
> You didn't do anything wrong.
> I'll have to prepare a 4.9 branch with a small fix ...
>
>> make[3]: *** [net/can/j1939/main.o] Error 1
>> scripts/Makefile.build:544: recipe for target 'net/can/j1939' failed
>> make[2]: *** [net/can/j1939] Error 2
>> scripts/Makefile.build:544: recipe for target 'net/can' failed
>> make[1]: *** [net/can] Error 2
>> Makefile:988: recipe for target 'net' failed
>> make: *** [net] Error 2
>> user@jessie:/usr/src/linux$
>
> To continue in between, when you don't add j1939 to the kernel, are you
> able to boot you own kernel? You can grab the version with 'uname -a'.
>
> Kurt

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: J1939 kernel for Raspberry Pi
  2017-05-15 10:50         ` Paul Bongaerts
@ 2017-05-15 10:53           ` Paul Bongaerts
  2017-05-15 12:43             ` Kurt Van Dijck
  2017-05-15 16:52             ` Patrick Menschel
  0 siblings, 2 replies; 14+ messages in thread
From: Paul Bongaerts @ 2017-05-15 10:53 UTC (permalink / raw)
  To: Paul Bongaerts, linux-can

ment
Like:
git remote add -b j1939d-v4.7 j1939 git://github.com/kurt-vd/linux
or
git remote add  j1939 git://github.com/kurt-vd/linux/tree/j1939d-v4.7
instead
git clone -b j1939d-v4.7 git://github.com/kurt-vd/linux

2017-05-15 12:50 GMT+02:00 Paul Bongaerts <pauluzs@gmail.com>:
> Hi,
>
> I'll wait for your 4.9 fix.
>
> My own kernel is 4.9.24. only without the J1939
> That's what the question about branching was about.
>
> Is it possible to use the 4.7 branch?
> Like :
> git clone git://github.com/raspberrypi/linux/tree/rpi-4.7.y
> Or:
> git clone -b rpi-4.7.y git://github.com/raspberrypi/linux
>
> Instead of :
> git clone git://github.com/raspberrypi/linux.git
>
> Or does this mess up the history as well?
>
> Same goes for adding your remote
> would just the 4.7 branch be enough?
> Like:
> git clone -b j1939d-v4.7 git://github.com/kurt-vd/linux
> Or does this mess up the history as well?
>
> 2017-05-15 9:14 GMT+02:00 Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>:
>> Hey,
>>
>> I was just looking your previous email, but I see here below that you
>> all got it right.
>>>
>>> Still getting a error when trying to cross compile
>>>
>>>
>>>
>>> Go into src dir
>>>
>>> cd /usr/src
>>>
>>> Get crosscompile Toolchain
>>>
>>> git clone git://github.com/raspberrypi/tools.git
>>>
>>> Next get raspberry sources
>>>
>>> git clone git://github.com/raspberrypi/linux.git
>>>
>>> Go into linux dir
>>>
>>> cd /usr/src/linux
>>>
>>> Remote add the j1939 sources
>>>
>>> git remote add j1939 git://github.com/kurt-vd/linux
>>>
>>> Update j1939 remote
>>>
>>> git remote update j1939
>>>
>>> Merge j1939-v4.7 with rpi-master
>>>
>>>     git merge j1939/j1939d-v4.7
>>>     (Rpi jessie image uses uname -r 4.9.24+  so 4.7 is closest lower
>>> J1939 version)
>>>
>>> export crosscompile toolchain path
>>>
>>> To build on 32 bit system
>>> export PATH=$PATH:/usr/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin
>>> To build on 64 bits system
>>> export PATH=$PATH:/usr/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
>>>
>>> Clean the kernel source
>>>
>>> make mrproper
>>>
>>> Set kernel type
>>>
>>> For Rapberry Pi 1/compute/zero (w)
>>> KERNEL=kernel
>>> For Raspberry Pi 2/3
>>> KERNEL=kernel7
>>>
>>> Use default config
>>>
>>> For Rapberry Pi 1/compute/zero(w)
>>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig
>>> For Raspberry Pi 2/3
>>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
>>>
>>> Enable j1939 can kernel modeles
>>>
>>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
>>>
>>> Go into Networking Support Select SAE J1939 as module, enable debug.
>>> Go into CAN Device Drivers and select your device drivers
>>>
>>> <M>   CAN bus subsystem support  --->
>>> --- CAN bus subsystem support
>>> <M>   Raw CAN Protocol (raw access with CAN-ID filtering)
>>> <M>   Broadcast Manager CAN Protocol (with content filtering)
>>> <M>   CAN Gateway/Router (with netlink configuration)
>>> <M>   SAE J1939
>>> [*]     debug SAE J1939
>>> CAN Device Drivers  --->
>>>
>>> Exit menuconfig and save the config
>>>
>>> Build Kernel Image, Modules and Devicetreeoverlays
>>>
>>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtb
>>>
>>>   ......
>>>   CC [M]  net/bridge/br_netfilter_hooks.o
>>>   CC [M]  net/bridge/br_netfilter_ipv6.o
>>>   LD [M]  net/bridge/br_netfilter.o
>>>   LD      net/can/built-in.o
>>>   CC [M]  net/can/af_can.o
>>>   CC [M]  net/can/proc.o
>>>   LD [M]  net/can/can.o
>>>   CC [M]  net/can/raw.o
>>>   LD [M]  net/can/can-raw.o
>>>   CC [M]  net/can/bcm.o
>>>   LD [M]  net/can/can-bcm.o
>>>   CC [M]  net/can/gw.o
>>>   LD [M]  net/can/can-gw.o
>>>   LD      net/can/j1939/built-in.o
>>>   CC [M]  net/can/j1939/address-claim.o
>>>   CC [M]  net/can/j1939/bus.o
>>>   CC [M]  net/can/j1939/main.o
>>> net/can/j1939/main.c: In function ‘j1939_netdev_start’:
>>> net/can/j1939/main.c:238:10: error: too few arguments to function
>>> ‘can_rx_register’
>>>           j1939_can_recv, priv, "j1939");
>>>           ^
>>> In file included from net/can/j1939/main.c:25:0:
>>> ./include/linux/can/core.h:57:5: note: declared here
>>>  int can_rx_register(struct net_device *dev, canid_t can_id, canid_t mask,
>>>      ^
>>> scripts/Makefile.build:293: recipe for target 'net/can/j1939/main.o' failed
>>
>> This is a code problem, not a git problem.
>> Between 4.7 & 4.9, can_rx_register may have changed prototype.
>> You didn't do anything wrong.
>> I'll have to prepare a 4.9 branch with a small fix ...
>>
>>> make[3]: *** [net/can/j1939/main.o] Error 1
>>> scripts/Makefile.build:544: recipe for target 'net/can/j1939' failed
>>> make[2]: *** [net/can/j1939] Error 2
>>> scripts/Makefile.build:544: recipe for target 'net/can' failed
>>> make[1]: *** [net/can] Error 2
>>> Makefile:988: recipe for target 'net' failed
>>> make: *** [net] Error 2
>>> user@jessie:/usr/src/linux$
>>
>> To continue in between, when you don't add j1939 to the kernel, are you
>> able to boot you own kernel? You can grab the version with 'uname -a'.
>>
>> Kurt

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: J1939 kernel for Raspberry Pi
  2017-05-15 10:53           ` Paul Bongaerts
@ 2017-05-15 12:43             ` Kurt Van Dijck
  2017-05-16 13:02               ` Kurt Van Dijck
  2017-05-15 16:52             ` Patrick Menschel
  1 sibling, 1 reply; 14+ messages in thread
From: Kurt Van Dijck @ 2017-05-15 12:43 UTC (permalink / raw)
  To: Paul Bongaerts; +Cc: linux-can

> 
> ment
> Like:
> git remote add -b j1939d-v4.7 j1939 git://github.com/kurt-vd/linux
> or
> git remote add  j1939 git://github.com/kurt-vd/linux/tree/j1939d-v4.7
> instead
> git clone -b j1939d-v4.7 git://github.com/kurt-vd/linux
> 

I believe you should then

	git clone -b rpi-4.7.y --single-branch git://github.com/raspberrypi/linux
	git remote add -t j1939d-v4.7 j1939 git://github.com/kurt-vd/linux

This would be ok wrt. retaining history.

> 2017-05-15 12:50 GMT+02:00 Paul Bongaerts <pauluzs@gmail.com>:
> > Hi,
> >
> > I'll wait for your 4.9 fix.

today or tomorrow :-)

> >
> > My own kernel is 4.9.24. only without the J1939
> > That's what the question about branching was about.
> >
> > Is it possible to use the 4.7 branch?

yes.

Can you make sure that the newly compiled kernel boots, before adding
j1939? One step at a time :-)

Kurt

> > Like :
> > git clone git://github.com/raspberrypi/linux/tree/rpi-4.7.y
> > Or:
> > git clone -b rpi-4.7.y git://github.com/raspberrypi/linux
> >
> > Instead of :
> > git clone git://github.com/raspberrypi/linux.git
> >
> > Or does this mess up the history as well?
> >
> > Same goes for adding your remote
> > would just the 4.7 branch be enough?
> > Like:
> > git clone -b j1939d-v4.7 git://github.com/kurt-vd/linux
> > Or does this mess up the history as well?
> >
> > 2017-05-15 9:14 GMT+02:00 Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>:
> >> Hey,
> >>
> >> I was just looking your previous email, but I see here below that you
> >> all got it right.
> >>>
> >>> Still getting a error when trying to cross compile
> >>>
> >>>
> >>>
> >>> Go into src dir
> >>>
> >>> cd /usr/src
> >>>
> >>> Get crosscompile Toolchain
> >>>
> >>> git clone git://github.com/raspberrypi/tools.git
> >>>
> >>> Next get raspberry sources
> >>>
> >>> git clone git://github.com/raspberrypi/linux.git
> >>>
> >>> Go into linux dir
> >>>
> >>> cd /usr/src/linux
> >>>
> >>> Remote add the j1939 sources
> >>>
> >>> git remote add j1939 git://github.com/kurt-vd/linux
> >>>
> >>> Update j1939 remote
> >>>
> >>> git remote update j1939
> >>>
> >>> Merge j1939-v4.7 with rpi-master
> >>>
> >>>     git merge j1939/j1939d-v4.7
> >>>     (Rpi jessie image uses uname -r 4.9.24+  so 4.7 is closest lower
> >>> J1939 version)
> >>>
> >>> export crosscompile toolchain path
> >>>
> >>> To build on 32 bit system
> >>> export PATH=$PATH:/usr/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin
> >>> To build on 64 bits system
> >>> export PATH=$PATH:/usr/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
> >>>
> >>> Clean the kernel source
> >>>
> >>> make mrproper
> >>>
> >>> Set kernel type
> >>>
> >>> For Rapberry Pi 1/compute/zero (w)
> >>> KERNEL=kernel
> >>> For Raspberry Pi 2/3
> >>> KERNEL=kernel7
> >>>
> >>> Use default config
> >>>
> >>> For Rapberry Pi 1/compute/zero(w)
> >>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig
> >>> For Raspberry Pi 2/3
> >>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
> >>>
> >>> Enable j1939 can kernel modeles
> >>>
> >>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
> >>>
> >>> Go into Networking Support Select SAE J1939 as module, enable debug.
> >>> Go into CAN Device Drivers and select your device drivers
> >>>
> >>> <M>   CAN bus subsystem support  --->
> >>> --- CAN bus subsystem support
> >>> <M>   Raw CAN Protocol (raw access with CAN-ID filtering)
> >>> <M>   Broadcast Manager CAN Protocol (with content filtering)
> >>> <M>   CAN Gateway/Router (with netlink configuration)
> >>> <M>   SAE J1939
> >>> [*]     debug SAE J1939
> >>> CAN Device Drivers  --->
> >>>
> >>> Exit menuconfig and save the config
> >>>
> >>> Build Kernel Image, Modules and Devicetreeoverlays
> >>>
> >>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtb
> >>>
> >>>   ......
> >>>   CC [M]  net/bridge/br_netfilter_hooks.o
> >>>   CC [M]  net/bridge/br_netfilter_ipv6.o
> >>>   LD [M]  net/bridge/br_netfilter.o
> >>>   LD      net/can/built-in.o
> >>>   CC [M]  net/can/af_can.o
> >>>   CC [M]  net/can/proc.o
> >>>   LD [M]  net/can/can.o
> >>>   CC [M]  net/can/raw.o
> >>>   LD [M]  net/can/can-raw.o
> >>>   CC [M]  net/can/bcm.o
> >>>   LD [M]  net/can/can-bcm.o
> >>>   CC [M]  net/can/gw.o
> >>>   LD [M]  net/can/can-gw.o
> >>>   LD      net/can/j1939/built-in.o
> >>>   CC [M]  net/can/j1939/address-claim.o
> >>>   CC [M]  net/can/j1939/bus.o
> >>>   CC [M]  net/can/j1939/main.o
> >>> net/can/j1939/main.c: In function ‘j1939_netdev_start’:
> >>> net/can/j1939/main.c:238:10: error: too few arguments to function
> >>> ‘can_rx_register’
> >>>           j1939_can_recv, priv, "j1939");
> >>>           ^
> >>> In file included from net/can/j1939/main.c:25:0:
> >>> ./include/linux/can/core.h:57:5: note: declared here
> >>>  int can_rx_register(struct net_device *dev, canid_t can_id, canid_t mask,
> >>>      ^
> >>> scripts/Makefile.build:293: recipe for target 'net/can/j1939/main.o' failed
> >>
> >> This is a code problem, not a git problem.
> >> Between 4.7 & 4.9, can_rx_register may have changed prototype.
> >> You didn't do anything wrong.
> >> I'll have to prepare a 4.9 branch with a small fix ...
> >>
> >>> make[3]: *** [net/can/j1939/main.o] Error 1
> >>> scripts/Makefile.build:544: recipe for target 'net/can/j1939' failed
> >>> make[2]: *** [net/can/j1939] Error 2
> >>> scripts/Makefile.build:544: recipe for target 'net/can' failed
> >>> make[1]: *** [net/can] Error 2
> >>> Makefile:988: recipe for target 'net' failed
> >>> make: *** [net] Error 2
> >>> user@jessie:/usr/src/linux$
> >>
> >> To continue in between, when you don't add j1939 to the kernel, are you
> >> able to boot you own kernel? You can grab the version with 'uname -a'.
> >>
> >> Kurt
> --
> To unsubscribe from this list: send the line "unsubscribe linux-can" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: J1939 kernel for Raspberry Pi
  2017-05-15 10:53           ` Paul Bongaerts
  2017-05-15 12:43             ` Kurt Van Dijck
@ 2017-05-15 16:52             ` Patrick Menschel
  1 sibling, 0 replies; 14+ messages in thread
From: Patrick Menschel @ 2017-05-15 16:52 UTC (permalink / raw)
  To: Paul Bongaerts, linux-can

[-- Attachment #1: Type: text/plain, Size: 676 bytes --]

Hello Paul,

just to be sure, you're not doing both configurations, are you?

>>>> Set kernel type
>>>>
>>>> For Rapberry Pi 1/compute/zero (w)
>>>> KERNEL=kernel
>>>> For Raspberry Pi 2/3
>>>> KERNEL=kernel7
>>>>
>>>> Use default config
>>>>
>>>> For Rapberry Pi 1/compute/zero(w)
>>>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig
>>>> For Raspberry Pi 2/3
>>>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
>>>>
Imho building this top down would result in armv7 code for rpi2/3
(kernel7.img), not armv6 as needed for rpi1/ zero (kernel.img).

That would explain your crosscompile issue.

Regards,
Patrick


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3709 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: J1939 kernel for Raspberry Pi
  2017-05-15 12:43             ` Kurt Van Dijck
@ 2017-05-16 13:02               ` Kurt Van Dijck
  2017-05-16 13:13                 ` Kurt Van Dijck
  0 siblings, 1 reply; 14+ messages in thread
From: Kurt Van Dijck @ 2017-05-16 13:02 UTC (permalink / raw)
  To: linux-can; +Cc: Paul Bongaerts

Hey all,

I was looking into this change in can_rx_register.
I stumbled upon commit

adf86d59bb9b08d9eb67054251d29484c5ec102c can: Fix kernel panic at security_sock_rcv_skb

This is the 1st reason that Paul didn't succeed in compiling the RPI kernel.
I'm just asking myself: is this a temporary hack, will it stay, what
will I do with it?

@Paul, in the meantime, you could add ", NULL" in the call to
can_rx_register (on net/can/j1939/main.c:238) to compile the kernel.
I'm not sure if this is a good thing in the long run?

Kind regards,
Kurt

--- Original message ---
> Date:   Mon, 15 May 2017 14:43:59 +0200
> From: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
> To: Paul Bongaerts <pauluzs@gmail.com>
> Cc: linux-can@vger.kernel.org
> Subject: Re: J1939 kernel for Raspberry Pi
> User-Agent: Mutt/1.5.22 (2013-10-16)
> 
> > 
> > ment
> > Like:
> > git remote add -b j1939d-v4.7 j1939 git://github.com/kurt-vd/linux
> > or
> > git remote add  j1939 git://github.com/kurt-vd/linux/tree/j1939d-v4.7
> > instead
> > git clone -b j1939d-v4.7 git://github.com/kurt-vd/linux
> > 
> 
> I believe you should then
> 
> 	git clone -b rpi-4.7.y --single-branch git://github.com/raspberrypi/linux
> 	git remote add -t j1939d-v4.7 j1939 git://github.com/kurt-vd/linux
> 
> This would be ok wrt. retaining history.
> 
> > 2017-05-15 12:50 GMT+02:00 Paul Bongaerts <pauluzs@gmail.com>:
> > > Hi,
> > >
> > > I'll wait for your 4.9 fix.
> 
> today or tomorrow :-)
> 
> > >
> > > My own kernel is 4.9.24. only without the J1939
> > > That's what the question about branching was about.
> > >
> > > Is it possible to use the 4.7 branch?
> 
> yes.
> 
> Can you make sure that the newly compiled kernel boots, before adding
> j1939? One step at a time :-)
> 
> Kurt
> 
> > > Like :
> > > git clone git://github.com/raspberrypi/linux/tree/rpi-4.7.y
> > > Or:
> > > git clone -b rpi-4.7.y git://github.com/raspberrypi/linux
> > >
> > > Instead of :
> > > git clone git://github.com/raspberrypi/linux.git
> > >
> > > Or does this mess up the history as well?
> > >
> > > Same goes for adding your remote
> > > would just the 4.7 branch be enough?
> > > Like:
> > > git clone -b j1939d-v4.7 git://github.com/kurt-vd/linux
> > > Or does this mess up the history as well?
> > >
> > > 2017-05-15 9:14 GMT+02:00 Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>:
> > >> Hey,
> > >>
> > >> I was just looking your previous email, but I see here below that you
> > >> all got it right.
> > >>>
> > >>> Still getting a error when trying to cross compile
> > >>>
> > >>>
> > >>>
> > >>> Go into src dir
> > >>>
> > >>> cd /usr/src
> > >>>
> > >>> Get crosscompile Toolchain
> > >>>
> > >>> git clone git://github.com/raspberrypi/tools.git
> > >>>
> > >>> Next get raspberry sources
> > >>>
> > >>> git clone git://github.com/raspberrypi/linux.git
> > >>>
> > >>> Go into linux dir
> > >>>
> > >>> cd /usr/src/linux
> > >>>
> > >>> Remote add the j1939 sources
> > >>>
> > >>> git remote add j1939 git://github.com/kurt-vd/linux
> > >>>
> > >>> Update j1939 remote
> > >>>
> > >>> git remote update j1939
> > >>>
> > >>> Merge j1939-v4.7 with rpi-master
> > >>>
> > >>>     git merge j1939/j1939d-v4.7
> > >>>     (Rpi jessie image uses uname -r 4.9.24+  so 4.7 is closest lower
> > >>> J1939 version)
> > >>>
> > >>> export crosscompile toolchain path
> > >>>
> > >>> To build on 32 bit system
> > >>> export PATH=$PATH:/usr/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin
> > >>> To build on 64 bits system
> > >>> export PATH=$PATH:/usr/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
> > >>>
> > >>> Clean the kernel source
> > >>>
> > >>> make mrproper
> > >>>
> > >>> Set kernel type
> > >>>
> > >>> For Rapberry Pi 1/compute/zero (w)
> > >>> KERNEL=kernel
> > >>> For Raspberry Pi 2/3
> > >>> KERNEL=kernel7
> > >>>
> > >>> Use default config
> > >>>
> > >>> For Rapberry Pi 1/compute/zero(w)
> > >>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig
> > >>> For Raspberry Pi 2/3
> > >>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
> > >>>
> > >>> Enable j1939 can kernel modeles
> > >>>
> > >>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
> > >>>
> > >>> Go into Networking Support Select SAE J1939 as module, enable debug.
> > >>> Go into CAN Device Drivers and select your device drivers
> > >>>
> > >>> <M>   CAN bus subsystem support  --->
> > >>> --- CAN bus subsystem support
> > >>> <M>   Raw CAN Protocol (raw access with CAN-ID filtering)
> > >>> <M>   Broadcast Manager CAN Protocol (with content filtering)
> > >>> <M>   CAN Gateway/Router (with netlink configuration)
> > >>> <M>   SAE J1939
> > >>> [*]     debug SAE J1939
> > >>> CAN Device Drivers  --->
> > >>>
> > >>> Exit menuconfig and save the config
> > >>>
> > >>> Build Kernel Image, Modules and Devicetreeoverlays
> > >>>
> > >>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtb
> > >>>
> > >>>   ......
> > >>>   CC [M]  net/bridge/br_netfilter_hooks.o
> > >>>   CC [M]  net/bridge/br_netfilter_ipv6.o
> > >>>   LD [M]  net/bridge/br_netfilter.o
> > >>>   LD      net/can/built-in.o
> > >>>   CC [M]  net/can/af_can.o
> > >>>   CC [M]  net/can/proc.o
> > >>>   LD [M]  net/can/can.o
> > >>>   CC [M]  net/can/raw.o
> > >>>   LD [M]  net/can/can-raw.o
> > >>>   CC [M]  net/can/bcm.o
> > >>>   LD [M]  net/can/can-bcm.o
> > >>>   CC [M]  net/can/gw.o
> > >>>   LD [M]  net/can/can-gw.o
> > >>>   LD      net/can/j1939/built-in.o
> > >>>   CC [M]  net/can/j1939/address-claim.o
> > >>>   CC [M]  net/can/j1939/bus.o
> > >>>   CC [M]  net/can/j1939/main.o
> > >>> net/can/j1939/main.c: In function ‘j1939_netdev_start’:
> > >>> net/can/j1939/main.c:238:10: error: too few arguments to function
> > >>> ‘can_rx_register’
> > >>>           j1939_can_recv, priv, "j1939");
> > >>>           ^
> > >>> In file included from net/can/j1939/main.c:25:0:
> > >>> ./include/linux/can/core.h:57:5: note: declared here
> > >>>  int can_rx_register(struct net_device *dev, canid_t can_id, canid_t mask,
> > >>>      ^
> > >>> scripts/Makefile.build:293: recipe for target 'net/can/j1939/main.o' failed
> > >>
> > >> This is a code problem, not a git problem.
> > >> Between 4.7 & 4.9, can_rx_register may have changed prototype.
> > >> You didn't do anything wrong.
> > >> I'll have to prepare a 4.9 branch with a small fix ...
> > >>
> > >>> make[3]: *** [net/can/j1939/main.o] Error 1
> > >>> scripts/Makefile.build:544: recipe for target 'net/can/j1939' failed
> > >>> make[2]: *** [net/can/j1939] Error 2
> > >>> scripts/Makefile.build:544: recipe for target 'net/can' failed
> > >>> make[1]: *** [net/can] Error 2
> > >>> Makefile:988: recipe for target 'net' failed
> > >>> make: *** [net] Error 2
> > >>> user@jessie:/usr/src/linux$
> > >>
> > >> To continue in between, when you don't add j1939 to the kernel, are you
> > >> able to boot you own kernel? You can grab the version with 'uname -a'.
> > >>
> > >> Kurt
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-can" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-can" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: J1939 kernel for Raspberry Pi
  2017-05-16 13:02               ` Kurt Van Dijck
@ 2017-05-16 13:13                 ` Kurt Van Dijck
  2017-05-16 17:22                   ` Paul Bongaerts
  0 siblings, 1 reply; 14+ messages in thread
From: Kurt Van Dijck @ 2017-05-16 13:13 UTC (permalink / raw)
  To: Paul Bongaerts; +Cc: linux-can

Paul,

I did find the particular commit in v4.10 and up, so
I created branch j1939d-v4.9.10.

You can use it for your v4.9 kernel.
I haven't tested it really, since nothing really changed.

Kind regards,
Kurt

--- Original message ---
> Date:   Tue, 16 May 2017 15:02:17 +0200
> From: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
> To: linux-can@vger.kernel.org
> Cc: Paul Bongaerts <pauluzs@gmail.com>
> Subject: Re: J1939 kernel for Raspberry Pi
> User-Agent: Mutt/1.5.22 (2013-10-16)
> 
> Hey all,
> 
> I was looking into this change in can_rx_register.
> I stumbled upon commit
> 
> adf86d59bb9b08d9eb67054251d29484c5ec102c can: Fix kernel panic at security_sock_rcv_skb
> 
> This is the 1st reason that Paul didn't succeed in compiling the RPI kernel.
> I'm just asking myself: is this a temporary hack, will it stay, what
> will I do with it?
> 
> @Paul, in the meantime, you could add ", NULL" in the call to
> can_rx_register (on net/can/j1939/main.c:238) to compile the kernel.
> I'm not sure if this is a good thing in the long run?
> 
> Kind regards,
> Kurt
> 
> --- Original message ---
> > Date:   Mon, 15 May 2017 14:43:59 +0200
> > From: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
> > To: Paul Bongaerts <pauluzs@gmail.com>
> > Cc: linux-can@vger.kernel.org
> > Subject: Re: J1939 kernel for Raspberry Pi
> > User-Agent: Mutt/1.5.22 (2013-10-16)
> > 
> > > 
> > > ment
> > > Like:
> > > git remote add -b j1939d-v4.7 j1939 git://github.com/kurt-vd/linux
> > > or
> > > git remote add  j1939 git://github.com/kurt-vd/linux/tree/j1939d-v4.7
> > > instead
> > > git clone -b j1939d-v4.7 git://github.com/kurt-vd/linux
> > > 
> > 
> > I believe you should then
> > 
> > 	git clone -b rpi-4.7.y --single-branch git://github.com/raspberrypi/linux
> > 	git remote add -t j1939d-v4.7 j1939 git://github.com/kurt-vd/linux
> > 
> > This would be ok wrt. retaining history.
> > 
> > > 2017-05-15 12:50 GMT+02:00 Paul Bongaerts <pauluzs@gmail.com>:
> > > > Hi,
> > > >
> > > > I'll wait for your 4.9 fix.
> > 
> > today or tomorrow :-)
> > 
> > > >
> > > > My own kernel is 4.9.24. only without the J1939
> > > > That's what the question about branching was about.
> > > >
> > > > Is it possible to use the 4.7 branch?
> > 
> > yes.
> > 
> > Can you make sure that the newly compiled kernel boots, before adding
> > j1939? One step at a time :-)
> > 
> > Kurt
> > 
> > > > Like :
> > > > git clone git://github.com/raspberrypi/linux/tree/rpi-4.7.y
> > > > Or:
> > > > git clone -b rpi-4.7.y git://github.com/raspberrypi/linux
> > > >
> > > > Instead of :
> > > > git clone git://github.com/raspberrypi/linux.git
> > > >
> > > > Or does this mess up the history as well?
> > > >
> > > > Same goes for adding your remote
> > > > would just the 4.7 branch be enough?
> > > > Like:
> > > > git clone -b j1939d-v4.7 git://github.com/kurt-vd/linux
> > > > Or does this mess up the history as well?
> > > >
> > > > 2017-05-15 9:14 GMT+02:00 Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>:
> > > >> Hey,
> > > >>
> > > >> I was just looking your previous email, but I see here below that you
> > > >> all got it right.
> > > >>>
> > > >>> Still getting a error when trying to cross compile
> > > >>>
> > > >>>
> > > >>>
> > > >>> Go into src dir
> > > >>>
> > > >>> cd /usr/src
> > > >>>
> > > >>> Get crosscompile Toolchain
> > > >>>
> > > >>> git clone git://github.com/raspberrypi/tools.git
> > > >>>
> > > >>> Next get raspberry sources
> > > >>>
> > > >>> git clone git://github.com/raspberrypi/linux.git
> > > >>>
> > > >>> Go into linux dir
> > > >>>
> > > >>> cd /usr/src/linux
> > > >>>
> > > >>> Remote add the j1939 sources
> > > >>>
> > > >>> git remote add j1939 git://github.com/kurt-vd/linux
> > > >>>
> > > >>> Update j1939 remote
> > > >>>
> > > >>> git remote update j1939
> > > >>>
> > > >>> Merge j1939-v4.7 with rpi-master
> > > >>>
> > > >>>     git merge j1939/j1939d-v4.7
> > > >>>     (Rpi jessie image uses uname -r 4.9.24+  so 4.7 is closest lower
> > > >>> J1939 version)
> > > >>>
> > > >>> export crosscompile toolchain path
> > > >>>
> > > >>> To build on 32 bit system
> > > >>> export PATH=$PATH:/usr/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin
> > > >>> To build on 64 bits system
> > > >>> export PATH=$PATH:/usr/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
> > > >>>
> > > >>> Clean the kernel source
> > > >>>
> > > >>> make mrproper
> > > >>>
> > > >>> Set kernel type
> > > >>>
> > > >>> For Rapberry Pi 1/compute/zero (w)
> > > >>> KERNEL=kernel
> > > >>> For Raspberry Pi 2/3
> > > >>> KERNEL=kernel7
> > > >>>
> > > >>> Use default config
> > > >>>
> > > >>> For Rapberry Pi 1/compute/zero(w)
> > > >>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig
> > > >>> For Raspberry Pi 2/3
> > > >>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
> > > >>>
> > > >>> Enable j1939 can kernel modeles
> > > >>>
> > > >>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
> > > >>>
> > > >>> Go into Networking Support Select SAE J1939 as module, enable debug.
> > > >>> Go into CAN Device Drivers and select your device drivers
> > > >>>
> > > >>> <M>   CAN bus subsystem support  --->
> > > >>> --- CAN bus subsystem support
> > > >>> <M>   Raw CAN Protocol (raw access with CAN-ID filtering)
> > > >>> <M>   Broadcast Manager CAN Protocol (with content filtering)
> > > >>> <M>   CAN Gateway/Router (with netlink configuration)
> > > >>> <M>   SAE J1939
> > > >>> [*]     debug SAE J1939
> > > >>> CAN Device Drivers  --->
> > > >>>
> > > >>> Exit menuconfig and save the config
> > > >>>
> > > >>> Build Kernel Image, Modules and Devicetreeoverlays
> > > >>>
> > > >>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtb
> > > >>>
> > > >>>   ......
> > > >>>   CC [M]  net/bridge/br_netfilter_hooks.o
> > > >>>   CC [M]  net/bridge/br_netfilter_ipv6.o
> > > >>>   LD [M]  net/bridge/br_netfilter.o
> > > >>>   LD      net/can/built-in.o
> > > >>>   CC [M]  net/can/af_can.o
> > > >>>   CC [M]  net/can/proc.o
> > > >>>   LD [M]  net/can/can.o
> > > >>>   CC [M]  net/can/raw.o
> > > >>>   LD [M]  net/can/can-raw.o
> > > >>>   CC [M]  net/can/bcm.o
> > > >>>   LD [M]  net/can/can-bcm.o
> > > >>>   CC [M]  net/can/gw.o
> > > >>>   LD [M]  net/can/can-gw.o
> > > >>>   LD      net/can/j1939/built-in.o
> > > >>>   CC [M]  net/can/j1939/address-claim.o
> > > >>>   CC [M]  net/can/j1939/bus.o
> > > >>>   CC [M]  net/can/j1939/main.o
> > > >>> net/can/j1939/main.c: In function ‘j1939_netdev_start’:
> > > >>> net/can/j1939/main.c:238:10: error: too few arguments to function
> > > >>> ‘can_rx_register’
> > > >>>           j1939_can_recv, priv, "j1939");
> > > >>>           ^
> > > >>> In file included from net/can/j1939/main.c:25:0:
> > > >>> ./include/linux/can/core.h:57:5: note: declared here
> > > >>>  int can_rx_register(struct net_device *dev, canid_t can_id, canid_t mask,
> > > >>>      ^
> > > >>> scripts/Makefile.build:293: recipe for target 'net/can/j1939/main.o' failed
> > > >>
> > > >> This is a code problem, not a git problem.
> > > >> Between 4.7 & 4.9, can_rx_register may have changed prototype.
> > > >> You didn't do anything wrong.
> > > >> I'll have to prepare a 4.9 branch with a small fix ...
> > > >>
> > > >>> make[3]: *** [net/can/j1939/main.o] Error 1
> > > >>> scripts/Makefile.build:544: recipe for target 'net/can/j1939' failed
> > > >>> make[2]: *** [net/can/j1939] Error 2
> > > >>> scripts/Makefile.build:544: recipe for target 'net/can' failed
> > > >>> make[1]: *** [net/can] Error 2
> > > >>> Makefile:988: recipe for target 'net' failed
> > > >>> make: *** [net] Error 2
> > > >>> user@jessie:/usr/src/linux$
> > > >>
> > > >> To continue in between, when you don't add j1939 to the kernel, are you
> > > >> able to boot you own kernel? You can grab the version with 'uname -a'.
> > > >>
> > > >> Kurt
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe linux-can" in
> > > the body of a message to majordomo@vger.kernel.org
> > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-can" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-can" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: J1939 kernel for Raspberry Pi
  2017-05-16 13:13                 ` Kurt Van Dijck
@ 2017-05-16 17:22                   ` Paul Bongaerts
  2017-05-16 20:40                     ` Paul Bongaerts
  0 siblings, 1 reply; 14+ messages in thread
From: Paul Bongaerts @ 2017-05-16 17:22 UTC (permalink / raw)
  To: Paul Bongaerts, linux-can

Kurt,

Compiled with just a warning:
Tested and works (j1939-v4.9.10 with rpi-4.9.y)
Need to do some cleanup on the howto and will post it then

  CC [M]  net/can/j1939/socket.o
  CC [M]  net/can/j1939/transport.o
net/can/j1939/transport.c: In function ‘j1939xtp_rx_abort’:
net/can/j1939/transport.c:616:27: warning: unused variable ‘cb’
[-Wunused-variable]
  struct j1939_sk_buff_cb *cb = (void *)skb->cb;
                           ^
  LD [M]  net/can/j1939/can-j1939.o
  CC      net/core/sock.o


David

Indeed i want to be able to receive and in the future send J1939 and
ISO11783 message's

Patrick

Nope, i build just for one kernel, this is working now

2017-05-16 15:13 GMT+02:00 Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>:
> Paul,
>
> I did find the particular commit in v4.10 and up, so
> I created branch j1939d-v4.9.10.
>
> You can use it for your v4.9 kernel.
> I haven't tested it really, since nothing really changed.
>
> Kind regards,
> Kurt
>
> --- Original message ---
>> Date:   Tue, 16 May 2017 15:02:17 +0200
>> From: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
>> To: linux-can@vger.kernel.org
>> Cc: Paul Bongaerts <pauluzs@gmail.com>
>> Subject: Re: J1939 kernel for Raspberry Pi
>> User-Agent: Mutt/1.5.22 (2013-10-16)
>>
>> Hey all,
>>
>> I was looking into this change in can_rx_register.
>> I stumbled upon commit
>>
>> adf86d59bb9b08d9eb67054251d29484c5ec102c can: Fix kernel panic at security_sock_rcv_skb
>>
>> This is the 1st reason that Paul didn't succeed in compiling the RPI kernel.
>> I'm just asking myself: is this a temporary hack, will it stay, what
>> will I do with it?
>>
>> @Paul, in the meantime, you could add ", NULL" in the call to
>> can_rx_register (on net/can/j1939/main.c:238) to compile the kernel.
>> I'm not sure if this is a good thing in the long run?
>>
>> Kind regards,
>> Kurt
>>
>> --- Original message ---
>> > Date:   Mon, 15 May 2017 14:43:59 +0200
>> > From: Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>
>> > To: Paul Bongaerts <pauluzs@gmail.com>
>> > Cc: linux-can@vger.kernel.org
>> > Subject: Re: J1939 kernel for Raspberry Pi
>> > User-Agent: Mutt/1.5.22 (2013-10-16)
>> >
>> > >
>> > > ment
>> > > Like:
>> > > git remote add -b j1939d-v4.7 j1939 git://github.com/kurt-vd/linux
>> > > or
>> > > git remote add  j1939 git://github.com/kurt-vd/linux/tree/j1939d-v4.7
>> > > instead
>> > > git clone -b j1939d-v4.7 git://github.com/kurt-vd/linux
>> > >
>> >
>> > I believe you should then
>> >
>> >     git clone -b rpi-4.7.y --single-branch git://github.com/raspberrypi/linux
>> >     git remote add -t j1939d-v4.7 j1939 git://github.com/kurt-vd/linux
>> >
>> > This would be ok wrt. retaining history.
>> >
>> > > 2017-05-15 12:50 GMT+02:00 Paul Bongaerts <pauluzs@gmail.com>:
>> > > > Hi,
>> > > >
>> > > > I'll wait for your 4.9 fix.
>> >
>> > today or tomorrow :-)
>> >
>> > > >
>> > > > My own kernel is 4.9.24. only without the J1939
>> > > > That's what the question about branching was about.
>> > > >
>> > > > Is it possible to use the 4.7 branch?
>> >
>> > yes.
>> >
>> > Can you make sure that the newly compiled kernel boots, before adding
>> > j1939? One step at a time :-)
>> >
>> > Kurt
>> >
>> > > > Like :
>> > > > git clone git://github.com/raspberrypi/linux/tree/rpi-4.7.y
>> > > > Or:
>> > > > git clone -b rpi-4.7.y git://github.com/raspberrypi/linux
>> > > >
>> > > > Instead of :
>> > > > git clone git://github.com/raspberrypi/linux.git
>> > > >
>> > > > Or does this mess up the history as well?
>> > > >
>> > > > Same goes for adding your remote
>> > > > would just the 4.7 branch be enough?
>> > > > Like:
>> > > > git clone -b j1939d-v4.7 git://github.com/kurt-vd/linux
>> > > > Or does this mess up the history as well?
>> > > >
>> > > > 2017-05-15 9:14 GMT+02:00 Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>:
>> > > >> Hey,
>> > > >>
>> > > >> I was just looking your previous email, but I see here below that you
>> > > >> all got it right.
>> > > >>>
>> > > >>> Still getting a error when trying to cross compile
>> > > >>>
>> > > >>>
>> > > >>>
>> > > >>> Go into src dir
>> > > >>>
>> > > >>> cd /usr/src
>> > > >>>
>> > > >>> Get crosscompile Toolchain
>> > > >>>
>> > > >>> git clone git://github.com/raspberrypi/tools.git
>> > > >>>
>> > > >>> Next get raspberry sources
>> > > >>>
>> > > >>> git clone git://github.com/raspberrypi/linux.git
>> > > >>>
>> > > >>> Go into linux dir
>> > > >>>
>> > > >>> cd /usr/src/linux
>> > > >>>
>> > > >>> Remote add the j1939 sources
>> > > >>>
>> > > >>> git remote add j1939 git://github.com/kurt-vd/linux
>> > > >>>
>> > > >>> Update j1939 remote
>> > > >>>
>> > > >>> git remote update j1939
>> > > >>>
>> > > >>> Merge j1939-v4.7 with rpi-master
>> > > >>>
>> > > >>>     git merge j1939/j1939d-v4.7
>> > > >>>     (Rpi jessie image uses uname -r 4.9.24+  so 4.7 is closest lower
>> > > >>> J1939 version)
>> > > >>>
>> > > >>> export crosscompile toolchain path
>> > > >>>
>> > > >>> To build on 32 bit system
>> > > >>> export PATH=$PATH:/usr/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin
>> > > >>> To build on 64 bits system
>> > > >>> export PATH=$PATH:/usr/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
>> > > >>>
>> > > >>> Clean the kernel source
>> > > >>>
>> > > >>> make mrproper
>> > > >>>
>> > > >>> Set kernel type
>> > > >>>
>> > > >>> For Rapberry Pi 1/compute/zero (w)
>> > > >>> KERNEL=kernel
>> > > >>> For Raspberry Pi 2/3
>> > > >>> KERNEL=kernel7
>> > > >>>
>> > > >>> Use default config
>> > > >>>
>> > > >>> For Rapberry Pi 1/compute/zero(w)
>> > > >>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig
>> > > >>> For Raspberry Pi 2/3
>> > > >>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
>> > > >>>
>> > > >>> Enable j1939 can kernel modeles
>> > > >>>
>> > > >>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
>> > > >>>
>> > > >>> Go into Networking Support Select SAE J1939 as module, enable debug.
>> > > >>> Go into CAN Device Drivers and select your device drivers
>> > > >>>
>> > > >>> <M>   CAN bus subsystem support  --->
>> > > >>> --- CAN bus subsystem support
>> > > >>> <M>   Raw CAN Protocol (raw access with CAN-ID filtering)
>> > > >>> <M>   Broadcast Manager CAN Protocol (with content filtering)
>> > > >>> <M>   CAN Gateway/Router (with netlink configuration)
>> > > >>> <M>   SAE J1939
>> > > >>> [*]     debug SAE J1939
>> > > >>> CAN Device Drivers  --->
>> > > >>>
>> > > >>> Exit menuconfig and save the config
>> > > >>>
>> > > >>> Build Kernel Image, Modules and Devicetreeoverlays
>> > > >>>
>> > > >>> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtb
>> > > >>>
>> > > >>>   ......
>> > > >>>   CC [M]  net/bridge/br_netfilter_hooks.o
>> > > >>>   CC [M]  net/bridge/br_netfilter_ipv6.o
>> > > >>>   LD [M]  net/bridge/br_netfilter.o
>> > > >>>   LD      net/can/built-in.o
>> > > >>>   CC [M]  net/can/af_can.o
>> > > >>>   CC [M]  net/can/proc.o
>> > > >>>   LD [M]  net/can/can.o
>> > > >>>   CC [M]  net/can/raw.o
>> > > >>>   LD [M]  net/can/can-raw.o
>> > > >>>   CC [M]  net/can/bcm.o
>> > > >>>   LD [M]  net/can/can-bcm.o
>> > > >>>   CC [M]  net/can/gw.o
>> > > >>>   LD [M]  net/can/can-gw.o
>> > > >>>   LD      net/can/j1939/built-in.o
>> > > >>>   CC [M]  net/can/j1939/address-claim.o
>> > > >>>   CC [M]  net/can/j1939/bus.o
>> > > >>>   CC [M]  net/can/j1939/main.o
>> > > >>> net/can/j1939/main.c: In function ‘j1939_netdev_start’:
>> > > >>> net/can/j1939/main.c:238:10: error: too few arguments to function
>> > > >>> ‘can_rx_register’
>> > > >>>           j1939_can_recv, priv, "j1939");
>> > > >>>           ^
>> > > >>> In file included from net/can/j1939/main.c:25:0:
>> > > >>> ./include/linux/can/core.h:57:5: note: declared here
>> > > >>>  int can_rx_register(struct net_device *dev, canid_t can_id, canid_t mask,
>> > > >>>      ^
>> > > >>> scripts/Makefile.build:293: recipe for target 'net/can/j1939/main.o' failed
>> > > >>
>> > > >> This is a code problem, not a git problem.
>> > > >> Between 4.7 & 4.9, can_rx_register may have changed prototype.
>> > > >> You didn't do anything wrong.
>> > > >> I'll have to prepare a 4.9 branch with a small fix ...
>> > > >>
>> > > >>> make[3]: *** [net/can/j1939/main.o] Error 1
>> > > >>> scripts/Makefile.build:544: recipe for target 'net/can/j1939' failed
>> > > >>> make[2]: *** [net/can/j1939] Error 2
>> > > >>> scripts/Makefile.build:544: recipe for target 'net/can' failed
>> > > >>> make[1]: *** [net/can] Error 2
>> > > >>> Makefile:988: recipe for target 'net' failed
>> > > >>> make: *** [net] Error 2
>> > > >>> user@jessie:/usr/src/linux$
>> > > >>
>> > > >> To continue in between, when you don't add j1939 to the kernel, are you
>> > > >> able to boot you own kernel? You can grab the version with 'uname -a'.
>> > > >>
>> > > >> Kurt
>> > > --
>> > > To unsubscribe from this list: send the line "unsubscribe linux-can" in
>> > > the body of a message to majordomo@vger.kernel.org
>> > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> > --
>> > To unsubscribe from this list: send the line "unsubscribe linux-can" in
>> > the body of a message to majordomo@vger.kernel.org
>> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-can" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: J1939 kernel for Raspberry Pi
  2017-05-16 17:22                   ` Paul Bongaerts
@ 2017-05-16 20:40                     ` Paul Bongaerts
  0 siblings, 0 replies; 14+ messages in thread
From: Paul Bongaerts @ 2017-05-16 20:40 UTC (permalink / raw)
  To: Paul Bongaerts, linux-can

Working, cleaned up howto
Mailinglist messes up tabbed indentation for nice reading i'm afraid.

#######################################################################################
Cross Compile J1939 - Raspberrypi rpi-4.9.y
Compiled on
Linux 4.4.0-77-generic #98-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux
Tested hardware setup
Raspberry pi zero wireless 16 GB SD Card
2 mcp2515 8mhz xtal spi canschields modified for 3.3V
cs0 on BCM pin 8 cs1 on BCM pin 7 interupts on BCM pins 24 and 25
#######################################################################################

Update and upgrade

sudo apt-get update
sudo apt-get upgrade

Install  build-essentials, bc, git, ncurses and unzip

sudo apt-get install build-essential bc git-core libncurses5-dev unzip

Make a src dir in user directory

mkdir ~/src

Go into src dir

cd ~/src

Get crosscompile Toolchain

git clone git://github.com/raspberrypi/tools.git

Export crosscompile toolchain path

To crosscompile on 32 bit system
export PATH=$PATH:~/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin
To crosscompile on 64 bits system
export PATH=$PATH:~/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin

Next get raspberry 4.9 branch sources

git clone -b rpi-4.9.y --single-branch git://github.com/raspberrypi/linux

Go into linux dir

cd ~/src/linux

Add the J1939 v4.9.10 remote sources

git remote add -t j1939d-v4.9.10 j1939 git://github.com/kurt-vd/linux

Update J1939 remote

git remote update j1939

Merge j1939-v4.9.10 with rpi-4.9.y

git merge j1939/j1939d-v4.9.10

Set kernel type

For Raspberry Pi 1/compute/zero (w)
KERNEL=kernel
For Raspberry Pi 2/3
KERNEL=kernel7

Use default config

For Raspberry Pi 1/compute/zero(w)
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig
For Raspberry Pi 2/3
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig

Enable j1939 can kernel modeles

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig

Go into [*] Networking support  --->
Go into <M>   CAN bus subsystem support  --->
Select SAE J1939 as module, enable debug
<M>   SAE J1939
[*]     debug SAE J1939
Go into CAN Device Drivers  --->
Select the desired device drivers
Exit menuconfig and save the new kernel configuration

Build Kernel Image, Modules and Devicetreeoverlays (remove the -j4
option when building on 32 bit system)

make -j4 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs

Get latest Raspbian Image

For Raspbian lite
wget https://downloads.raspberrypi.org/raspbian_lite_latest -P ~/src/
For Raspbian with pixel
wget https://downloads.raspberrypi.org/raspbian_latest -P ~/src/

Unzip and write image to SD card (assuming /dev/sdb is the SD)

For Raspbian lite
unzip -p ~/src/raspbian_lite_latest | sudo dd of=/dev/sdb bs=4096
For Raspbian with pixel
unzip -p ~/src/raspbian_latest | sudo dd of=/dev/sdb bs=4096

Create mount locations and mount SD card
mkdir ~/mnt
mkdir ~/mnt/fat32
mkdir ~/mnt/ext4
sudo mount /dev/sdb1 ~/mnt/fat32
sudo mount /dev/sdb2 ~/mnt/ext4

Install the modules to SD:

sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
INSTALL_MOD_PATH=~/mnt/ext4 modules_install

Backup original Kernel, Copy new Kernel and Device Tree blobs to SD card

sudo cp ~/mnt/fat32/$KERNEL.img ~/mnt/fat32/$KERNEL-backup.img
sudo cp ~/src/linux/arch/arm/boot/zImage ~/mnt/fat32/$KERNEL.img
sudo cp ~/src/linux/arch/arm/boot/dts/*.dtb ~/mnt/fat32/
sudo cp ~/src/linux/arch/arm/boot/dts/overlays/*.dtb* ~/mnt/fat32/overlays/
sudo cp ~/src/linux/arch/arm/boot/dts/overlays/README ~/mnt/fat32/overlays/

Enable ssh on boot

sudo touch ~/mnt/fat32/ssh

Setup Wireless(add lines below)

sudo nano ~/mnt/ext4/etc/wpa_supplicant/wpa_supplicant.conf

network={
ssid="YOURWIRELESSNETWORK"
psk="YOURWIRELESSPASSWORD"
}

Enable spi and mcp2515 overlays(add lines below) for 16Mhz shields use
oscillator=16000000

sudo nano ~/mnt/fat32/config.txt

dtparam=spi=on
dtoverlay=spi-bcm2835-overlay
dtoverlay=mcp2515-can0,oscillator=8000000,interrupt=24
dtoverlay=mcp2515-can1,oscillator=8000000,interrupt=25

Set can interfaces to start at boot (add lines below)

sudo nano ~/mnt/ext4/etc/network/interfaces

auto can0
iface can0 inet manual
pre-up /sbin/ip link set $IFACE type can bitrate 250000
up /sbin/ifconfig $IFACE up
down /sbin/ifconfig $IFACE down

auto can1
iface can1 inet manual
pre-up /sbin/ip link set $IFACE type can bitrate 250000
up /sbin/ifconfig $IFACE up
down /sbin/ifconfig $IFACE down

Unmount SD

sudo umount ~/mnt/fat32
sudo umount ~/mnt/ext4

Put SD card in Raspberry Pi and give it about a minute to boot

Ssh into Raspberry Pi

ssh pi@raspberrypi.local

Install build depencies

pi@raspberrypi:~ $ sudo apt-get install git bc

Install linux-can

pi@raspberrypi:~ $ git clone https://github.com/linux-can/can-utils.git
pi@raspberrypi:~ $ cd can-utils
pi@raspberrypi:~ $ make
pi@raspberrypi:~ $ sudo make install

Install testj1939

pi@raspberrypi:~ $ cd ~
pi@raspberrypi:~ $ git clone https://github.com/kurt-vd/test-can-j1939.git
pi@raspberrypi:~ $ cd test-can-j1939/
pi@raspberrypi:~ $ make
pi@raspberrypi:~ $ sudo make install

Open a second Ssh into Raspberry Pi

ssh pi@raspberrypi.local

Test your can interfaces, (can0 needs to be wired to can1)
On the first ssh session

pi@raspberrypi:~ $ candump can0

Op the second ssh sesion and send some data

pi@raspberrypi:~ $ cansend can1 7DF#0201050000000000

Check the output in first ssh session

Repeat test vise versa to ensure both interupts are working

On the first ssh session

pi@raspberrypi:~ $ candump can1

Op the second ssh sesion and send some data

pi@raspberrypi:~ $ cansend can0 7DF#0201050000000000

Check the output in first ssh session

Test J1939
On the first ssh session

pi@raspberrypi:~ $ testj1939 -r can0

Op the second ssh sesion and send some data

pi@raspberrypi:~ $ testj1939 -s can1:0x90,0x3ffff

Check the output in first ssh session

All Done!!

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-05-16 20:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-10 11:50 J1939 kernel for Raspberry Pi Paul Bongaerts
2017-05-10 15:03 ` Patrick Menschel
2017-05-11 19:29 ` Kurt Van Dijck
2017-05-14 17:57   ` Paul Bongaerts
2017-05-14 22:30     ` Paul Bongaerts
2017-05-15  7:14       ` Kurt Van Dijck
2017-05-15 10:50         ` Paul Bongaerts
2017-05-15 10:53           ` Paul Bongaerts
2017-05-15 12:43             ` Kurt Van Dijck
2017-05-16 13:02               ` Kurt Van Dijck
2017-05-16 13:13                 ` Kurt Van Dijck
2017-05-16 17:22                   ` Paul Bongaerts
2017-05-16 20:40                     ` Paul Bongaerts
2017-05-15 16:52             ` Patrick Menschel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.