This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Booting a Custom Linux on AM3359 - BeagleBone

Other Parts Discussed in Thread: AM3359, AM3517

Since I'm new to this forum a big "Hello everyone!" is in order.

Recently I bought myself a BeagleBone and a cape from Chipsee with 7in LCD and resistive touch (plus DVI output and audio support). Provided Angstrom image works fine. So do TI's Linux image and Android 4.0 image which came with the board. Since I'm new to Linux I decided that the best way to learn was to get down and dirty and build a custom kernel + file system to work with my new toy.

I downloaded the latest Linux kernel source (3.6.6) and Linaro's Linux tool-chain for ARMs. With the source downloaded and a bit of tinkering inside make menuconfig
I now have my first image. I thought it would be as simple as substituting the uImage in the boot directory of Angstrom on the SD card with my new one (to at least get a boot-up penguin on my screen or at least some kernel booting messages over UART debug). At the same time I thought it just can't be that easy and I was right. I get the familiar Starting kernel ... hang. And for the life of me I can not set kernel's debugging port correctly to see what is going wrong. Here is what I did:

- Get linux 3.6.6 source (and put it in its own folder in my home folder) and gcc-arm-linux-gnueabi
- Go into downloaded source folder
- make clean
- make ARCH=arm omap2plus_defconfig
- make ARCH=arm menuconfig (changes I made are described below)
- make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage
- I then placed this newly created uImage in place of the old one on Angstrom SD card which came with the BeagleBone
- I added "console=ttyO0,115200n8" to uEnv.txt so that it now contains two lines. The other is "optargs=run_hardware_tests quiet" (all without quotation marks) I also tried console=ttyO2,115200n8 as per BeagleBoard.orf's faq page but that didn't work either
- As I already mentioned, after placing the card into the board and booting I get the known Starting kernel ... hang (so U-Boot does it's thing but Linux kernel does not load)

Changes to .config (using menuconfig):

- enable da8xx-fb as described here: http://processors.wiki.ti.com/index.php/AM335x_LCD_Controller_Driver%27s_Guide (driver compiled into kernel)
- enable ethernet interface as described here: http://processors.wiki.ti.com/index.php/AM335x_CPSW_%28Ethernet%29_Driver%27s_Guide (driver compiled into kernel)
- "Compile the kernel with Debug Info" (CONFIG_DEBUG_INFO)
- "Kernel low-level debugging functions" (CONFIG_DEBUG_LL) and further "Kernel low-level debugging port - No low-level debugging UART". Here Only the following was available: No low-level debugging UART, Kernel low-level debugging via EmbeddedICE DCC channel and Kernel low-level debug output via semihosting I/O. I am pretty sure that last two are not applicable so I chose the first hoping that the uEnv.txt line "console=ttyO0,115200n8" would configure the proper port for UART debugging.

I found the "console=ttyO0,115200n8" line for uEnv.txt on the internet somewhere so I am not the least sure it is correct.

Based on the description I gave I would like to kindly ask for some help in answering below questions:
1) First, was it OK for me to base the kernel image off of omap2plus_defconfig ? I could not find a clear explanation about this when Googling so I am still in the dark whether Sitara and OMAP are code compatible, so to speak? What exactly is the difference between the two families? Is it just performance in terms of higher frequency and so on or are there any other differences which may cause trouble if building Linux kernel for OMAPs? Also, which OMAP should I chose? 1,2,3,... ?
2) What am I doing wrong that I am not getting any debug info over UART when the kernel starts booting? I have a feeling I am not setting the port correctly. Does anyone know how to set it or where I could find this out? Perhaps from the working images that came with the board? I read this:
http://processors.wiki.ti.com/index.php/Kernel_-_Common_Problems_Booting_Linux
but when searching in menuconfig I can not find CONFIG_OMAP_LL_DEBUG_UART3. When Googling this I discovered that this option is only found in Linux kernels 2.6.6–2.6.12.
3) I am using the filesystem which came with the board (Angstrom distro). Is simply replacing the kernel while leaving the file system as it is likely to cause any errors? Could this be causing the kernel to not boot? And if it is, should I at least see some activity on the debug lines and perhaps a boot up penguin on the LCD?
4) If anyone has the will and some time to spare I would appreciate any comments on the attached configuration file I used for building the Linux Kernel. I would be especially grateful for any comments on the two changes I made and those are adding da8cc-fb driver and ethernet drivers (described above). I am not sure whether I am allowed to attach Chipsee's schematics of their 7in LCD cape or not. But the LCD is connected to AM3359's LCD pins directly so its internal LCD controller should be able to drive the LCD.
5) This is moving ahead a bit but my next step will be to get the touch-screen controller working. Any tips on how to achieve that?

My first post and already so long. :) I hope it will not discourage anyone from reading it.

Thanks in advance for al your help.

Cheers!

  • Hello Casper,

    first of all you'll need to make yourself familiar with Device Trees: http://elinux.org/Device_Trees and Documentation/devicetree in your kernel source tree. See this thread about v3.7-rc's tests: http://www.spinics.net/lists/linux-omap/msg80721.html.

    Please check if you can use http://buildroot.org/. It has support for Device Tree blobs, so that after compilation you'll get both uImage and blob.

    Yegor

  • Don't have the Beaglebone, but you might try setting the "console=ttyO0,115200n8" to ttyO1 or ttyO2.

    Openembedded has a parameter in the machine definition

    located in $OE_BASE/arago/conf/machine/<machine>.conf

    SERIAL_CONSOLE = "115200 ttyO0"

    which also needs to be set correctly..

  • Thank you both for posting your suggestions and apologies for my delay in replying. A business trip which could not be avoided prevented me from playing with my BeagleBone in the past week. I will hopefully get back to it in a day or two. In the meantime I would like to clarify a few things so that I will have to spend less time searching for answers on the web when I finally do pick up the board again.

    First a big thank you to Yegor. I was always missing an explanation on how Linux gets all of the board specific information which it needs to run. Now I see that device trees are the answer.

    However researching this further raised more questions than it answered. I would again like to kindly ask for some help in answering them:

    - On the Angstrom distribution which came with my BeagleBone I could not find a file with a FDT. Why is that?
    - This may perhaps partly answer my own question above: did I understand correctly that a FDT can either be passed to the kernel as a separate file at boot time or can be compiled into kernel itself? If this is so does this mean that the Angstrom I got with my board implemented the second option?
    - How does one compile a kernel to enable FDT support? Is it enough to just enable CONFIG_USE_OF and  CONFIG_PROC_DEVICETREE? I would imagine it is not because at least choosing which FDT to use has to also be made, right? How does one do that?
    - Does anyone know of a tutorial on how to get a Linux kernel with FDT support up and running? I found lots of information about the format of the FDT (in Linux' documentation and on the internet) but very little on how to actually enable FTD support in a Linux kernel, how to chose a FDT and so on.

    Thanks for helping.

    Cheers!

  • 1. What kernel does Angstrom provide?  I bet 3.2. This kernel had a board file under arch/arm/mach-omap2/ so all platform data was provided as in the old days.

    2. Yes you can incorporate device tree blob into the kernel, but it is not recommended

    3. Just invoke make "omap2plus_config" and you'll have everything prepared for device tree, after that invoke "make uImage am335x-bone.dtb" (you can find the proper name under arch/arm/boot/dts/)

    4. For loading the kernel and dtb see here: http://processors.wiki.ti.com/index.php/AM335x_Android_Device_Tree_Integration#Booting_uImage_with_seperate_device_tree_blob

    I tried my board with 3.7-rc5, please note that MMC support is still not merged. You can find patches on the linux-omap mailing list, but they were not accepted. So the only possiblities to boot your rootfs are initramfs or NFS.

    You'll also need the latest version of u-boot, to boot dtb correctly.

  • 1. You are correct. It is 3.2.12 on the card I got with the BeagleBone. May I ask what the difference is between a board file and a FTD? If a board file contains all platform dependant data why is there a need for a FTD? Or is FTD some sort of improvement of a board file? If one uses a FTD is a board file then still needed or is just one of the two enough?

    2. Why is it not recommended? Is it because porting reasons? Is boot time shorter if the FDT is compiled into kernel than if it is passed into it by u-Boot or similar?

    3. If I invoke "make omap2plus_config" will I still be able to make changes to the config using "make menuconfig" based on omap2plus_config? Or in other words will options in menuconfig already be set to those selected in omap2plus_config?

    4. Do I understand correctly that a am335x-bone.dtb then needs to be put on the SD card on the same partition as uImage? And I get .dtb from .dts by using an appropriate compiler? Or will "make uImage am335x-bone.dtb" already create a .dtb?

    5. What do you mean by "MMC support is still not merged"? Does that mean that kernel can not access MMC cards yet?

    6. What is an alternative to using a FTD? The board file obviously, since you say it was used in older versions of Linux kernel. But I have been looking at the source of 3.2.18 kernel and it also has dts files. So support for that was obviously also present "in the old days"?

    Thank you again for your help.

    Cheers!

  • 1. The purpose of device tree is to enable one kernel image to be used by various ARM SoC's. You can have one image for am3359 and am3517 and two different dtb for each system that will take care of platform devices. device tree spersedes board files

    2. please read kernel documentation i.e. in menuconfig you can select the option to include blob into uImage and there is description saying, why it can be dangerous.

    3. omap2plus_config would just make default settings for OMAP family, then you can make menuconfig and make your own changes. Take care of command line options if you don't want u-boot to suply them for you.

    4. yes dtb file must be put on the SD card and yes,  make uImage am335x-bone.dtb would create dtb from dts

    5. support is also present in 3.2, but it will be really used in later kernels and board files will not be accepted for main line kernel. So the future is device tree

  • So I have been at this for a while but still without much success. Since device tree blobs are relatively new I decided to return to these later. I will almos definitely have to use them sooner or later so I would like to get a bit more "down and dirty" now, that I have the chance or it may happen I never will. :) 

    So I set a new goal for now and that is to compile a kernel, make an uImage, replace the existing one with the one I build and try to at least get some kernel debugging output over UART. Even if the kernel fails to boot successfully I would at least like to see it try. Because at the moment the last output I get is from u-Boot saying "Starting kernel ..."

    From what I learned so far I probably do not have UART/serial settings right and that is why I am seeing no output from kernel on UART0. By the way, I have compiled the kernel with CONFIG_EARLY_PRINTK and DEBUG_LL.

    I tried passing all sorts of things to kernel via boot command line arguments written in uENV.txt (such as earlyprintk=serial,uart0,115200 and console=ttyO0,115200n8 and variations to those) but without success. I can also not see any UART ports listed in menuconfig under "Kernel hacking -> Kernel low-level debugging functions -> Kernel low-level debugging port". Here I only see "Kernel low-level debugging via EmbeddedICE DCC channel" and "Kernel low-level debug output via semihosting I/O". So I gather there is no UART data hard coded in Linux sources for AM335x which is used on the Beaglebone. Or I have to enable something else but can't seem to track down what.

    Could anyone please offer any help on how to get debug messages on UART0 during kernel booting on am335x?

    I saw that UART port data is in fact contained inside the dts source for am33xx.dtsi. So I would probably reach my goal sooner if I just used that. But I really would like to know how to modify the kernel to get the same result to see behind the scenes, so to speak. Or perhaps modification is not even necessary and I just have to enable something.

    I also have a second question and that is whether .dtb and kernel boot command line arguments need to be "synced"? That is can one override the other or cause any problems if the same thing is set differently?

    Thanks.

    Cheers!

  • Hello to anyone still hanging in with me. :)

    I still have had no luck with getting a Linux kernel build running on my Beaglebone. Would anyone be prepared to share a .config file which works with the Beaglebone? A uImage made from that .config would also be very useful to me so that I take this step by step and see at which point I make a mistake. I would also be interested in which tool chain was used when making uImage from .config.

    All help is greatly appreciated.

    Thanks.

    p.s.:I use linaro's gcc-arm-linux-gnueabi tool chain and have worked with linux 3.6.6 so far. I also tried using a device tree which comes with Linux sources but without success. My Beaglebone revision is A6.