Want to send some patches to the Linux kernel? I used Coccinelle to find then and else statements that are identical. Coccinelle found 80 candidates. The output is here , and the Coccinelle script I used: @@ statement S; @@ -if (...) - S -else - S + S
Posts
Building Yocto for DENX M53EVK
- Get link
- X
- Other Apps
# Depending on when you are reading this, you may need to replace "krogoth" by something newer # Step 1: Clonning $ git clone git://git.yoctoproject.org/poky $ cd poky/ $ git checkout krogoth $ git clone git://git.openembedded.org/meta-openembedded $ cd meta-openembedded $ git checkout krogoth $ cd .. $ git clone git://git.yoctoproject.org/meta-fsl-arm $ cd meta-fsl-arm $ git checkout krogoth $ cd .. $ git clone git://github.com/Freescale/meta-fsl-arm-extra.git $ cd meta-fsl-arm-extra $ git checkout krogoth $ cd .. # Step 2: Configuring $ export MACHINE="m53evk" $ source oe-init-build-env # Then edit your bblayers.conf file to add meta-openembedded/meta-oe, meta-fsl-arm, and meta-fsl-arm-extra: $ vi conf/bblayers.conf # (.../poky/build/conf/bblayers.conf) # POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf # changes incomp...
git rebase eats my commits when the rebase fail... (no, not really)
- Get link
- X
- Other Apps
I'm playing with git --rebase for the first time. The first patch of the series was fixing coding style, but it was also introducing some coding style errors related to continuation lines. Instead of adding two additional tabs, I was aligning the continuation lines with the previous opening parenthesis. Oops. So I needed to edit the first commit of the series to be able to resent all of them. git makes it quite convenient, right? $ git --rebase --interactive <commit hash>^ Then git will show a text file for you to edit and choose what to do with each commits. Everything fine until now. My workflow is $ vi path/to/file.c $ make path/to/file.o $ git add path/to/file.c $ git commit --amend $ git rebase --continue Well this is awesome, and I had fun rebasing all my 11 commits and it was looking very good. Even when the automatic rebase doesn't wor...
bool b = -1; if(b) printk("Yes, -1 maps to true!");
- Get link
- X
- Other Apps
/* Assign -1 to bool variable */ bool b = -1; if(b) printk("Yes, -1 maps to true!"); /* Return -1 in bool function */ bool f(void) { return -1; } if (f()) printk("Yes, -1 maps to true!"); Yesterday I was reading this interesting discussion about the boolean type in C. The most interesting sentence was: "0 is false, 1 is true, any other value is *undefined behavior*." Then I started to look for abuses of the bool type in the Linux kernel. I wrote simple semantic patches for getting cases in which a negative values are being returned by bool functions: @@ identifier f, ret; constant C; typedef bool; @@ bool f (...){ <+... ret = -C; ... * return ret; ...+> } and @@ identifier f; constant C; typedef bool; @@ bool f (...){ <+... * return -C; ...+> } The first search for boolean functions that assign negative value to a ...
Adding a serial console to the Buffalo Air Station WZR-1750DHP
- Get link
- X
- Other Apps
Playing with custom kernels and OpenWRT... It took me more than a month to flash a kernel that won't boot, but I did it yesterday. So the only way was to open the case, and connect the cables to access the serial console. Here is what I learned. Before you start Tools For opening the case you will need to remove two screws that are similar to those of mobile phones. I don't know the type name nor the size, so I recommend you to check type and size before starting. The screws are under the adhesive on the back of the router near the power plug and the mode button. UPDATE: Matt Sealey posted a comment saying that the screws are Torx T6. Thank you Matt! USB to Serial You will need something to connect your computer to the serial interface of the router. The most common solution is to use an USB to serial adapter. There are plenty of options, but I'm using this one that I bought on Ebay for less than € 10. Search for 'FT232RL' on your favorite online store....
Buffalo WZR-1750DHP + OpenWRT
- Get link
- X
- Other Apps
This is the first of a series of posts about Linux kernel development for ARM. There will be one or two more posts before we get into the Kernel, describing tasks as building, and configuring OpenWRT. Maybe I'll also write about de-bricking devices if I manage to do something silly with my router. :-) What I like about the Buffalo WZR-1750DHP are the specs and the case without external antennas. It has a dual core ARM CPU with 512MB of RAM, and two wifi adapters: One for 2.4GHz and other for 5GHz. I was expecting that to install OpenWRT in a device like the WZR-1750DHP, it would require to find and use a serial port. Luckily that's not necessary. All the procedure was done over friendly web interfaces. As the router do not allow to install random firmware images, there are some workarounds to install OpenWRT. The steps I used are: 1 - Install and upgrade DD-WRT Download the latest versions of the files factory-to-dd-wrt.bin and buffalo-wzr...
Broken resume after suspend to ram on Toshiba R830-10p
- Get link
- X
- Other Apps
Resume after suspend to RAM is broken on Toshiba R830. I want to fix it. Can you help me, or introduce me to someone who can help me? Somehow the bug is related to Intel VT-d or x2apic . Disabling VT-d on the BIOS, makes the resume work. With VT-d enabled, passing nox2apic as boot parameter to Kernel also makes the resume work. I've asked for help: https://lkml.org/lkml/2013/11/1/186 The current issue is that my notebook doesn't have real serial port, so I can't track what's going on. Suspend / resume steps before calling the platform firmware work perfectly. So it works perfectly if I echo freeze > /sys/power/state... Ideas? Any creative idea on using systemtap to debug this issue?
Debugging suspend on Toshiba R830-10p: Some test results and logs
- Get link
- X
- Other Apps
When testing suspend to RAM, all tests went well. But the real thing doesn't work... Ideas? # echo freezer > /sys/power/pm_test # echo mem > /sys/power/state [27354.755748] PM: Syncing filesystems ... done. [27354.780184] PM: Preparing system for mem sleep [27354.780687] Freezing user space processes ... (elapsed 0.007 seconds) done. [27354.787975] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. [27354.789133] suspend debug: Waiting for 5 seconds. [27359.783027] PM: Finishing wakeup. [27359.783028] Restarting tasks ... done. [27359.784320] video LNXVIDEO:01: Restoring backlight state # echo devices > /sys/power/pm_test # echo mem > /sys/power/state [27476.796841] PM: Syncing filesystems ... done. [27476.820641] PM: Preparing system for mem sleep [27476.820952] Freezing user space processes ... (elapsed 0.001 seconds) done. [27476.822083] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. [27476.823290...
Fedora: Compile a single module directory for current running Kernel
- Get link
- X
- Other Apps
Sometimes one may want to just compile a single module and use it without rebooting the machine. In my case I wanted to play with 8139cp/8139too modules inside a KVM virtual machine running Fedora. There are two requirements: 1 - Kernel source code 2 - Kernel development package The source code is where to do the changes, while the development package contains the headers that allow to compile Kernel modules with the right version magic. There are some options for obtaining the Kernel source code, but here the Fedora way is listed. You could probably download the Kernel from http://kernel.org . Install packages, prepare RPM buil tree, and "install" the source code(Fedora way): [fedora] $ sudo yum install @"Development Tools" rpmdevtools yum-utils ncurses-devel [fedora] $ rpmdev-setuptree [fedora] $ yumdownloader --source kernel [fedora] $ sudo yum-builddep kernel-<version>.src.rpm [fedora] $ rpm -Uvh kernel-<version>.src.rpm Prepare the...
What are the source code files associated to Kconfig symbol?
- Get link
- X
- Other Apps
I needed a way to discover which Linux source code files are related to a Kconfig symbol. As there is at least one Kconfig symbol for each Linux device driver, how could I find out what files are part of a device driver based on a single, or a set, of Kconfig symbols? I made a Perl script for that. For example: $ cd /src/linux/drivers/net/ethernet $ Kconfig-files.pl ALX atheros/alx/hw.h atheros/alx/hw.c atheros/alx/ethtool.c atheros/alx/main.c atheros/alx/alx.h atheros/alx/reg.h All source files associated to the ALX Kconfig symbol are listed. The script is at Github .
make localmodconfig
- Get link
- X
- Other Apps
Always wanted easy way of creating good config for compiling your own Kernel? You should try make localmodconfig Before running make localmodconfig connect everything you want to work on your custom Kernel like USB pen drives and webcamera. make localmodconfig probes for loaded modules and make a new CONFIG for you. From: http://www.h-online.com/open/features/Good-and-quick-kernel-configuration-creation-1403046.html Thanks to +Thorsten Leemhuis
%.*s - Weird printk or Format of the format string
- Get link
- X
- Other Apps
See this patch: https://lkml.org/lkml/2012/8/21/46 The author suggests: - p9_debug(P9_DEBUG_VFS, "%s -> %s (%s)\n", - dentry->d_name.name, st->extension, buffer); + p9_debug(P9_DEBUG_VFS, "%s -> %s (%.*s)\n", + dentry->d_name.name, st->extension, buflen, buffer); But what the heck does %.*s? And why buflen variable was added as parameter to p9_debug? What would be the output of the C program above: #include <stdio.h> void main () { int i; char *ab ="abcdefghi"; for (i = 0; i < 10; i++) printf ("%.*s\n", i, ab); } [peter@ace tmp]$ gcc test.c;./a.out a ab abc abcd abcde abcdef abcdefg abcdefgh abcdefghi Cool huh?
It is not enough to fix a bug and describe it correctly...
- Get link
- X
- Other Apps
I'm sending a lot of patches. Many are just being accepted. But there is one very interesting rejection. I have not received nack, and the patch was not directed to /dev/null. The maintainers are happy with the code, but they "really" want me to do a very specific commit message. See the full thread: http://www.kernelhub.org/?p=2&msg=139304
How to write commit messages?
- Get link
- X
- Other Apps
From: Linus Torvalds <torvalds@linux-foundation.org> Newsgroups: fa.linux.kernel Subject: Re: [PATCH] Bugfix to commit Date: Tue, 23 Oct 2007 15:53:41 UTC Message-ID: <fa.kLlZ0+PrvWCrpZjNV34+zBLE2ro@ifi.uio.no> On Tue, 23 Oct 2007, Olaf Hering wrote: > > On Mon, Oct 22, Grant Likely wrote: > > > Olaf, do I have the correct solution here? > > Sure. Side note: I already applied that patch, but take a look at the commit message. That's right: I had to edit the message provided to make it readable. So I'll just take this opportunity to ask people that when they send bug-fixes, please try to make the subject line and message make sense for a *reader*, not for yourself (or even to me, although if it's readable to some generic person, it's hopefully readable to me too!). So a subject line of "Bugfix to commit <commit-sha-goes-here>" is obviously not a very nice one, if you're looking at the kernel co...