1 2 Previous Next 19 Replies Latest reply on Jun 23, 2015 5:08 PM by gallagm12

    Native Edison kernel compile successful, kernel hangs without error

    intel_jassowski

      My goal is to compile a real time kernel, but since I was having issues with my kernel working, I thought I'd try to compile a vanilla WW42 Edison kernel.

      I'm using the Ubilinux image for access to normal Linux packages.   I'm able to successfully compile the kernel, but when I install it and reboot: it hangs.

      Is there something obvious I'm doing wrong here?  Here are my exact steps starting from the default Ubilinux image, using an 8GB uSD card for extra space:

       

      0) Misc fixes
      Get the right date:
      apt-get install ntp
      Keep from rebooting if no wireless:
      # vi /etc/dhcp/dhcpclient.conf
        change the lines after "#require subnet-mask, domain-name-servers;" to:
        timeout 20;
        retry 10;
        reboot 0;
        select-timeout 0;

      1) make room:
      # fdisk /dev/mmcblk1
        n
        Partition type: p
        Partition number: <enter>
        First sector: <enter>
        Last sector: <enter>
        w
      # mkfs.ext4 /dev/mmcblk1p1
      # mkdir /mnt/extsd
      # mount /dev/mmcblk1p1 /mnt/extsd
      # cd /mnt/extsd
      # mkdir local
      # mkdir src
      # mkdir var
      # mkdir var/cache
      # mkdir share
      # cp -R /usr/local/* /mnt/extsd/local
      # cp -R /usr/src/* /mnt/extsd/src
      # cp -R /var/cache/* /mnt/extsd/var/cache
      # cp -R /usr/share/* /mnt/extsd/share
      # rm -rf /usr/local
      # ln -s /mnt/extsd/local /usr/local
      # rm -rf /usr/src
      # ln -s /mnt/extsd/src /usr/src
      # rm -rf /var/cache
      # ln -s /mnt/extsd/var/cache /var/cache
      # rm -rf /usr/share/*
      # ln -s /mnt/extsd/share /usr/share
      # echo "/dev/mmcblk1p1     /mnt/extsd       auto    defaults     1   1" >> /etc/fstab

      2) Prepare system:
      Edit /etc/networking/interfaces
        Uncomment auto wlan0
        change SSID & Password
      # /etc/init.d/networking restart
      # apt-get update
      # apt-get upgrade

      2) Install packages:
      [https://packages.debian.org/search?keywords=xenomai&searchon=sourcenames&suite=all&section=all]
      # apt-get install libxenomai-dev libxenomai1 linux-patch-xenomai xenomai-doc xenomai-runtime
      [http://xenomai.org/2014/06/building-debian-packages]
      # apt-get install devscripts debhelper dh-kpatches findutils
      # apt-get install kernel-package libncurses-dev fakeroot zlib1g-dev
      # apt-get install bc
      # cd /usr/src 
      # wget -O - http://download.gna.org/xenomai/stable/xenomai-2.6.3.tar.bz2 | tar -jxf -  #do I need these if I apt-get?

      [http://kernel-handbook.alioth.debian.org/ch-common-tasks.html]
      # cd /usr/src
      # wget -O - https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.10.17.tar.bz2 | tar -jxf -
      # cp -R linux-3.10.17 linux-3.10.17-orig  # Save it for later

      3) Get Edison stuff:
      # wget -O - http://downloadmirror.intel.com/24389/eng/edison-src-rel1-maint-rel1-ww42-14.tgz#_ga=1.225557722.1979370645.1410536481 | tar -zxf -

      4) Merge Edison patches
      # cd /usr/src/linux-3.10.17
      # patch -p1 < ../edison-src/device-software/meta-edison/recipes-kernel/linux/files/upstream_to_edison.patch
      # cp ../edison-src/device-software/meta-edison/recipes-kernel/linux/files/defconfig .config
      # cp drivers/tty/serial/mfd_trace.h include/trace/ #missing or in the wrong spot for some reason...
      5) Make plain old Edison kernel
      # make menuconfig
      # scripts/config --disable DEBUG_INFO ### Maybe we don't want to do this until the kernel actually boots?
      # make clean
      # make deb-pkg

      6) Expand the boot partition (mainly for when we have the larger Xenomai kernel)
      # vi /etc/fstab  # Uncomment out /boot line
      # mount /boot
      # mkdir /tmp/boot
      # cp -R /boot/* /tmp/boot
      # umount /boot
      # mkfs.vfat /dev/mmcblk0p7
      # mount /boot
      # cp -R /tmp/boot/* /boot

      7) Backup the rootfs and home partitions
      # dd bs=4M if=/dev/mmcblk0p8 | gzip > /mnt/extsd/Ubilinux-rootfs.gz
      # dd bs=4M if=/dev/mmcblk0p10 | gzip > /mnt/extsd/Ubilinux-home.gz

      8) Check to see that you seem to have a good kernel:
      # ls -l debian/tmp/boot/
        total 7460
        -rw-r--r-- 1 root root   99380 Nov  7 05:41 config-3.10.17-poky-edison
        -rw-r--r-- 1 root root 2380084 Nov  7 05:41 System.map-3.10.17-poky-edison
        -rw-r--r-- 1 root root 5150880 Nov  7 05:41 vmlinuz-3.10.17-poky-edison
      # ls -l ../*.deb
        -rw-r--r-- 1 root root  8033096 Nov  7 05:46 ../linux-headers-3.10.17-poky-edison_3.10.17-poky-edison-1_i386.deb
        -rw-r--r-- 1 root root 10242546 Nov  7 05:47 ../linux-image-3.10.17-poky-edison_3.10.17-poky-edison-1_i386.deb
        -rw-r--r-- 1 root root   943280 Nov  7 05:46 ../linux-libc-dev_3.10.17-poky-edison-1_i386.deb

      9) Let's install those packages and see what happens!
      # mv /boot/vmlinuz /root # move the old kernel out of the way...
      # dpkg -i ../*.deb  # Remember to be more specific if you have compiled several kernels
      # mv /boot/vmlinuz-3.10.17-poky-edison /boot/vmlinuz
      # reboot

      Bah:
      Hit any key to stop autoboot:  0
      Target:blank
      Partitioning already done...
      Flashing already done...
      GADGET DRIVER: usb_dnl_dfu
      reading vmlinuz
      5150880 bytes read in 131 ms (37.5 MiB/s)
      Valid Boot Flag
      Setup Size = 0x00003c00
      Magic signature found
      Using boot protocol version 2.0c
      Linux kernel version 3.10.17-poky-edison (root@ubilinux) #1 SMP PREEMPT Fri Nov 7 05:33:15 UTC 2014
      Building boot_params at 0x00090000
      Loading bzImage at address 00100000 (5135520 bytes)
      Magic signature found
      Kernel command line: "root=PARTUUID=012b3303-34ac-284d-99b4-34e03a2335f4 rootfstype=ext4 console=ttyMFD2 earlyprintk=ttyMFD2,keep loglevel=4 systemd.unit=first-install.target hardware_id=00 g_multi.iSerialNumber=14ef89558d3fd9edf52345f87c5ed56f g_multi.dev_addr=02:00:86:5e:d5:6f"

      Starting kernel ...
      ---->Hangs here until watchdog resets system, repeat forever<-----

       

      Ideas?  Am I missing an Edison patching step (note that I had to manually copy a header file for mfd_trace.h... hmm: the console is an MFD device, coincidence?)?

        • 1. Re: Native Edison kernel compile successful, kernel hangs without error
          mmi

          Did you try to build the kernel this way without xenomai patches ? Just to be sure that your procedure works basically.

          • 2. Re: Native Edison kernel compile successful, kernel hangs without error
            intel_jassowski

            Hmm.... I responded a while back: not sure what black hole that response went to.

            Yes, I intentionally left out the Xenomai patches in order to see if I could even install a natively compiled Edison patched kernel.  Which I can't for some reason.

            I'm sort of leaning toward the problem being associated with the manual tweak necessary to get the compile to complete having to do with the mfd_trace header file not being found.  Since the kernel is using the MFD device as it's console, if something is wrong there, I probably won't know about it.

             

            I assume that this manual copy step is NOT required in the bitbake environment, but looking through the recipes I didn't see anything obvious that I'm missing on the kernel side.

            • 3. Re: Native Edison kernel compile successful, kernel hangs without error
              mmi

              Ok. An errorfree kernel compilation doesn't mean that it works. The first step is to build the same kernel again with a procedure like you have tried so far, that's also my target.

               

              But until now i can't help you because i didn't check anything of the Yocto build process and the necessary kernel patches but i will also try it in the next days and come back here if i get it running. I'm also using ubilinux so we both have the same interest. But i don't need realtime capabilities on the Linux side because the combination with sketches running on the uC should do this for my needs. What i'm missing in the current version is w1 (onewire), usb-sound, udlfb. It would be easy to connect a simple usb soundcard, a 1w sensor or an udl monitor to Edison. I guess 1w will need a small patch for port access.

               

              Maybe there's another guy having a similar idea for building the kernel?

              • 4. Re: Native Edison kernel compile successful, kernel hangs without error
                intel_jassowski

                I will be interested in how it goes for you.  I've also have been looking at USB sound, but I have not yet been able to get it to work on the ubilinux/edison system, even though it appears that alsa is enabled in the kernel.

                • 5. Re: Native Edison kernel compile successful, kernel hangs without error
                  mmi

                  This evening i looked into the sources. There are a lot of patches for integration of the mid-platform into the kernel and so far i've seen also a patched gcc is necessary (new cpu variant). So i decided it's better to wait because this will eat a lot of time which i need for other projects. At the moment It's easier to modify and build the kernel with the Yocto procedure and simply overwrite kernel and modules in  ubilinux. This stuff seems really to be some months too young.

                   

                  To get a standard usb soundcard working it should be enough to enable the 'snd_usb_audio'  module in the kernel configuration. Alsa should see then this device.

                  • 6. Re: Native Edison kernel compile successful, kernel hangs without error
                    intel_jassowski

                    mmi:

                    I have been able to get usb_audio working on ubilinux by using AlexT_Intel's opkg repo and a stock yocto environment to update the stock image with a kernel that has the snd_usb_audio module, and then transplanting the /boot and /lib/modules directories into a ubilinux system.

                    I have audacity working under X11 through VNC with a USB microphone.

                    Still no luck with a Native kernel compile.  Might have to just bite the bullet and figure out how to bitbake a xenomai kernel, and transplant that.  Much more difficult given that there isn't a clean xenomai patch for 3.10.17, and there is some hand patching required.

                    • 7. Re: Native Edison kernel compile successful, kernel hangs without error
                      mmi

                      I did the same as you did with AlexT's kernel and gladly it has the snd_usb_audio module. Here it also works fine with ubilinux now.

                      You need no Yocto environment to extract the data from the opkg format. I did it on my pc with Archlinux and wondered that the archive software did know how to unpack .ipk packages by default - really nice.

                      I copied kernel and modules to the proper places on Edison and finally i did a "depmod" which is important if you install the modules this way.

                      • 8. Re: Native Edison kernel compile successful, kernel hangs without error
                        alitt

                        I'm interested in a working native compile too, but it's hard to debug without any output.

                         

                        I found that the "earlyprintk=ttyMFD2,keep" on the kernel command line isn't the right way to get early kernel output.  There's a separate driver in arch/x86/platform/intel-mid/early_printk_intel_mid.c that's being built into the kernel by the Yocto configs.  Unfortunately the driver is a little broken and doesn't hit the right baud rate on Edison.

                         

                        Here's a patch to fix the baud to come up at 115200n8 on Edison:

                         

                        --- linux-3.10.17orig/arch/x86/platform/intel-mid/early_printk_intel_mid.c    2014-11-26 00:30:58.591348757 -0600

                        +++ linux-3.10.17/arch/x86/platform/intel-mid/early_printk_intel_mid.c    2014-11-26 00:32:15.011347258 -0600

                        @@ -444,6 +444,8 @@

                                 /* detect HSU clock is 50M or 19.2M */

                                 if (clkctl && *clkctl & (1 << 16))

                                     writel(0x0120, phsu + UART_MUL * 4); /* for 50M */

                        +        else if (*clkctl & (1 << 31))

                        +            writel(0x02EE, phsu + UART_MUL * 4);  /* for 38.4M */

                                 else

                                     writel(0x05DC, phsu + UART_MUL * 4);  /* for 19.2M */

                             } else

                         

                        You'll need to set earlyprintk=hsu2,keep and you'll want to crank up the loglevel=8.  You can do this in the Yocto build U-Boot edison.env file, or use setenv/saveenv in U-Boot directly.

                         

                        From the little I've played with it, the kernel seems to flip out at the end of the virtio_rpmsg_bus messages.  If I comment out the platform_device_register() in arch/x86/platform/intel-mid/intel_mid_scu.c then the kernel gets all the way to trying to mount root (but fails when reading from mmc for some reason).  No idea how the Yocto toolchain makes this work.

                        • 9. Re: Native Edison kernel compile successful, kernel hangs without error
                          jeff_nxt

                          mmi and intel_jassowski,

                           

                          I spent an appreciable amount of time yesterday attempting to do the same - replacing /lib/modules and /boot on the UBILINUX Edison+Arduino platform (3.10.17-poky-edison-ww42+) with the files from my other Edison+Arduino (3.10.17-poky-edison+). Regardless of the efforts, I couldn't get the USB sound card (SoundBlaster Play 2!) to work. I simply couldn't get the snd_usb_audio module to load.

                           

                          On the platform running 3.10.17-poky-edison+, the sound driver works like a charm and the same USB sound card and USB microphone work perfectly. Here's what I've even gone as far as going to the repo that I believe you both mentioned (Index of /edison/repo/edison) and downloading kernel-module-snd-usb-audio_3.10.17+git0+6ad20f049a_c03195ed6e-r0_edison.ipk and unpacking it using the "ar" utility. I've used the below commands to test or attempt to load the driver with yet still no positive results:

                           

                          • sudo modprobe -v snd_usb_audio
                          • sudo modprobe --force-vermagic snd-usb-audio.ko
                          • sudo depmod -a
                          • sudo alsactl init
                          • sudo alsa-utils stop/start
                          • sudo dpkg-reconfigure alsa-base
                          • cat /dev/sndstat
                          • cat /proc/asound/cards

                           

                          Any assist on this would be greatly appreciated. I need to be on Debian, but I also need to have audio working as well.

                           

                          Thanks for any insight or assist you can provide.

                           

                          Jeff

                          • 10. Re: Native Edison kernel compile successful, kernel hangs without error
                            intel_jassowski

                            Jeff,

                              There are probably many ways to do this... but what I did was first install the Yocto based OS on Edison, and use the opkg command to load the latest kernel and modules from the opkg repository.  This provides the correct set of modules and kernel files.  I then tar'ed up the /boot and /lib/modules directories, and saved them to a USB stick.

                              Then I installed the Ubilinux OS on Edison, mounted up the USB stick and then unpacked the kernel and modules into their proper places, and rebooted.

                             

                            Now, I know I also did apt-get's of many audio related packages on the Ubilinux version of the OS, and I'm not yet completely satisfied with the overall functionality (I find pulse-audio quite flakey in recognizing hardware appropriately, and I've uninstalled that.  I also have issues with audacity no longer working if I invoke sox...).  But as long as I don't use sox (which sucks--excuse the pun), audacity records audio with no problems.  I haven't tested an output device, as I'm mainly just interested in analyzing sounds (frequency content, magnitude).

                             

                            I hope that helps...

                            • 11. Re: Native Edison kernel compile successful, kernel hangs without error
                              mmi

                              ... and after you have copied the sound module (or any other new modules) into /lib/modules you should do a depmod -a as root and reboot.

                              Assuming the kernel and all modules have the same version a "sudo modprobe <modulename>" should load the module without any problems.

                              • 12. Re: Native Edison kernel compile successful, kernel hangs without error
                                jeff_nxt

                                Thanks intel_jassowski and mmi - you guys rock! For some reason everything worked perfectly this time around. I already had another Edison board running 3.10.17-poky-edison+ so I did what you guys mentioned (again) and lo-and-behold, I have audio on Ubilinux!


                                I'm working with is alsa-based stuff, so I''m not using other sound systems like pulse-audio, etc. The input and output devices (Snowball USB Mic & Soundblaster Play 2! USB sound card) show up and work well - consistently.


                                Thanks again guys. And intel_jassowski, I like your pun - I needed a little humor in my day!


                                Regards,


                                Jeff

                                • 13. Re: Native Edison kernel compile successful, kernel hangs without error
                                  Tomas0413

                                  Hi, Jeff,

                                   

                                  could you please share snd-usb-audio.ko file for Linux ubilinux 3.10.17-poky-edison-ww42+ ?

                                   

                                  Maybe you can put it somewhere online or send it to me by e-mail (tomas@ramanauskas.co.uk)?

                                   

                                  I'm also trying to get USB audio to work on Intel Edison.

                                   

                                  I downloaded snd-usb-audio.ko from kernel-module-snd-usb-audio_3.10.17+git0+6ad20f049a_c03195ed6e-r0_edison.ipk

                                   

                                  but I'm getting this error:

                                   

                                  [  19.522338] snd_usb_audio: version magic '3.10.17-poky-edison+ SMP preempt mod_unload ATOM ' should be '3.10.17-poky-edison-ww42+ SMP preempt mod_unload ATOM '

                                   

                                  I see intel_jassowski  posted the solution that worked for you, having snd-usb-audio.ko would safe me a lot of time

                                   

                                  Tomas

                                  • 14. Re: Native Edison kernel compile successful, kernel hangs without error
                                    jeff_nxt

                                    Hi Tomas,

                                     

                                    Your timing is good. I just posted a series of steps (and info) on setting up Ubilinux on the Edison here: How-To: Ubilinux Initial Setup.

                                     

                                    The problem that you are experiencing with the "version magic" messages is typical when mixing modules from different kernel versions. Your best bet is to do what intel_jassowski and immi helped me out with and copy the /boot and /lib/modules/<kernel version> folders from the system with Yocto, then flash to Ubilinux and copy them back (overwriting the files in /boot), running "depmod -a", rebooting and confirming that you're on the correct kernel.

                                     

                                    Following those steps, see my post on adding ALSA audio support, testing and troubleshooting. I hope this gets you down the path of success. Let us know how it goes for you.

                                     

                                    Regards,

                                     

                                    Jeff

                                    1 2 Previous Next