Skip to main content

[LEGOEV3] About Ev3dev kernel upgrading, real-time operating system, and bugs in 4.10 linux kernel.

By following the tutorial in Ev3, one who is interested to run Linux on Ev3 should be able to have Debian with 3.16.7 linux kernel with the internet feature. For the research/lecture usage, I start to patch 4.10 Linux kernel and litmus-RT on it. I will list and update the possible delights for some of students who are just starting to develop Linux kernel stuffs.
If in Ev3dev wget fails, please add on --no-check-certificate in the option before the download link.

Ref:http://www.tecmint.com/install-kernel-3-16-in-debian/

As far as we can find, https://www.youtube.com/watch?v=PGy5XrI6lLs provides the video about how to patching Linux kernel for LitmusRT. The tutorial in installation page (https://wiki.litmus-rt.org/litmus/InstallationInstructions) is missing the command for the newbie who is lacking experience of linux tools:
sudo apt-get install build-essential kernel-package \
libncurse5-dev bzip2 fakeroot \
And use the following command for wrapping the kernel as deb package file:
fakeroot make-kpkg --initrd --append-to-version=-litmusRT \
kernel-image kernel-headers 

The version is 3.10 in the video. There must be some tiny bug if one directly follows it for the latest version 4.10 (as the trace option is involved). The bug [ref] is in the caller of __dynamic_dev_dbg function in usb driver as102, i.e., drivers/media/usb/as102/as102_usb_drv.c. To fix it, please add "&" before bus_adap->usb_deb->dev in line 117 and 135:
dev_dbg(bus_adap->usb_dev->dev, ...
It should becomes to:
dev_dbg(&bus_adap->usb_dev->dev, ... 
In fact, the author of LitmusRT answer the question: https://lists.litmus-rt.org/pipermail/litmus-dev/2016/001219.html
 
In addition, there is another bug in init/do_mounts.o failed, so far I haven't yet to fix it on Ev3.

If you get the warning that clock skew detected, it should be fixed by using the following commands to update the date on EV3:
date -s mm/dd/yy
date -s hh:mm:ss

--------------- LEGO Mindstorms Real-Time Operating System -------------
First of all, nxtOSEK is not good enough, as it lacks the ability of fully preemption.
We can find out a project that try to solve the problem: http://moss.csc.ncsu.edu/~mueller/rt/rt14/projects/p1/report4.pdf

Quote:"The nxtOSEK kernel has been purposefully designed to prevent successive instances of preemption i.e. the kernel does not support a case where after one preemption event, while the preempting task is yet to finish its execution, it is preempted in turn by an even higher priority task. In this project, we attempted to resolve this by modifying the current kernel behavior. ..."

However, the project to the end is not able to fix the problem:
Quote: "We weren't able to demonstrate successful return to the preempted task after the high priority task finishes its execution. Instead, we observed the controller getting reset after the completion of the higher priority task. We couldn't resolve this due to limited debug/simulation capabilities."

In EV3, OSPERT'14 has a workshop paper, which is also the producer of nxtOSEK:
"A Platform for LEGO Mindstorms EV3 Based on an RTOS with MMU Support"
https://www.mpi-sws.org/~bbb/proceedings/ospert14-proceedings.pdf
However, the developer said it is out-of-date and not compatible with recent arm-none-eabi
compilers. In fact, a new platform called EV3RT now is released. You can find more information here (http://ev3rt-git.github.io/ and http://dev.toppers.jp/trac_user/ev3pf/wiki/WhatsEV3RT) (in Japanese).

Comments

  1. May I ask whether you succeeded in patching the EV3 kernel with the Litmus-RT patch?

    ReplyDelete
    Replies
    1. I'm sorry that at the end we couldn't boot it :( To the end, we choose to use a new distribution called EV3OSEK.

      Delete
    2. Real-time linux may be more easier to deploy https://rt.wiki.kernel.org/index.php/Main_Page on EV3dev.

      Delete
    3. Thank you very much for your reply.

      Great that you mention EV3OSEK. I'm the project leader (or principal investigator so to say). My students and me are always happy to help with ev3osek. Just get in touch...

      I could also send you the project report providing details about porting nxtOSEK to EV3. Just drop me a line...

      Since EV3OSEK is currently missing a driver for the Mindstorm's LCD display and nxtOSEK has a bug (as you pointed out to us (https://github.com/ev3osek/ev3osek/issues/8)), I'm currently looking into the RT Preempt patch for Linux (as you suggested). I managed to patch the ev3dev kernel. However, some drivers do not work reliably (Wifi, USB). I'm still looking into this issue. You may want to have a look here: https://github.com/ev3dev/ev3dev/issues/779

      Delete
    4. :) I didn't notice that you are the person I talked to.

      I have one good but one bad news about the preemption in EV3OSEK (Just found it yesterday): The nested preemption problem somehow is gone but the context switch has a flaw. The first guess is that the values in the registers are not stored properly. Therefore, when the execution of preempted task is resumed, the elapsed processing is gone.

      May I have your project report about your porting? I think I can make some efforts there :) I can give you more detailed about the observation we have. My email: kuan-hsun.chen@tu-dortmund.de

      Delete

Post a Comment

Popular posts from this blog

RSB+RTEMS 5/6 with QEMU-SMP (ARM realview_pbx_a9_qemu as example)

Since I got a request regarding this blog  written in 2016, summarizing again the complete flow with the latest version of RTEMS could be a good idea. Prepare a suitable workspace according to the adopted operating system on your host ( https://docs.rtems.org/branches/master/user/hosts/index.html ):  sudo apt-get build-dep build-essential gcc-defaults g++ gdb git unzip pax bison flex texinfo unzip python3-dev libpython-dev libncurses5-dev zlib1g-dev Checkout RSB and build: git clone git://git.rtems.org/rtems-source-builder.git rsb change directory to rsb/rtems/ and type ../source-builder/sb-set-builder --prefix=<the path you like to store the built toolchains> <the name of bsp> For example, to use QEMU, I need toolchains for ARM, so: ../source-builder/sb-set-builder --prefix=/home/kh.chen/respository/build/. 6/rtems-arm This will take a while. Please ensure your connection is reliable. Add the built folder into your PATH. For example, you can add one line in ~/.bas...

[Gem5] Full system Simulation with Official Kernel

I follow the youtube provided by Gem5 to get the inspiration. (http://gem5.org/Running_gem5#Full_System_.28FS.29_Mode) I download the file here: http://www.gem5.org/dist/current/arm/ with http://www.gem5.org/dist/current/arm/aarch-system-20170616.tar.xz Then Set up M5_PATH as the place I extract the files: "/home/khchen/full_system_images/" If the setting is correct, assigning the disk-image will finish the rest of setting for dtb and kernel specifications. So far I can only use this img (aarch32-ubuntu-natty-headless.img) as my disk-image to run up to the login interface of the ubuntu: build/ARM/gem5.opt configs/example/fs.py --disk-image=/home/khchen/full_system_images/disks/aarch32-ubuntu-natty-headless.img With the other imgs, for example like "aarch64-ubuntu-trusty-headless.img", I think the kernel and the dtb should be given manually, because it will automatically load something with aarch32 prefix which doesn't make sense: info: kernel ...

[ubuntu] Removing the instance/package which is not fully installed from apt-get

When I'm installing g77-3.4 for pgplot, I trivially use dkpg to install it. However, g77-3.4-doc is not able to fully installed. And I stuck for this kind of error due to the broken packages (refer to here ): dpkg: error processing realplayer (--configure/--purge/--remove): (Whatever messages) Errors were encountered while processing: g77-3.4-doc cd /var/lib/dpkg/info sudo rm g77-3.4-doc* sudo dpkg --remove --force-remove-reinstreq g77-3.4-doc Hmm, now apt-get works well again. https://www.youtube.com/watch?v=S9HJ-iAzf3k