yocto kernel module recipe - build

I have a recipe as follows:
SUMMARY = "foo driver"
LICENSE = "CLOSED"
inherit module
SRC_URI = "file://foo.tgz"
S = "${WORKDIR}/foo-module"
RPROVIDES_${PN} += "kernel-module-foo"
What I don't understand are:
There is no do_compile(), do_install(), oe_runmake...etc, why it will compile?
RPROVIDES_${PN} and kernel-module-xxxx can solve this issue if a kernel module needs to build?
Why there is no FILES_${PN} assignment?

You have inherit module in your recipe. This means you do have both do_compile() and do_install(): see meta/classes/module.bbclass.
You have not actually explained what your issue is?
module class inherits kernel-module-split class: this will create one package per built module, generating package names from module names, and setting FILES_* variables as needed. The RPROVIDES line seems to be just saying that one of the generated packages ("kernel-module-foo") can also be referred to with the name "${PN}".
See https://www.yoctoproject.org/docs/current/kernel-dev/kernel-dev.html#incorporating-out-of-tree-modules for more details

Related

unit test cases for wizard in odoo 10

I am new to Odoo. I am using Odoo 10. I would like to write test cases for a new wizard I created under a module A. I put all my wizard code (views + models) inside wizards directory. I created unit test cases under the path <<module/tests>> followed all the file/class/method naming conventions. When I try to upgrade the module (with test enable) to run unit test cases, all the other modules tests scripts are run but not for the newly created module A. Please suggest what additional changes might be needed to enable test scripts for a newly created module with wizard.
Thank you.
I believe that the structure you have follow is according to the standard way. You can find the structure here Testing Module Structure.
Also please check that the naming on the folder and file in which you wrote the code,
for example - tests/test_todo.py Also, don't forget to update the import in tests/init.py to from. import test_todo
This is because Odoo expects the test module names to start with test_ when it searches for tests belonging to a module Code Reference
Command to Run the testcases:
python ./odoo.py -i module_to_test --log-level=test -d your_database --db-filter=your_database --test-enable --stop-after-init

BBCLASSEXTEND="native nativesdk"

After checked the official document, I still don’t understand this meaning in recipe.
BBCLASSEXTEND="native nativesdk"
BBCLASSEXTEND is a way for the named classes (in this case, native and nativesdk) to run over the recipe to alter them.
The native class makes a version of the recipe (with -native appended to the name) that builds for the build host instead of the build target, so you can execute the binaries during the build. The nativesdk class is similar but builds packages to be executed in the SDK.

How do I get pylint to recognize MySQLdb members?

import MySQLdb
try:
dbcon = MySQLdb.connect(host=host_name, user=user_name,
passwd=password, db=db_name)
except MySQLdb.Error:
pass
getting this pylint warning
Module 'MySQLdb' has no 'Error' member (no-member)
The Best:
Using extension-pkg-whitelist option:
A comma-separated list of package or module names from where C extensions may be loaded. Extensions are loading into the active Python interpreter and may run arbitrary code
--extension-pkg-whitelist=_mysql
PyLint parses (by default) the source files, but in Python the shape of a module can change at runtime from the shape defined in the source file. This option tells PyLint to actually import the specified module, and use the runtime definition.
Note that since the MySQLdb package wraps a C extension, you have to pass the name of the C extension (_mysql) instead of the package name (MySQLdb). (source)
Not Bad:
Using unsafe-load-any-extension option
Allow loading of arbitrary C extensions. Extensions are imported into the active Python interpreter and may run arbitrary code.
--unsafe-load-any-extension=yes
You could use the unsafe-load-any-extension option, but that would load every available extension, with its' (potentially dangerous) initialization code. extension-pkg-whitelist is safer, because it only loads the specified modules.
The Worst:
Using disable option
# pylint: disable=no-member
It doesn't really solve the issue, but only makes PyLint silent.
Thanks to #PCManticore, the maintainer of PyLint. Here's the comment of the maintainer.
Thanks to #ZevSpitz, the contributor of the best answer and this not bad answer.
It may help to use the --extension-pkg-whitelist option:
--extension-pkg-whitelist=_mysql
pylint parses (by default) the source files, but in Python the shape of a module can change at runtime from the shape defined in the source file. This option tells pylint to actually import the specified module, and use the runtime definition.
Note that since the MySQLdb package wraps a C extension, you have to pass the name of the C extension (_mysql) instead of the package name (MySQLdb). (source)
You could use the unsafe-load-any-extension option, but that would load every available extension, with its' (potentially dangerous) initialization code. extension-pkg-whitelist is safer, because it only loads the specified modules.

How does poky/meta/lib/oe/image.py get included when building core-image-minimal.bb?

I am using the Yocto Project, Jethro release. However, I think this question applies to other releases as well.
I need to modify the image creation process. I have read the BitBake manual, but I still don't know how a full python script or several scripts are included.
Here is what I have found so far:
bitbake core-image-mininmal
After bitbake reads all the config files and parses bblayers.conf, it searches all the layer directories for the recipe core-image-minimal.bb
In core-image-minimal.bb, we have:
inherit core-image
This inherits the class core-image.bbclass which in turn inherits image.bbclass which contains the bitbake code:
fakeroot python do_rootfs () {
from oe.rootfs import create_rootfs
from oe.image import create_image
from oe.manifest import create_manifest
# generate the initial manifest
create_manifest(d)
# generate rootfs
create_rootfs(d)
# generate final images
create_image(d)
}
Searching the source tree for the text create_image, I found the following in image.py:
def create_image(d):
Image(d).create()
and also:
def create(self):
bb.note("###### Generate images #######")
pre_process_cmds = self.d.getVar("IMAGE_PREPROCESS_COMMAND", True)
post_process_cmds = self.d.getVar("IMAGE_POSTPROCESS_COMMAND", True)
I've also created my own class my-class.bbclass and put the following in it:
fakeroot python do_rootfs_prepend () {
print("==> do_rootfs_prepend")
}
fakeroot python do_rootfs_append () {
print("==> do_rootfs_append")
}
and I see the messages in the log file, so I know this is working to add my python code to the do_rootfs function in image.bbclass.
However, I would still like to know how image.py and a whole bunch of other *.py files are included (e.g. rootfs.py) from the poky/meta/lib/oe directory.
First, note that rootfs/image code has been refactored quite a bit after the Jethro release: the last releases do not have some of the functions referred to in your example.
There's no Yocto-specific magic in the library function usage: they are used via standard python module import, just with meta/lib/ in the module search path, e.g.
from oe.image import create_image
will make the create_image() function from meta/lib/oe/image.py available in the current scope.

Codeigniter Tank_Auth used as a HMVC module along with the Template library

I've successfully configured and run HMVC on my clean install of Codeigniter 2.1.0
Then I've included Template library. It consist of only 3 files: /system/library/Template.php, /application/config/template.php and finally, template file itself (somewhere in /views directory).
I've tested template library while loading one of my created modules. I had to go to /system/library/Template.php to correct paths so they point to my module/views instead of default CI's ones.
Then I tested and it seemed just fine.
The third step is to include Tank_Auth authentication library. I want it to reside in module as well (/modules/auth). This module should have the same directory structure just like a regular app directory does (config, controllers, language, libraries, models, views, etc.) so I can copy Tank_Auth's files to Auth module's respective directories.
Basically, I have already done that copy part. But now when I try to run http://adresar.local/auth/auth/login I get
An Error Was Encountered
Unable to load the requested file: auth/login.php
I've also tried changing
class Auth extends CI_Controller
to
class Auth extends MX_Controller
but to no avail.
If anyone can throw in some useful advice I will appreciate it a lot.