rt-kernel on odroid-U3

Moderators: mdrjr, odroid

rt-kernel on odroid-U3

Unread postby musicjack » Mon Dec 08, 2014 5:09 pm

Hi,
for some days I'm trying to install a rt-kernel on odroid U3. Finally I successfully compiled a kernel 3.8.13.14-rt31 using the original kernel source of 3.8.13 and the patches to 3.8.13.14 and 3.8.13.14-rt31. To make a successful compilation I had to copy all files from the folder firmware of the odroid-kernel package 3.8.y into the firmware folder of the 3.8.13 kernel package. I patched the kerneI, run "make menuconfig" and set the full realtime option. I need full realtime to reduce latency of the audio jack server for using the linuxsampler. (Otherwise the latency is about 23 ms and not acceptable).
After configuration I used the commands to compile and install the kernel on the odroid. ("make", and "make modules_install") I also copied zImage to the boot partition.
However, every try to do it ends up in eighter no change (booting the same old kernel) or in preventing the kernel from beeing booted already (black screen). Everytime the system will not start (and will not show up anything) I have to overwrite the zImage file with the original one, which I have backuped on an other computer. By the way I use an eMMC card.
What can I do to successfully install the rt-kernel, I don't want to spent many other weeks in useless tries, so maybe you have an idea?

Best Regards
musicjack
 
Posts: 9
Joined: Mon Dec 08, 2014 4:54 pm
languages_spoken: english
ODROIDs: U3

Re: rt-kernel on odroid-U3

Unread postby suriyan » Wed Dec 10, 2014 7:01 am

Hello musicjack,
Looks like you have done all the right things. When you copy zImage to the boot partition, is that the VFAT partition (1st DOS partition) on the eMMC? To reduce further complications, I assume you have just the eMMC plugged in and no SD card?
- Suriyan
Edit: You mention original kernel source. I do not think any other kernel source (patched with rt) will run other than the hardkernel source 3.8 or the linux mainline by LiquidAcid.
Edit: Did you check this post: viewtopic.php?f=77&t=4870
suriyan
 
Posts: 473
Joined: Wed Jun 26, 2013 2:41 pm
languages_spoken: english
ODROIDs: odroid-u2/xu-e/u3/x2/xu3/c1

Re: rt-kernel on odroid-U3

Unread postby musicjack » Sat Dec 13, 2014 2:42 am

Hi Suriyan,
thank's for your answer. It looks like there are not so many user out there who want to use a rt-kernel.
To answer your questions:
I have only connected the emmc memory and no sd card. The emmc has two partitions. One is the boot partition and the other one contains anything else. The boot partition is linked to the boot directory of the second partition. I should have automatically copied the zImage into the (first) boot partition by copying it into the boot-directory of the second partition.
You told me that only the original odroid kernel source should work. However, I have pathed the original odroid kernel source with the rt-patch but the compilation turned out in errors. After some tries I could successfully compile a rt-kernel by using the 3.8.13 kernel source from
http://www.kernel.org/pub/linux/kernel/ ... .13.tar.xz
and the patches:
http://www.kernel.org/pub/linux/kernel/ ... 1.patch.gz
and to make the above patch work successfully I had to patch first with:
http://www.kernel.org/pub/linux/kernel/ ... 8.13.14.gz

If I would use the so patched kernel source to compile on odroid-u3 I would get an error because of missing hardware libraries. That's why I have changed the kernel source by using the appropriate files find in:
github.com/hardkernel/linux/tree/odroid-3.8.y/
I just copied the contents of firmware-folder into the firmware-folder of the kernel-source from http://www.kernel.org
I forgot previously to tell, that I copied the config file of the current installed kernel, which is config-3.8.13.27 (because "uname -a" tells me that this is the installed kernel) into the rt-kernel folder and renamed it to .config
I than used the command "make menuconfig" in order to set fully preemtive kernel mode. Compilation by using "make" leads to following output (only warnings are shown):

scripts/kconfig/conf --silentoldconfig Kconfig
warning: (DVB_USB_PCTV452E) selects TTPCI_EEPROM which has unmet direct dependencies (MEDIA_SUPPORT && MEDIA_PCI_SUPPORT && MEDIA_DIGITAL_TV_SUPPORT && I2C)
warning: (DVB_USB_PCTV452E) selects TTPCI_EEPROM which has unmet direct dependencies (MEDIA_SUPPORT && MEDIA_PCI_SUPPORT && MEDIA_DIGITAL_TV_SUPPORT && I2C)

arch/arm/kernel/return_address.c:62:2: warning: #warning "TODO: return_address should use unwind tables" [-Wcpp]
#warning "TODO: return_address should use unwind tables"
^

kernel/rcutree.c: In function 'rcu_init_one':
kernel/rcutree.c:3056:13: warning: array subscript is above array bounds [-Warray-bounds]
rsp->level[i] = rsp->level[i - 1] + rsp->levelcnt[i - 1];
^

fs/nfsd/nfs4state.c: In function 'free_client':
fs/nfsd/nfs4state.c:1045:19: warning: unused variable 'nn' [-Wunused-variable]
struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);
^

drivers/base/regmap/regmap-debugfs.c: In function 'regmap_read_debugfs':
drivers/base/regmap/regmap-debugfs.c:180:9: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
for (i = start_reg; i <= to; i += map->reg_stride) {
^

drivers/gpio/gpio-samsung.c:449:32: warning: 'exynos_gpio_cfg' defined but not used [-Wunused-variable]
static struct samsung_gpio_cfg exynos_gpio_cfg = {
^
drivers/gpio/gpio-samsung.c:2190:33: warning: 'exynos4_gpios_1' defined but not used [-Wunused-variable]
static struct samsung_gpio_chip exynos4_gpios_1[] = {
^
drivers/gpio/gpio-samsung.c:2292:33: warning: 'exynos4_gpios_2' defined but not used [-Wunused-variable]
static struct samsung_gpio_chip exynos4_gpios_2[] = {
^
drivers/gpio/gpio-samsung.c:2437:33: warning: 'exynos4_gpios_3' defined but not used [-Wunused-variable]
static struct samsung_gpio_chip exynos4_gpios_3[] = {
^
drivers/gpio/gpio-samsung.c:2782:20: warning: 'exynos_gpiolib_attach_ofnode' defined but not used [-Wunused-function]
static __init void exynos_gpiolib_attach_ofnode(struct samsung_gpio_chip *chip,
^

drivers/input/joystick/analog.c:175:2: warning: #warning Precise timer not defined for this architecture. [-Wcpp]
#warning Precise timer not defined for this architecture.
^

drivers/md/dm-raid.c: In function 'raid_ctr':
drivers/md/dm-raid.c:399:53: warning: 'rebuilds_per_group' may be used uninitialized in this function [-Wmaybe-uninitialized]
!test_bit(In_sync, &rs->dev[d].rdev.flags)) &&
^
drivers/md/dm-raid.c:354:11: note: 'rebuilds_per_group' was declared here
unsigned rebuilds_per_group, copies, d;
^

drivers/usb/gadget/inode.c: In function 'ep_io':
drivers/usb/gadget/inode.c:341:3: warning: passing argument 1 of 'prepare_to_wait' from incompatible pointer type [enabled by default]
value = wait_event_interruptible (done.wait, done.done);
^
In file included from include/linux/mmzone.h:9:0,
from include/linux/gfp.h:4,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/usb/gadget/inode.c:17:
include/linux/wait.h:795:6: note: expected 'struct wait_queue_head_t *' but argument is of type 'struct swait_head *'
void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state);
^
drivers/usb/gadget/inode.c:341:3: warning: passing argument 1 of 'finish_wait' from incompatible pointer type [enabled by default]
value = wait_event_interruptible (done.wait, done.done);
^
In file included from include/linux/mmzone.h:9:0,
from include/linux/gfp.h:4,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/usb/gadget/inode.c:17:
include/linux/wait.h:797:6: note: expected 'struct wait_queue_head_t *' but argument is of type 'struct swait_head *'
void finish_wait(wait_queue_head_t *q, wait_queue_t *wait);
^
drivers/usb/gadget/inode.c:350:5: warning: passing argument 1 of 'prepare_to_wait' from incompatible pointer type [enabled by default]
wait_event (done.wait, done.done);
^
In file included from include/linux/mmzone.h:9:0,
from include/linux/gfp.h:4,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/usb/gadget/inode.c:17:
include/linux/wait.h:795:6: note: expected 'struct wait_queue_head_t *' but argument is of type 'struct swait_head *'
void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state);
^
drivers/usb/gadget/inode.c:350:5: warning: passing argument 1 of 'finish_wait' from incompatible pointer type [enabled by default]
wait_event (done.wait, done.done);
^
In file included from include/linux/mmzone.h:9:0,
from include/linux/gfp.h:4,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/usb/gadget/inode.c:17:
include/linux/wait.h:797:6: note: expected 'struct wait_queue_head_t *' but argument is of type 'struct swait_head *'
void finish_wait(wait_queue_head_t *q, wait_queue_t *wait);
^

In file included from drivers/usb/gadget/g_ffs.c:50:0:
drivers/usb/gadget/f_fs.c: In function 'ffs_data_put':
drivers/usb/gadget/f_fs.c:1286:3: warning: passing argument 1 of 'waitqueue_active' from incompatible pointer type [enabled by default]
BUG_ON(waitqueue_active(&ffs->ev.waitq) ||
^
In file included from include/linux/mmzone.h:9:0,
from include/linux/gfp.h:4,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/usb/gadget/g_ffs.c:15:
include/linux/wait.h:96:19: note: expected 'struct wait_queue_head_t *' but argument is of type 'struct swait_head *'
static inline int waitqueue_active(wait_queue_head_t *q)
^

net/sunrpc/svc.c: In function 'svc_printk':
net/sunrpc/svc.c:1041:8: warning: unused variable 'buf' [-Wunused-variable]
char buf[RPC_MAX_ADDRBUFLEN];
^

do you think this can be a reason that the kernel is not started or maybe working?
musicjack
 
Posts: 9
Joined: Mon Dec 08, 2014 4:54 pm
languages_spoken: english
ODROIDs: U3

Re: rt-kernel on odroid-U3

Unread postby suriyan » Sat Dec 13, 2014 4:39 am

Hi musicjack,
The kernel source from kernel.org (3.8.whatever) does not have support for the odroid-U3. Hence, even if you succesfully get it compiled, it shall not run. period.

I can help you with getting the RT kernel compiled with the HK 3.8.y tree if that would work for you.
- Suriyan
suriyan
 
Posts: 473
Joined: Wed Jun 26, 2013 2:41 pm
languages_spoken: english
ODROIDs: odroid-u2/xu-e/u3/x2/xu3/c1

Re: rt-kernel on odroid-U3

Unread postby musicjack » Sat Dec 13, 2014 7:01 pm

Hi suriyan,
I thought just using the content of the firmware folder would do the job. If you could help my to get the rt kernel compiled, that would be great. In fact, any kernel from 2.6 to the latest would do if they was a rt-kernel. I would be happy if you could help me.
musicjack
 
Posts: 9
Joined: Mon Dec 08, 2014 4:54 pm
languages_spoken: english
ODROIDs: U3

Re: rt-kernel on odroid-U3

Unread postby suriyan » Sun Dec 14, 2014 3:46 am

Here are the steps musicjack.

1. Get the latest HK kernel source for odroidu:
Code: Select all
git clone https://github.com/hardkernel/linux.git -b odroid-3.8.y --depth=1 odroidu-3.8.y

2. Get the RT patch for 3.8.y from kernel.org and apply it:
Code: Select all
cd odroidu-3.8.y
wget https://www.kernel.org/pub/linux/kernel/projects/rt/3.8/patch-3.8.13.14-rt31.patch.xz
xz -d patch-3.8.13.14-rt31.patch.xz
patch -p1 < {path to .patch file}

3. Resolve the rejects.
1st failure drivers/md/raid5.c.rej
do a spin_lock_init(&conf->percpu->lock) instead before the ifdef at line 5158

2nd failure seen in include/linux/irqdesc.h.rej
Trivial merge: add u64 random_ip; after irqs_unhandled;

3rd failure seen in kernel/irq/manage.c
Trivial merge: add the rej file from line 163 etc.

4. Add the UART OOPs patch for samsung
Basically in function s3c24xx_serial_rx_chars() in drivers/tty/serial/samsung.c:
+ spin_unlock(&port->lock);
tty_flip_buffer_push(tty);
+ spin_lock(&port->lock);

5. Compile kernel
Code: Select all
make odroidu_defconfig
make menuconfig

Kernel Feature -> Preemption Model -> Fully Preemptible kernel
Also disable Aufs for now as it gives a compilation issue.
Ubuntu supplied Third-Party device drivers -> Aufs (unselect)
Code: Select all
make -j <whatever> zImage modules


6. Update SD/eMMC card with kernel and modules.
VFAT 1st partition -> save zImage as zImage.org and copy the compiled zImage from arch/arm/boot/zImage in its place.
make modules_install (to install the modules)

7. Reboot and voila!
Code: Select all
root@odroid:~# uname -a
Linux odroid 3.8.13.28-rt31 #3 SMP PREEMPT RT Sat Dec 13 10:33:43 PST 2014 armv7l armv7l armv7l GNU/Linux


Hope that helps you out!
- Suriyan
suriyan
 
Posts: 473
Joined: Wed Jun 26, 2013 2:41 pm
languages_spoken: english
ODROIDs: odroid-u2/xu-e/u3/x2/xu3/c1

Re: rt-kernel on odroid-U3

Unread postby venkatbo » Sun Dec 14, 2014 4:47 am

Here are the steps ...

நல்ல வேலை, லினக்ஸ் கர்னல் குரு! ;!)
(Transliterated from Suriyan's Tamil: Good job, linux kernel guru)
User avatar
venkatbo
 
Posts: 454
Joined: Mon Feb 25, 2013 3:10 pm
Location: Bay Area, California
languages_spoken: english
ODROIDs: C0/C1+/C2 U3+ XU3-Lite/XU4 VU/VU7+ Touchscreen Show TFT Cloudshell SmartPower mAHRS DAC GPS Multiscope

Re: rt-kernel on odroid-U3

Unread postby suriyan » Sun Dec 14, 2014 7:03 am

நல்ல வேலை, லினக்ஸ் கர்னல் குரு! ;!)

மிக்க நன்றி வெங்கட் ஸார்!
suriyan
 
Posts: 473
Joined: Wed Jun 26, 2013 2:41 pm
languages_spoken: english
ODROIDs: odroid-u2/xu-e/u3/x2/xu3/c1

Re: rt-kernel on odroid-U3

Unread postby musicjack » Mon Dec 15, 2014 4:54 am

Dear Suriyan,
thank's for your time in dealing with the rt-kernel.
Because I'm not a profi, like you maybe, I encountered some problems, I guess, because I don't quite know what to do.

3. Resolve the rejects.
1st failure drivers/md/raid5.c.rej
do a spin_lock_init(&conf->percpu->lock) instead before the ifdef at line 5158


here, I just entered the command spin_lock_init(&conf->percpu->lock) in the line 5158 of the file raid5.c, before the #ifdef CONFIG_HOTPLUG_CPU
I did not remove or add anything else.

2nd failure seen in include/linux/irqdesc.h.rej
Trivial merge: add u64 random_ip; after irqs_unhandled;


here, I entered the int variable. the lines look like:
unsigned int irqs_unhandled;
u64 random_ip;
atomic_t threads_handled;

3rd failure seen in kernel/irq/manage.c
Trivial merge: add the rej file from line 163 etc.


this is strange for me. I added the file manage.c.rej in line 163 of manage.c which looks like:
}
#include "manage.c.rej"
return ret;

4. Add the UART OOPs patch for samsung
Basically in function s3c24xx_serial_rx_chars() in drivers/tty/serial/samsung.c:
+ spin_unlock(&port->lock);
tty_flip_buffer_push(tty);
+ spin_lock(&port->lock);


here, I just added the spin lock commands in the file samsung.c in line 304 and 306 which looks now like:
}
spin_unlock(&port->lock);
tty_flip_buffer_push(tty);
spin_lock(&port->lock);
out:

compiling showed up some messages like notes and warnings, and finally an error and stopped:
LD drivers/media/usb/built-in.o
LD drivers/media/built-in.o
make: *** [drivers] Error 2
LD [M] fs/xfs/xfs.o
LD fs/built-in.o

I did something wrong before compiling but what. I would appreciate very much, if you could specify what exactly I did or what was expected from me.
Thank's in advance
musicjack
 
Posts: 9
Joined: Mon Dec 08, 2014 4:54 pm
languages_spoken: english
ODROIDs: U3

Re: rt-kernel on odroid-U3

Unread postby suriyan » Mon Dec 15, 2014 8:25 am

3rd failure seen in kernel/irq/manage.c
Trivial merge: add the rej file from line 163 etc.


this is strange for me. I added the file manage.c.rej in line 163 of manage.c which looks like:
}
#include "manage.c.rej"
return ret;


As your intuition prevailed, I too believe this is the cause of the error. When I meant include I wanted you to manually add the contents of the rej file sans the other patch related information. Your solution is elegant :-)
But can you please remove the headers present in the .rej file.
For example I am assuming you will see that the manage.c.rej file would have contents as below:
Code: Select all
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index fbf0af9..a3cf48e 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -163,6 +163,62 @@ int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask,
        return ret;
 }

+#ifdef CONFIG_PREEMPT_RT_FULL
... (many more lines beginning with +


You should edit this file so that you remove all the lines till you hit the +#ifdef ... line.
You should then edit this file so that you remove the + from the beginning of all the remaining lines which start with a +.
That takes care of the first part. The second part to this is that where you have added the #include "manage.c.rej" in the file.
Could you please add it after the closing } - should be line 165. It will look like this:
Code: Select all
        }

        return ret;
}
#include "manage.c.rej"


Also if it doesn't compile inspite of this, can you attach your kernel/irq/manage.c and kernel/irq/manage.c.rej files please?
Thanks
- Suriyan
suriyan
 
Posts: 473
Joined: Wed Jun 26, 2013 2:41 pm
languages_spoken: english
ODROIDs: odroid-u2/xu-e/u3/x2/xu3/c1

Re: rt-kernel on odroid-U3

Unread postby musicjack » Wed Dec 17, 2014 4:19 am

Dear Suriyan,
I have tried several times to compile the kernel but without any success.
I have attached the compile output messages, as you will see it ends with
an error. I have also attached the manage file you asked for.
compilation.tar.gz
contains the mentioned files
(37.37 KiB) Downloaded 118 times

Do you use odroid u3 with an emmc memory? Can you provide the ready to use rt-kernel if I have no success, so that I can try yours instead?

Thanks in advance
musicjack
 
Posts: 9
Joined: Mon Dec 08, 2014 4:54 pm
languages_spoken: english
ODROIDs: U3

Re: rt-kernel on odroid-U3

Unread postby suriyan » Wed Dec 17, 2014 4:34 am

Hello musicjack,
The manage.c that you have attached is perfect. So, that is good. Thanks for including the compile output. It helped me narrow down the issue.

The issue is in the
here, I just entered the command spin_lock_init(&conf->percpu->lock) in the line 5158 of the file raid5.c, before the #ifdef CONFIG_HOTPLUG_CPU
I did not remove or add anything else.

Can you please add a ';' after ) It will look like:
Code: Select all
spin_lock_init(&conf->percpu->lock);


That should resolve your issues!
Thanks
- Suriyan
PS: Its better if you get it compiled as it will give you some kind of independence in case you wanted to do more changes. I can help you out all the way! So, no issues there. Worst case, I can give you the kernel and modules.
suriyan
 
Posts: 473
Joined: Wed Jun 26, 2013 2:41 pm
languages_spoken: english
ODROIDs: odroid-u2/xu-e/u3/x2/xu3/c1

Re: rt-kernel on odroid-U3

Unread postby musicjack » Thu Dec 18, 2014 2:55 am

Dear Suriyan,
indeed, it was the missing semicolon. I recompiled it, installed the kernel and the modules and after reboot:

odroid@odroid:~$ uname -a
Linux odroid 3.8.13.28-rt31 #1 SMP PREEMPT RT Wed Dec 17 18:16:57 CET 2014 armv7l armv7l armv7l GNU/Linux
odroid@odroid:~$

You are my hero. This is a great Xmas gift for me. Thank you a lot :D
musicjack
 
Posts: 9
Joined: Mon Dec 08, 2014 4:54 pm
languages_spoken: english
ODROIDs: U3

Re: rt-kernel on odroid-U3

Unread postby suriyan » Thu Dec 18, 2014 2:58 am

Merry christmas and a happy new year!
suriyan
 
Posts: 473
Joined: Wed Jun 26, 2013 2:41 pm
languages_spoken: english
ODROIDs: odroid-u2/xu-e/u3/x2/xu3/c1

Re: rt-kernel on odroid-U3

Unread postby musicjack » Thu Dec 18, 2014 3:04 am

I, too wish you a Merry Christmas, and a happy new year!
musicjack
 
Posts: 9
Joined: Mon Dec 08, 2014 4:54 pm
languages_spoken: english
ODROIDs: U3

Re: rt-kernel on odroid-U3

Unread postby bmentink » Tue Jan 12, 2016 2:51 am

Hi All,

I know this thread is quite old, but can anyone tell me what kernel config file to use for the -XU3?
Is it "odroidx_defconfig" or "odroidx2_defconfig" or still the same one above "odroidu_defconfig" or is there not one for the -XU3 available

Thanks,
bmentink
 
Posts: 386
Joined: Sat Dec 13, 2014 1:47 pm
languages_spoken: english
ODROIDs: XU3, XU4

Re: rt-kernel on odroid-U3

Unread postby odroid » Tue Jan 12, 2016 9:08 am

I think XU3/XU4 needs further works to enable the full RT kernel.
viewtopic.php?f=95&t=17954
User avatar
odroid
Site Admin
 
Posts: 28214
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: rt-kernel on odroid-U3

Unread postby krebetman » Thu Jan 05, 2017 9:40 pm

musicjack wrote:Dear Suriyan,
indeed, it was the missing semicolon. I recompiled it, installed the kernel and the modules and after reboot:

odroid@odroid:~$ uname -a
Linux odroid 3.8.13.28-rt31 #1 SMP PREEMPT RT Wed Dec 17 18:16:57 CET 2014 armv7l armv7l armv7l GNU/Linux
odroid@odroid:~$

You are my hero. This is a great Xmas gift for me. Thank you a lot :D



Old thread, I know, but @musicjack - would you happen to have an image of your RT kernel build to share?
krebetman
 
Posts: 1
Joined: Thu Jan 05, 2017 9:35 pm
languages_spoken: english
ODROIDs: U3


Return to Other OS

Who is online

Users browsing this forum: No registered users and 1 guest