Adding new Crypto Driver for HW Crypto Accelerator

Hi all,
I am trying to add and compile a driver for a custom crypto accelerator PCI card. I have tested same driver in Debian kernel. And added it to /Pkgs/Linux-image/drivers/crypto sub-directory. I edited Kconfig and Makefile. When I made the iso image, it did not appear in it.
Can somebody tell me the procedure to add additional drivers and make them load on bootup automatically?

Thanks in advance.

Hello sohailto.

Please tell me more detail about your build step.

In my experience, you would better to build deb package file on VyOS environment.
(It is mean that please install development environment on VyOS and make deb package for VyOS)

Because, current VyOS kernel version (hydrogeon) is kernel 3.3.8.
And it is not original Debian6 kernel.

After make deb package, put it into pkgs directory in build-iso repository.
and append package name into build-iso/livecd/config.vyatta/chroot_local-packageslists/foo.list

and make iso image

This URL might be help.

http://vyos.net/wiki/Rebuild_VyOS_kernel_Step
http://vyos.net/wiki/Howto_build_an_ISO_image
http://vyos.net/wiki/Modifying_the_build


Hiroyuki Sato

Thanks for reply,
Could you please elaborate the procedure to make deb package for a driver? And how it would be loaded automatically?
Thanks

Hello sohailto.

Currently, I don’t have experience about module development from scratch.

I’ll investigate about driver development. After that, I’ll update my post.

How to create development env on VyOS.

configure
set system package repository squeeze components 'main contrib non-free'
set system package repository squeeze distribution 'squeeze'
set system package repository squeeze url 'http://mirrors.kernel.org/debian'
commit
save
exit

sudo apt-get install build-essential
sudo apt-get install module-assistant

These URLs might be useful.

https://wiki.debian.org/HowToPackageForDebian
https://wiki.debian.org/ModuleAssistant
https://wiki.debian.org/Courses2005/BuildingWithoutHelper

Best regards.

This is really great for me :slight_smile:

Hi all,
Please help me about this kernel configuration problem. I have added sub-directory ‘Koni’ of the driver in /drivers/crypto. It has its own kconfig file. The variable CRYPTO_DEV_KONI is assigned value y by running make menuconfig and then running make oldconfig.
When I run make linux-image, the script conf spits this error,
" * restart config…

  • Hardware crypto devices

Hardware Crypto Devices (CRYPTO_HW) [y/n/?] y

Koni HW accelerator (CRYPTO_DEV_KONI) [N/m/y/?] (NEW) aborted!

console input/output is redirected. Run ‘make oldconfig’ to update configuration"

I have run ‘make oldconfig’ several times but no use.

I have done same procedure in Debian and it worked. My question is, Is the kernel configuration in VyOS is done by ‘make menuconfig’ or there is some special method?

Kind regards.

Hello sohailto

Have you ever tried the following step?

By the way, Is that source open?

Reference
http://vyos.net/wiki/Rebuild_VyOS_kernel_Step

git clone git://github.com/vyos/build-iso.git
cd build-iso.git
branch=helium
flavor=amd64-vyos

git submodule update --init pkgs/linux-image
cd pkgs/linux-image
git checkout $branch

Copy your driver to driver/crypto

Edit directory
build-iso/pkgs/linux-image/debian/arch/amd64/config.amd64-vyos

add CONFIG_XXX=m

Generate flavor file and ignore last error.

debian/bin/build-flavour.sh $flavor

...
make[1]: *** [debian/control-real] Error 1
make[1]: Leaving directory `/home/arch/build-iso/pkgs/linux-image'
make: *** [debian/control] Error 2
cd $(build-iso)
make linux-image


Hiroyuki Sato.

Hello Hiroyuki Sato

Thank you very much for your quick reply, it really helped me. Yes I had followed all steps except the config file edit.
I have setup the ‘hydrogen’ branch and built ‘586-vyatta’ flavour.
The source of my driver is not open but it is very similar to Geode-AES.

And another question, could you please suggest configuration changes to make this driver load during system bootup?

Thanks

Sohailto

Hi,

Generally,

If Kcofnig ex) drivers/infiniband/ulp/srp/Kconfig

config INFINIBAND_SRP
        tristate "InfiniBand SCSI RDMA Protocol"
        depends on SCSI
        select SCSI_SRP_ATTRS

will generate .config like the following

CONFIG_INFINIBAND_SRP=m 

so please take a look Kconfig file and add
your driver parameters.

Maybe, you can build additional module.

If that souce is open, I’ll try it. But it seems difficult.
If you know any simlar source, I can assist much.

And about another question

Have you ever tried to edit /etc/modules file?

I edited this file like the folowing

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.

loop

And after reboot, ‘‘loop’’ moudle loaded automatically.

And If that driver contain init script,
It is good idea to execute modprobe(insmod) in that script.

Happy hacking!!


Hiroyuki Sato.

Hi,

Thanks again. I know the /etc/modules method but it is for running kernel. I actually asked for a configuration setting in the source code (linux-image) of VyOS to autoload modules at bootup. So that I can deploy the iso easily on many systems.
Any suggestion?

Regards

Sohailto

Hi.

Your goal is

  • create custom iso image which is include custom driver and configuration

right?

If so, Have you ever tried chroot_local-hooks?

Top of build-iso

cat livecd/config.vyatta/chroot_local-hooks/15-test 
#!/bin/sh

echo "loop" >> /etc/modules

And execute make iso, you will find loop string in /etc/modules

It is a little quick hack. but It works.
I don’t know alternative solution yet.


Hiroyuki Sato.

Hi Hiroyuki Sato

Thanks for your quick solution. But I have found (verified) that the changes in configuration file alone (make the module builtin) are enough to autoload the module.
I checked the /proc/crypto and it contained the entry for Koni.
Thanks alot.

Sohailto

Thank you for this !