Slashdot Mirror


Linux Kernel 2.4 Or 2.6 In Embedded System?

snikulin writes "My 6-year-old embedded software happily runs on kernel v2.4 on an XScale CPU. The software gets a bunch (tens of megabytes) of data from an FPGA over a PCI-X bus and pushes it out over GigE to data-processing equipment. The tool chain is based on the somewhat outdated gcc v2.95. Now, for certain technical reasons we want to jump from the ARM-based custom board to an Atom-based COM Express module. This implies that I'll need to re-create a Linux RAM disk from scratch along with the tool chain. The functionality of the software will be essentially the same. My question: is it worth it to jump to kernel 2.6, or better to stick with the old and proven 2.4? What will I gain and what will I lose if I stay at 2.4 (besides the modern gcc compiler and the other related dev tools)?"

25 of 178 comments (clear)

  1. testing? by robvangelder · · Score: 5, Informative

    if you're migrating, no doubt you're performing tests to ensure your product is still fit.
    once you have your test plan ready, determining fitness against either kernel should be straight-forward.

    1. Re:testing? by joaommp · · Score: 5, Insightful

      actually, why was this modded flamebait? despite the fact that it doesn't give a direct answer to the question (99.9% of posts don't even give any answer, direct or indirect to the questions), the post actually makes sense and is relevant. With a test plan there is the possibility to find incompatibilities that don't pop out at first sight and that may force the guy to stick to the older kernel and, thus, voiding the 'is it worth it'-question with an 'is it possible'-question.

    2. Re:testing? by DuckDodgers · · Score: 5, Insightful

      Your solution requires the post submitter to do all of the work to create his solution for both kernels, and then compare them.

      If someone asked whether to build a reasonably complex website in Python or PHP would you recommend that they build both and then performance test them? That's a lot of extra work.

      In both the original post submitter's case and the hypothetical one I suggested, it would be much easier to gather as much information you reasonably can about both solutions and then make an educated guess as to the best option. I'm not sure Slashdot is the best place for his information gathering, but I understand what he is doing.

  2. Why Linux? by TheRaven64 · · Score: 5, Informative

    2.4 is horrible to work with. It's missing so many features you expect from a POSIXy system that you constantly have to find work-arounds. Having a 2.4 kernel on the cluster during my PhD was enormous pain - I'd write code on FreeBSD, copy it to the cluster, and find half the features were missing. 2.6 is a lot better from a feature-standpoint, but is much heavier and isn't really suited to embedded systems anymore. If you're building the image yourself, why not go with FreeBSD or OpenBSD and get the best of both worlds - FreeBSD if you lean more towards features, OpenBSD if you want a smaller footprint?

    --
    I am TheRaven on Soylent News
    1. Re:Why Linux? by TheRaven64 · · Score: 5, Informative
      I'm assuming you're asking for examples of things that don't work correctly (or at all) in 2.4. If so, off the top of my head (it's been a couple of years since I used a 2.4 kernel):
      • Lots of newer POSIX IPC (SysV IPC works okay).
      • Asynchronous I/O (all of the aio_* family and lio_listio).
      • Several bits of POSIX threads.
      • Most of the realtime extensions, such as queued signal delivery.
      • Some mmap() flags (I think - not sure about this one).

      All of these work on FreeBSD 6 or 7 (aio is in a module that isn't loaded by default on 6, not sure about 7), and most of them work on Linux 2.6.

      --
      I am TheRaven on Soylent News
    2. Re:Why Linux? by DrDitto · · Score: 5, Insightful

      2.6 is a lot better from a feature-standpoint, but is much heavier and isn't really suited to embedded systems anymore.

      Lets see-- Android runs Linux 2.6.25. My Linksys NSLU2 is currently running OpenWRT with a Linux 2.6.26 kernel. Both are embedded devices with far less processing capability than an Atom-based device.

    3. Re:Why Linux? by miknix · · Score: 5, Interesting

      Exactly, I would not say it better.

      As a member of the gentoo embedded team I would recommend the use of crossdev to generate the toolchain.
      By emerging crossdev-wrappers and setting up some gentooish cross-compiler environment, it is possible to cross-compile (by simply emerging them) a lot of packages on portage.
      Emerge will take care of most things leaving the most ugly cross-compile errors for you.

      http://www.gentoo.org/proj/en/base/embedded/cross-development.xml

      Regarding the guide, don't use the xmerge script. Just emerge crossdev-wrappers instead.
      Feel free to join #gentoo-embedded on irc.freenode.net

      Happy xcompiling.

    4. Re:Why Linux? by beelsebob · · Score: 4, Informative

      Who cares which came first. The important thing is that that kernel is small, and has the features. Linux 2.4 does not have the features, Linux 2.6 does not have the small.

    5. Re:Why Linux? by molarmass192 · · Score: 4, Insightful

      I was thinking the same thing. Yes, 2.6 has a bigger codebase, but if you compile only the modules you need, instead of everything plus the kitchen sink, it's really no bigger in binary form (maybe +5%). In return, I find it to be noticeably more responsive given the same hardware.

      --

      Good people do not need laws to tell them to act responsibly, while bad people will find a way around the laws-Plato
    6. Re:Why Linux? by Anonymous Coward · · Score: 4, Informative

      Define small, I'm working towards a first release of a Linux 2.6 based project, the Kernel + bundled busybox based RFS is 2.1M. Just saying.

  3. If you are olready doing 90% of the work... by dotancohen · · Score: 4, Insightful

    ...then go with the newer kernel. 2.6 has _lots_ of improvements above 2.4. The security aspects may be of less interest in your application, but the performance probably won't be. I've always believed that it is better to regret having done something than to regret having not done it.

    --
    It is dangerous to be right when the government is wrong.
    1. Re:If you are olready doing 90% of the work... by ta+bu+shi+da+yu · · Score: 4, Insightful

      I always hate it when people talk about improved performance in general. I'm curious about what specific features of the 2.6 kernel you feel he would benefit from?

      --
      XML is like violence. If it doesn't solve the problem, use more.
    2. Re:If you are olready doing 90% of the work... by ThePhilips · · Score: 5, Informative

      No clue what gp meant.

      From all I heard (I was in embedded business only in 2.2/2.4 times) that 2.6 integrated some number of patches from embedded folks and generally can be customized to run on smaller number of resources. Also, the improved I/O (much lower latencies) and scheduler (interactivity; soft-real-time) would benefit in embedded too. 2.4 has number of problem related to memory management, when virtual memory subsystem can easily grab half of available RAM - only for supporting virtual memory. 2.6 solved the problem for most architectures.

      Generally, many embedded folks moved to 2.6 already - mainly due to support for more new OTS hardware. 2.4 has this support only through vendor patches (e.g. I used in past BlueCat and MontaVista patches).

      In my experience changing kernel on embedded system is quite easy task. Using development system within couple of days you can come up with suitable minimal .config (one needs development system since on target embedded systems might not have sufficient resources to run vanilla kernel). Generally it would either work or not. Normally it works.

      Also note that H/W vendors started being more active in 2.6 times. In 2.4 times best shot at Linux driver was some crude port from e.g. LynxOS or VxWorks. From all I know, 2.6 now supports more PowerPC system than did patch from MontaVista for 2.4 I used three years ago.

      Last, but not least, if you are looking at new modules, many hardware vendors supply Linux compatibility information. 2 years ago finding module with "Linux compatibility" chapter in documentation wasn't a problem at all.

      --
      All hope abandon ye who enter here.
    3. Re:If you are olready doing 90% of the work... by Enleth · · Score: 4, Insightful

      Much better power management, in many different aspects, which can be important if this particular embedded platform is meant to be battery-powered or used in an unfriendly thermal environment (yes, power efficiency is also a kind of performance metric, just per watt of consumed and emitted power, not per unit of time).

      There's more power management support in the drivers, lots of ACPI fixes and improvements, and, most importantly for a platform like Atom (or any x86-based platform in general, when heat and power are a problem), the tickless idle mode, which enables very real and measurable power saving and reduction of generated heat by letting the processor actually do nothing (technically, drop to C3 and further power states) when, well, doing nothing, instead of processing useless interrupts and idling at the normal working power level.

      --
      This is Slashdot. Common sense is futile. You will be modded down.
  4. Move on by markus_baertschi · · Score: 4, Insightful

    I'd move on. Not for any particular feature, but to stay closer to the mainstream for the next years. The 2.4 kernel, not for any technical reason, becomes increasingly exotic as people move on to 2.6.

    You'll have to maintain your existing 2.4 skills for another decade when all others have moved.

    Markus

    1. Re:Move on by morgan_greywolf · · Score: 5, Insightful

      OTOH, the code is 6 years old, and from what I gather reading the post, it's stable and mature. OTOH, my guess is that if the article poster has written his code in a fairly portable way, it will compile without too much modification on GCC 3.x or 4.x and will run under the newer versions on glibc on a 2.6 kernel.

      On the gripping hand, keep in mind that for embedded applications that memory is usually at a premium and the memory footprint of 2.4 is significantly smaller than the 2.6 kernel. Keep in mind that lots of embedded applications are still using a 2.4 kernel and some embedded applications even continue to use MS-DOS or FreeDOS.

      I guess if I were making this decision, I'd try to compile and run my code on newer Linux distro in a sandbox to see how much work it would take to make it compile and run in the new environment. Then I'd see how much bigger a custom-built 2.6 kernel is than the existing 2.4 kernel, optimizing the kernel configuration for size and memory consumption, of course.

      That work should take no longer than a couple of days.

      If it doesn't work out, you can go back to your existing 2.4 configuration. *shrug*

      What do you have to lose?

  5. 2.6 by JamesP · · Score: 5, Informative

    I had the same question asked for an embedded project 3 years ago. And it was very clear cut then

    2.6 you get (off the top of my head)

    -Modern drivers (including USB/Network/etc)
    -Various tick rates and tickless
    -More support
    -Several other improvements

    So really don't bother w/ 2.4

    --
    how long until /. fixes commenting on Chrome?
  6. This article was written upon 2.6 release by rolfwind · · Score: 5, Informative

    http://www.linuxdevices.com/articles/AT7751365763.html

    Without knowing your exact parameters though, it's hard to debate any specific advantages.

  7. Go 2.6 by digitalhermit · · Score: 4, Informative

    Lots of the improvements to 2.6 have probably been added to 2.4, but many come "native" to 2.6 so no outside patches are required. For example, kernel pre-emption, better scheduler, etc.. There are other intangibles too such as development time, testing, new toolchain, etc.., but you're already moving to a new processor and you'd have to do that anyway.

    Sometime last year I was rebuilding some antique MIPS-based Linux from a 2.4 to a 2.6. Almost everything in the userspace was effortless (though much of it was based on Busybox); the main issue was related to some in-line assembler that took a while to figure out what it was doing. Once I did, I googled it and realized someone else had already solved a year or so ago.

    So in short, no real benefit to sticking with 2.4 IMHO.

  8. What do you want? by RedWizzard · · Score: 4, Interesting

    So far all the positively moderated posts have advocated 2.6. Here's a slightly contrary view. You know 2.4. It seems to satisfy your needs. Why exactly are you considering change? Is there something 2.4 doesn't do that you want? I realise you might be asking in case there is some improvement that 2.6 may possibly provide that you've missed, but if the current setup does what you need then why would you even consider a change? My advice: stick with 2.4 unless 2.6 provides something additional that you definitely need.

  9. I misread the opening sentence of the article, as by ErkDemon · · Score: 4, Funny
    "My 6-year-old's embedded software happily runs on kernel v2.4 on an XScale CPU. ..."

    I thought, aaaah, he's built a robust linux PC for his kid. But isn't insisting that his kiddy's first PC has a bang-up-to-date GCC compiler a little extreme?

    Then I re-read it. Oops. Makes much more sense now. Not as cute, though.

  10. I'd split the difference by Waffle+Iron · · Score: 5, Funny

    ... and go with the 2.5 kernel.

  11. 2.6. See our Space Station project by slashbart · · Score: 4, Informative

    Hi

    We moved our project from 2.4 to 2.6 during development, because the maximum interrupt latency of 2.6 is so much better. We needed to handle UDP packets within 20 ms. max and occasionally on 2.4 we would have a 60 or more. Going to 2.6 solved our problems immediately, even with early versions.

    See this Linux Journal article for more details on our project http://m.linuxjournal.com/article/7190

    Bart van Deenen

  12. linux2.4 is NOT proven on Atom by nchip · · Score: 4, Insightful

    or better to stick with the old and proven 2.4?

    Linux 2.4 might be "proven" on your old Xscale system, but I doubt anyone else has even _tried_ to use Linux 2.4 on something as new as Atom. Linux 2.4 will also lack support for any of the peripherals of your Atom com module.

    --
    signatures pending - ansa@kos.to - (dont mail there)
  13. Re:New hardware new issues by wtarreau · · Score: 4, Informative

    Yes, 2.4.37 runs fine on an Asus EEE-Box (Atom, PCI-E, SATA, USB2, ...)

    Willy