Compiling for Omega2+ on Red Hat Linux?



  • ... Hunh. I started to run make in the openwrt directory, to generate the error messages to post here... but it kept going past where it stopped before, and after having let it run a while, it looks like it's actually successfully compiled.

    The only possibly relevant changes to the system I can think of are that I installed the packages for Docker before I realized they were obsolete, including all the dependencies; and when I uninstalled the main Docker packages, the dependencies didn't go away. So maybe they were what my system needed. Or maybe my system just needed to try having make run a few times in a row to get past whatever the problem was.

    In short: Looks like this thread is now unnecessary. (Unless something else turns up as I try to compile some particular thing.)



  • And of course it couldn't be that easy.

    I'm trying to compile a module for BtrFS, for my Omega2+; so far, the result of my efforts is this file: http://www.datapacrat.com/temp/kmod-fs-btrfs_3.18.45-1_ar71xx.ipk

    Unfortunately, when I bring that file onto my Omega, and try to use opkg to install it, I get an error. (And of course Putty doesn't seem to be letting me copy the error's text directly - yes, I know Putty is designed to use the mouse for that.) I run opkg install ./kmod-blah, and get...

    Unknown package 'kmod-fs-btrfs'.
    Collected errors:

    • pkg_hash_fetch_best_installation_candidate: Packages for kmod-fs-btrfs found, but incompatible with the architectures configured
    • opkg_install_cmd: Cannot install package kmod-fs-btrfs

    ... I have a suspicion that the error arises because the compilation instructions I've been working on were based on the first Omega, and need tweaking for the Omega2+. So, new question: When compiling for the Omega2+, what's different than when compiling for the original Omega?



  • @Daniel-Boese

    Did you set the system type in menuconfig to ramips and then mt7688 specifically?

    Otherwise you probably built a big-endian mips executable for an ar9331 as on the Omega1 rather than a little endian mips one with the mt7688 configuration details.

    There might also be issues at the ipkg level, less familiar with that.



  • @Chris-Stratton
    The menuconfig I have is currently set to 'Atheros AR7xxx/AR9xxx'. ... I don't see any options resembling either 'ramips' or 'mt7688'. Am I looking in the wrong place? (I grabbed the openwrt files on Feb 4th, so going by my web history, it's the 15.05 version from http://git.openwrt.org/?p=15.05/openwrt.git;a=summary .)



  • Depending on version it might be called Ralink or Mediatek (who bought this line) or "MediaTek Ralink MIPS"

    Subtarget should be something like MT7688

    AR9xxx will definitely not work, that is their competitor, architecturally similar but ABI-incompatible due to the endian difference and more.



  • @Daniel-Boese Use the LEDE files. There is even a Omega2/+ specific target.

    From my Dockerfile you can get how to configure it manually with menuconfig:

    echo "CONFIG_TARGET_ramips=y" > .config  && \
    echo "CONFIG_TARGET_ramips_mt7688=y" >> .config  && \
    echo "CONFIG_TARGET_ramips_mt7688_DEVICE_omega2p=y" >> .config && \
    make defconfig
    

    This means that in menuconfig, where it appears TARGET Atheros AR7xxx/AR9xxx you have to choose rampis, etc.
    Or you can copy and paste those 4 lines.



  • @Chris-Stratton
    Ah, thank you, there we go: "Target System: Ralink RT288x/RT3xxx", "Subtarget: MT7688 based boards".

    With that setting, I've now compiled https://www.datapacrat.com/temp/kmod-fs-btrfs_3.18.45-1_ramips_24kec.ipk ...

    ... and opkg is giving me the same errors it did before. Phooey; it looks like I won't be able to take the shortcut of just compiling the one module I need, I'll need to compile the whole set of packages. Looks like I've got a weekend project of looking up how to use the Omega2+'s built-in OS as a bootloader, and installing the actual OS onto my 32 GB microSD card. (I know I saw the instructions for that somewhere, I've just lost track of where.)



  • @José-Luis-Cánovas
    I think I've got the settings to compile the openwrt packages; if I can't figure out how to get them to work, I'll give LEDE a try.



  • Keep in mind that while LEDE is a derivative of OpenWRT, they typically use different C libraries, so you face either an all-or-nothing switch, or some interesting times getting two different dynamic linkers to cohabitate.

    I'd recommend against using an SD card as a root filesystem if you can at all avoid it.

    You can use the built-in U-Boot to or even the sysupgrade under the running Linux to write a completely different software install to the SPI flash; you can also build a kernel with the filesystem packed as an initramfs that will uncompress and run from RAM, especially if you want to tftp something in and give it a one-shot try without storing to flash. Modifying U-Boot to read such a build off a card or USB storage (which would then run from RAM) could be worthwhile.

    Getting back will be trickier if your new image proves non-functional; you'd either need TFTP over wired ethernet or a USB stick to get the stock image back into U-Boot and then write it to flash.

    (Or if you want a real adventure in hardware hacking there is JTAG or directly writing the flash chip with something else, if you contemplate changing U-Boot it would be good to have one of these in reserve)



  • @Chris-Stratton

    I'd recommend against using an SD card as a root filesystem if you can at all avoid it.

    May I ask why? I'm already using it as an overlay, and my plan is for most disk activity to be on the multi-terabyte BTRFS drive that's the whole point of this exercise.

    you can also build a kernel with the filesystem packed as an initramfs that will uncompress and run from RAM

    I suspect I'm going to have trouble enough just figuring out which kernel modules I'm going to need to include to support the Omega2+'s built-in hardware, so that I don't accidentally brick the thing. (I'm tempted to use make menuconfig and just select /all/ the blank items to compile as modules to be on the safe side...)

    Honestly, I find myself amused at the contortions I'm having to go through to accomplish the goal of "stock Omega2+ or better, plus support for BtrFS". At this stage, if anyone here happens to have something I can download that includes that, I'm willing to forgo the current character-building learning experience.



  • @Daniel-Boese said in Compiling for Omega2+ on Red Hat Linux?:

    @Chris-Stratton
    ... ... ...
    I suspect I'm going to have trouble enough just figuring out which kernel modules I'm going to need to include to support the Omega2+'s built-in hardware, so that I don't accidentally brick the thing. (I'm tempted to use make menuconfig and just select /all/ the blank items to compile as modules to be on the safe side...)

    Good luck with that :-( Chances are that in selecting all* blank items will not work.
    I have tried something similar and basically just gave up when there were several modules that:

    • either just failed to build - even after tracking down the myriad dependencies
    • or failed because the repo that needed to be accessed was password protected


  • Hopefully the defaults would work.

    Especially if the real goal is just to build enough to get a working toolchain rather than a complete bootable and functional system.



  • @Chris-Stratton said in Compiling for Omega2+ on Red Hat Linux?:

    Hopefully the defaults would work.

    Especially if the real goal is just to build enough to get a working toolchain rather than a complete bootable and functional system.

    You should be OK with the defaults
    Also, building the toolchain works and is usable - just make sure you select it in make menuconfig :-)



  • I find myself nervous about selecting the right hardware options in make menuconfig.

    Has anyone got a .config file for openwrt which you already know works with an Omega2+, which you'd be willing to share?



  • The issue is not the configuration file but the source code; if you have a suitable source tree, the source you got it from should (or resource that pointed you towards it) should be telling you how to proceed. Typically there would already be an appropriate board target. Then unless you are trying to change something you should be able to just use what that sets.

    Note that there is not at present any complete, working, published source that specifically targets this board.



  • @Chris-Stratton
    I have the OpenWRT 15.05 source tree. But when I run make menuconfig, and look at the options for Firmware, I'm presented with choices for everything from ar3k-firmware to wl18xx-firmware, none of which are selected, none of which I know whether to select or not. There's an even larger plethora of hardware bits to select from in the kernel modules. For instance, even if I don't plan on using it, I'm fairly confident that a stock Omega2+ has the kmod-ledtrig-morse kernel module installed, but it's not highlit by default in menuconfig; more seriously, not one of the kernel modules for network devices or wireless drivers is already chosen.

    My worry is that if I don't pick exactly the right bits of hardware here, then when I try to use my home-compiled OS on my Omega2+, I'll have left out an important piece that will prevent me from even connecting to the Omega2+ again, effectively bricking the thing.

    I'm hoping that if someone already has a .config that works, then I can safely use that as a guide to which modules for hardware support I need, and I can build from there. Failing that, maybe a simple list of which bits of hardware are on the Omega2+ (as opposed to the Omega) that need such software to be compiled would be enough to keep me from reproducing my earlier mistake of trying to compile for entirely the wrong board. Failing /that/... maybe I could try compiling a monolithic kernel that just includes support for everything, but that's hardly optimal.

    Rephrased: My current problem is a lack of info on what chips and such are on the Omega2+ that need kernel/OS software compiled for them.



  • You seem to have overlooked the comment about there not being any complete full source tree tuned to this board available, from onion or anyone else.

    Probably the closest would be to get mediatek's tree for the linkit smart, though you may have to deal with some issues with the different flash chip chosen (or it might work anyway)

    It is indeed likely that early self build attempts will not function, thus you will need to have a mechanism to get a new image in without a working one - likely either a USB drive to U-Boot, TFTP over wired ethernet to U-Boot, or less likely directly programming the SPI flash chip with someone else or using JTAG to load in the code and then U-Boot to write it.



  • @Chris-Stratton

    you will need to have a mechanism to get a new image in without a working one - likely either a USB drive to U-Boot, TFTP over wired ethernet to U-Boot, or less likely directly programming the SPI flash chip with someone else or using JTAG to load in the code and then U-Boot to write it.

    I am completely unfamiliar with those techniques. Do you have any references on any of them handy?



  • @Daniel-Boese

    USB should be covered in onion docs, TFTP may be there or in openwrt docs.

    The other two should only be attempted if you are already quite familiar with them in concept.



  • As far as I know you can find a sdk
    with omega2 and omega2+ configuration files on onions git hub

    When configuring with "make menuconfig"
    you will see sub options for omega2 and omega2+ if you select the mt7688 as target. Thats what I used for my images.

    I never tested them cause atm I don't need them but as soon as I need custom kernel mods I will give them a try.

    I remember that on Omega2 stock os your not able to install custom kernel mods.
    At least it didn't work when I tried to install my "HelloWorld" kernel mod
    I have accomplished to successfully comile :D.

    When building the image with the build options from the onion sources I mentioned above will I then be able to install custom kernels?


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.