Kernel irq disable - linux-kernel

I am using P2041 with kernel 3.12. I am using xr17v358 for serial interface. When I run serial interface it shows "try to boot with irqpoll" , " disabling irq" and so many trace messages. How to overcome this issue?

Try to boot with "irqpoll" option in uboot kernel command line. This will help the kernel to find proper ISR. After enabling this option your system may get slow.

Related

How to Lock bootloader in source code- U-boot

I want to make my development board's bootloader (which is u-boot) be locked so no one can stop autoboot process at all. (In this way I will be sure that no one can alter the firmware of the board!)
So please guide me in order to locking the firmware and block any "root" attempts. I am using amlogic s905x SoC.
Another question:
Is this process relates to verified boot and signing kernel images?
If your SoC chip supports secure boot, then it is a way to make its firmware, secure of jail breaking. consult the datasheet. Otherwise you can not 'lock' the firmware.
You can use CONFIG_AUTOBOOT_KEYED=Password to require a password for stopping autoboot.
You can use CONFIG_BOOTDELAY=-2 to autoboot with no delay and not check for abort.
This will not stop users with physical access from altering the firmware. They could simply insert there own SD-card or USB stick or reprogram the eMMC.
CONFIG_AUTOBOOT_KEYED will make you live easier if you need to reflash a returned device.

How to ensure bootloader is started

I am working with openmote-cc2538 for the project: https://github.com/cetic/6lbr/wiki
Here when I was trying to flash openmote with this command
sudo make TARGET=cc2538dk BOARD=openmote-CC2538 bootload0/dev/ttyUSB0 slip-radio.upload
This error message is displayed
ERROR:Cant CONNECT TO TARGET:Ensure bootloader is started(no answer on sync sequence)
cc2538 bsl.py script is available for uploading binary to openmote. But I don't have much experience about this. Can anybody give me some suggestions regarding how to proceed??
Grab a scope and probe different digital I/O pins on the CC2538. Typically a bootloader will initialize all the ports on the chip and you will see them change state, which is an indication that the bootloader is indeed running. I would guess one of the LEDs would change state as well (which doesn't require a scope).

How to stop booting of Linux kernel(3.14) if sensor is not able to probe in u-boot?

I ported ADXL345(accelerometer) on AM335x SOC successfully.In mux.c file in u-boot i did changes so that to communicate properly.
But I in case the communication fails, I want kernel not to boot.
please help me in this, correct me if I am wrong.
In your board file, in board_init function add the check for the accelerometer and see if communicates and on failure return -EINVAL, so you board doesnt boot up at all.

How do I access(open/read/etc) /dev devices from a kernel module?

I have received a driver (PCAN driver for PCI card, using rtdm), that creates /dev/pcan0 and /dev/pcan1 is compiled as a netdev driver.
There are many facilities that come with this driver, but they are all targeted at a user-level program reading CAN messages. What I need however is to read these messages from a kernel module. The PCAN driver doesn't export any variables/functions which means it doesn't provide a kernel-level API for me to use.
I looked briefly at the code and reading from the /dev device and writing to it don't use copy_from_user or copy_to_user. Therefore, I thought it should be safe for me to open the /dev/pcan0 from my kernel module and read from it.
Now my question is, how do I open/read from a /dev device from a kernel module?
P.S. I want to read from the CAN bus from an RTAI real-time thread, do you think that would cause a problem (for example every read passing through linux kernel and thus breaking real-time conditions?)
You can use syscalls directly from kernel space: sys_open(), sys_read(), sys_close().
There's Linuxjournal article about that.
P/S: copy_from_user() works perfectly with kernel-space addresses.
Given that I was using RTDM, there were two options:
Using RTDM direct functions, such rt_dev_open, rt_dev_read etc
This is not implemented in the current version of pcan driver
Using RTDM ioctl
This was the solution and it worked

Which module in linux 2.6 kernel should I modify to count the number of ip packets sent/received?

I need to modify a kernel module(s) to count number of packets that the machine has sent / received over my wireless adapter for the linux 2.6 kernel. Please let me know which modules should I modify. Any references would also be helpful.
I am not very sure about wireless adapter, but I think it is similar to a wired one. For wired and wireless NIC, you can use ifconfig eth0 command, then in the output, you will see one or two lines telling you the number of packets sent(TX) or received(RX).
To get the same information from the kernel module, one way is to modify the device driver for the network card. One tutorial about rtl8139 (wired one) is here: http://linuxgazette.net/156/jangir.html
Also, I think there are some standard kernel interface that you can use to get the same info. For example, tp->stats.tx_packets mentioned in the above link.
If you're interested in IP packets you should consider creating a kernel module that uses netfilter hooks. It's very simple, here take a look at this:
http://www.netfilter.org/documentation/HOWTO/netfilter-hacking-HOWTO-3.html
Netfilter is primarily intended for firewalling, but it can do what you want and you don't need to mess with other kernel modules. Hope it helps.
cat /proc/net/dev
is probably not what you want, but then explain why.

Resources