Community discussions

MikroTik App
 
User avatar
NathanA
Forum Veteran
Forum Veteran
Topic Author
Posts: 829
Joined: Tue Aug 03, 2004 9:01 am

HOWTO: Dual-booting RouterOS and OpenWRT on RouterBoard

Tue Jan 13, 2015 4:33 pm

By bringing together many different sources (including MikroTik's own Linux kernel patches and drivers...thanks!), and thanks in no small part to the recent-ish partitions feature in RouterBOOT, I am pleased to announce that after a couple of solid weeks of work, I have recently managed to get dual-booting between RouterOS and OpenWRT on a single RouterBoard to work.

Why would anyone want to do this? I am sure that other people can come up with their own good reasons for doing this, but in my particular case, I have been using MetaROUTER for some time to run third-party software alongside RouterOS on the same device, and I have unfortunately been fighting tons of MetaROUTER and RouterOS bugs and instabilities lately that have been frustrating both to me as well as to our clients, and at the present time, there does not seem to be any hope for a fix in sight, which leaves me in a very bad position. I know that OpenWRT has been ported to many RouterBoards and that I could just completely delete RouterOS and exclusively run OpenWRT on one if I chose to, and in a few of the cases where I have been having problems, I probably will end up going to 2 devices: one running RouterOS, and one running OpenWRT that performs the tasks that I normally run inside of a MetaROUTER. But I guess I must be an optimist, because I am hoping that this will be a temporary situation and that MikroTik developers will eventually get their act together on MetaROUTER. When that day comes, I would like to be able to boot RouterOS back up and fire up OpenWRT inside of MetaROUTER as if nothing had happened, without going through the pain of reinstalling RouterOS, re-loading my MetaROUTER image(s), and restoring the configuration on both. Being able to do this will also give me a good way to test and verify that problems I am experiencing are able to be blamed on MetaROUTER and not on OpenWRT itself. (There is also no reason why you couldn't install two copies of OpenWRT side-by-side on a RouterBoard and switch between them, just like you currently can with multiple versions of RouterOS.)

Essentially what I have done is built a single Linux kernel that is aware of MikroTik's in-memory NAND partitions, as well as a single kernel binary that can boot both inside of MetaROUTER as well as bare-metal on a RouterBoard, just like MikroTik's own kernel. So you can literally run the same exact OpenWRT install bit-for-bit either inside of MetaROUTER or directly on a RouterBoard.

Details and disclaimers about my kernel and OpenWRT image: it is based on an old OpenWRT version (Kamikaze 8.09.2) because that is what I initially based my custom MetaROUTER images on, and so far I have had no need or reason to change it because it has been very solid for me. Eventually I do plan on moving to a more current version of stable OpenWRT, but for right now, I am trying to change as few variables as possible and so avoid running the risk that updates to either my userland or my build environment/toolchain will introduce new bugs or regressions (the devil I know instead of the multiple devils I don't). And rather than try to shoehorn a Linux 3.x kernel onto Kamikaze, I elected to take MikroTik's own patches to 2.6.35 that they wrote for RouterOS 5.x, integrate them into the Kamikaze build, and then backport the various MikroTik drivers from their 3.3.5 kernel patch set for RouterOS 6.x. This gives me support for recent RouterBoard hardware without me needing to change anything in my custom image except for the kernel itself.

There are a couple of quirks to be aware of:
  1. I have really only been testing this so far on RB450G, and the only builds I have done so far are for MIPSBE. In theory, this kernel can probably run on other RB400/700/900 RouterBoards just fine (and it will certainly work inside of MetaROUTER on all MIPSBE RouterBoards), and in theory I can probably do basically the same thing on PowerPC, but none of this has been done or tested yet outside of 450G support.
  2. Hardware ethernet support when directly booting this build on a RB450G does work, but you will only see 2 ethernet interfaces: eth0 and eth1. eth0 corresponds to ether1, and eth1 is connected to the remaining 4 ports (ether2-ether5), which are switched together without any VLANs by default. I believe there is a utility included with OpenWRT that can be used to configure the switch chip, but I have not tested or played with it yet.
  3. I built and included the drivers for other hardware (such as, for example, USB support), but they have not received any testing yet and may not currently be in a working state. Also, ethernet ports on RouterBoards other than the 450G may not work, and no wireless support has been included yet.
  4. When it comes to NAND partitions in RouterBOOT, there is one proprietary MikroTik "feature" that I haven't been able to tame yet: by default, RouterBOOT employs some kind of "dead man switch" that RouterOS has to toggle in order to indicate to RouterBOOT that it has successfully booted. If it doesn't toggle it, RouterBOOT assumes that something is wrong, and as a failover measure, the next time the RouterBoard boots up, RouterBOOT will follow whatever it is configured to do, and the default action is to change the active partition to the next one in line. Since my kernel doesn't know how to tell RouterBOOT that it has booted up just fine, when you shut down or reboot the RouterBoard, it will boot up RouterOS next time instead of OpenWRT, even when there is no problem that prevented OpenWRT from booting. This can be worked around, but doing so effectively disables this partition failover protection feature.
You can download my OpenWRT build as both a tarball with a normal kernel and as a netbootable ELF image with a userland you can use "live" without flashing it to the NAND. Here are the links for both:
I only just put the finishing touches on it a little bit ago, and am now working on cleaning up the changes I made to the kernel sources and the OpenWRT buildroot so that I can release a set of patches for download. I expect to have that ready in the next couple of days and will update this thread when I'm done.

Do note that this is image is only provided for demonstration purposes! I will most likely use this as the future base for my Asterisk MetaROUTER images, but I have not built any OpenWRT packages for any apps, nor do I plan to run an OpenWRT package repository. If you want a specific application, you will either have to compile it yourself, or wait for somebody else to build packages and set up a repository.

I will try to carve out some time to write up some step-by-step installation instructions later, but basically what you do is configure one or more new partitions, netboot the INITRAMFS kernel on the device you want to install to, mount the new, second Main partition, download and extract the tarball to that partition over the network, mount the corresponding Boot partition, and copy the kernel to it. After that, you should be able to boot either OpenWRT or RouterOS by setting whichever partition you want to boot as the active one in either RouterBOOT or RouterOS (cannot be done from within OpenWRT at this time).

Since the exact same kernel binary can boot just fine either from RouterBOOT or from within MetaROUTER (and has all of the necessary driver and filesystem support for both environments), another trick you can accomplish is to install my OpenWRT build to a partition, mount that partition within RouterOS, and boot your OpenWRT partition within a MetaROUTER instead of importing the OpenWRT tarball...so, kind of like VMware Fusion's support for directly booting your Windows Boot Camp partition rather than booting Windows from a VMDK image file. I have done this and it works great, but I will probably have to leave figuring out the exact steps for making this work as an exercise for the reader, and it is DEFINITELY not supported by MikroTik (no way to accomplish this using standard commands from RouterOS shell or Winbox). Basically, you will need to modify the main RouterOS system package's read-only squashfs image so that the startup scripts mount your OpenWRT partition to the right location when RouterOS boots up. In theory, there is no reason why this exact same procedure couldn't be applied to an external disk, which would allow you to run and store MetaROUTERs on an SD card, for example, which is something that MikroTik themselves has sadly made no move to support (even though it was mistakenly advertised in early promotional materials). If you do this, you will have to re-do your modifications after every RouterOS upgrade.

RouterBoards, RouterOS, MetaROUTER, and the RouterBOOT bootloader are all very powerful and very flexible platforms and tools, especially when considered together; in fact, because these are basically general-purpose computers/SoCs running Linux, they are much more flexible than most people probably realize or give them credit for. This is a rough technical proof-of-concept, but if the value and utility of these kinds of features is recognized, then perhaps someday we will see some of these features become officially supported. Hey, a guy can dream, right? :)

-- Nathan
 
jarda
Forum Guru
Forum Guru
Posts: 7756
Joined: Mon Oct 22, 2012 4:46 pm

Re: HOWTO: Dual-booting RouterOS and OpenWRT on RouterBoard

Tue Jan 13, 2015 5:56 pm

Unbelievable. It's awesome. Even it seems that automatic dual boot function is more by error than by intention.
I will track this thread just because I believe that it opens really wide new world for all of us.
Please, keep going forward. Thank you.
 
User avatar
NathanA
Forum Veteran
Forum Veteran
Topic Author
Posts: 829
Joined: Tue Aug 03, 2004 9:01 am

Re: HOWTO: Dual-booting RouterOS and OpenWRT on RouterBoard

Fri Jan 16, 2015 3:34 pm

They aren't very pretty, but I've published a set of patches to Linux 2.6.35 and OpenWRT Kamikaze 8.09.2 that should do the trick to http://www.nconx.com/~nathan/openwrt-rb ... 2.6.35.txz. I'll try to finish and post the instructions for their use next week.

-- Nathan
 
User avatar
NathanA
Forum Veteran
Forum Veteran
Topic Author
Posts: 829
Joined: Tue Aug 03, 2004 9:01 am

Re: HOWTO: Dual-booting RouterOS and OpenWRT on RouterBoard

Mon Jan 19, 2015 11:34 pm

This weekend, I published updated images and patches in order to fix an issue with NAT/conntrack kernel modules (I was apparently a bit too aggressive in purging what I thought to be non-crucial patches from MikroTik's set), and in order to smooth out and simplify the build process. So if you downloaded the patches before today, you might want to grab a fresh set.

Right now, the most significant limitation with this build of OpenWRT is that you have to hard-code the root partition information in the kernel binary. I am looking into a way of auto-detecting this in future versions. The images that I am publishing assume that they will be installed in the first partition. If you want to install OpenWRT to a different partition, then you will either have to rebuild an image yourself after changing the file target/linux/rb-mipsbe/image/kernparm in the buildroot tree to point to the right device, or use objcopy from a build of binutils that understands MIPS32 big-endian ELF binaries to modify the images I have already built (replace the ELF section called 'kernparm'). Note that in actuality, each RouterBOOT "partition" consists of 2 partitions: one for the kernel itself, and one for your root partition. And the partitions are counted starting from 0. So if, for example, you had 4 partitions defined in RouterBOOT, and you wanted to install OpenWRT to the fourth partition, you would supply a root= parameter to the kernel of 'root=/dev/mtdblock7' and copy the kernel to the partition /dev/mtdblock6.

Here is the basic rundown of how to do a build (note step 6, which I will try to eliminate from future versions):
  1. Ensure that the host that you want to set up the OpenWRT buildroot on has all necessary requirements and dependencies met.
  2. Download all of the essentials (for sake of command examples, I'll assume you are storing these in your home directory):
  3. Unpack the Kamkiaze 8.09.2 source tree somewhere:
    $ mkdir ~/openwrt; cd ~/openwrt
    $ tar xvjf ~/kamikaze_8.09.2_source.tar.bz2
  4. Unpack my additions from the Kamikaze source tree root:
    $ cd ~/openwrt/8.09.2
    $ tar xvJf ~/kamikaze-rb_mipsbe-2.6.35.txz --strip-components=1
  5. Apply the necessary patches to the Kamikaze buildroot:
    $ patch -p1 < target/linux/rb-mipsbe/kamikaze-rb-mipsbe-buildroot.patch
  6. Remove the "unused" patches from the OpenWRT kamikaze 2.6.35 generic patch set that conflict with the MikroTik ones:
    $ find target/linux/generic-2.6 -type d -name "unused" -exec rm -rf "{}" ";"
  7. OPTIONAL: The official Kamikaze tarball only comes with a small subset of the build files for various packages, so grab the full set:
    $ make defconfig package/symlinks
  8. Run the OpenWRT buildroot configurator...
    $ make menuconfig
    ...and make sure that under Target System you select "Mikrotik MIPSBE RouterBoard [2.6]" and under Target Images you select either "tgz" (if you want to build an image that is installable to the router and/or importable to MetaROUTER) or "ramdisk" (if you want to build a netbootable image file). Then pick whatever packages you wish to have included in the image. Save your configuration and exit menuconfig.
  9. If building an installable (tgz) image file, edit the file target/linux/rb-mipsbe/image/kernparm to reflect the root partition that you plan to install OpenWRT to on the RouterBoard (as previously described).
  10. Now run 'make' to build everything; the final file will be located at bin/openwrt-rb-mipsbe-rootfs.tgz (if you built the installable image) or bin/openwrt-rb-mipsbe-vmlinux-initramfs.elf (if you built the netbootable "live" image):
    $ make
To install an installable image to a RouterBoard...
  1. netboot the "live" image (I typically put the netbootable image on another RouterBoard running RouterOS, enable TFTP, set up a DHCP server with BOOTP enabled, and set the "Boot File Name" on the DHCP network to the file name of the netbootable image)
  2. plug an ethernet cable with access to an internet connection into ether1 (the images I supplied will try to get an IP via DHCP on ether1)
  3. use 'scp' or 'wget' to copy the installable image to the RAM disk at /tmp
    # cd /tmp
    # wget http://www.nconx.com/~nathan/openwrt-rb_mipsbe/openwrt-rb_mipsbe-rootfs.tgz
  4. mount the root partition that you plan to install to
    # mount -t yaffs /dev/mtdblock1 /mnt
  5. wipe out its contents if it is not empty
    # rm -rf /mnt/*
  6. unpack the tarball onto the partition
    # tar xvzf /tmp/openwrt-rb-mipsbe-rootfs.tgz -C /mnt
  7. copy the kernel file off
    # cp /mnt/kernel /tmp
  8. unmount the root partition
    # umount /mnt
  9. mount the boot partition that corresponds to the root partition you are using
    # mount -t yaffs /dev/mtdblock0 /mnt
  10. copy the kernel file to it
    cp /tmp/kernel /mnt
  11. unmount the boot partition
    umount /mnt
...and voila: you are done. Set RouterBOOT to boot from that partition, reboot your RouterBoard, and you're good to go.

Have fun,

-- Nathan
 
User avatar
NathanA
Forum Veteran
Forum Veteran
Topic Author
Posts: 829
Joined: Tue Aug 03, 2004 9:01 am

Re: HOWTO: Dual-booting RouterOS and OpenWRT on RouterBoard

Tue Jan 20, 2015 7:34 am

I just wrote a patch to the kernel that eliminates the need to statically specify the root partition on the kernel command line. It automatically determines the correct partition to use as the root file system by keying off of the 'activepart' parameter that RouterBOOT sends to the kernel. You can still set 'root=' manually, though, if you wish, which will always take precedence (unless you are booting the image under MetaROUTER, in which case MetaFS takes over and essentially ignores the specified block device). I have updated my patch set with this new addition. If you want to specify a static root partition, you need to add the 'root=' parameter to target/linux/rb-mipsbe/image/kernparm before you initiate 'make world', but I suspect most people won't have any reason or desire to do this.

Also, I forgot to mention that if you want to set the OpenWRT partition as your active boot partition, and you want RouterBOOT to retain this configuration, you need to change a setting in RouterBOOT, but it's a setting that is only accessible from within RouterOS. So you actually need to boot up RouterOS to make this change. The setting that you need to change is the 'fallback-to' setting for the OpenWRT partition, which needs to be set to itself. So, for example, if you have 2 partitions (part0 and part1), and OpenWRT is on the second partition (part1), you need to do this:
[admin@MikroTik] /partitions> /partitions set part1 fallback-to=part1
If you don't do this, then after you boot OpenWRT the first time and then reboot, RouterBOOT will change the active partition back over to the RouterOS one.

-- Nathan
 
LOLoye7
just joined
Posts: 1
Joined: Tue Jan 27, 2015 8:48 am

Re: HOWTO: Dual-booting RouterOS and OpenWRT on RouterBoard

Tue Jan 27, 2015 8:51 am

Can you please post the image of the metarouter that are you running with tor?
 
User avatar
tomaskir
Trainer
Trainer
Posts: 1162
Joined: Sat Sep 24, 2011 2:32 pm
Location: Slovakia

Re: HOWTO: Dual-booting RouterOS and OpenWRT on RouterBoard

Tue Jan 27, 2015 3:28 pm

Why hasnt MikroTik hired you yet to fix MetaROUTER? :(

Great job, with MKT would fix all of the current issues and we could all be happier...
 
User avatar
NathanA
Forum Veteran
Forum Veteran
Topic Author
Posts: 829
Joined: Tue Aug 03, 2004 9:01 am

Re: HOWTO: Dual-booting RouterOS and OpenWRT on RouterBoard

Wed Jan 28, 2015 3:35 am

Why hasnt MikroTik hired you yet to fix MetaROUTER? :(

Great job, with MKT would fix all of the current issues and we could all be happier...
Ha, well, I am flattered you would say this, but the truth is that I am not qualified to work on MetaROUTER. I have neither the requisite knowledge or experience engineering hypervisors. :) All I essentially did to come up with the kernel I did was to act as an "editor" of sorts, pulling in bits and pieces from various sources. Very little original code in here.

-- Nathan
 
User avatar
tomaskir
Trainer
Trainer
Posts: 1162
Joined: Sat Sep 24, 2011 2:32 pm
Location: Slovakia

Re: HOWTO: Dual-booting RouterOS and OpenWRT on RouterBoard

Wed Jan 28, 2015 11:31 am

Ha, well, I am flattered you would say this, but the truth is that I am not qualified to work on MetaROUTER. I have neither the requisite knowledge or experience engineering hypervisors. :) All I essentially did to come up with the kernel I did was to act as an "editor" of sorts, pulling in bits and pieces from various sources. Very little original code in here.

-- Nathan
I didnt mean just this, all your previous work with MetaRouter suggest you are well versed in this subject.
People have been hired for less "show of knowledge" by other companies... but MikroTik is MikroTik, as it always has been :)

Anyway, atleast take it as a compliment, your work on MetaRouter, its debugging and bug-finding is very good in my personal opinion. :)
Last edited by tomaskir on Fri Jan 30, 2015 12:09 pm, edited 1 time in total.
 
User avatar
bajodel
Long time Member
Long time Member
Posts: 551
Joined: Sun Nov 24, 2013 8:30 am
Location: Italy

Re: HOWTO: Dual-booting RouterOS and OpenWRT on RouterBoard

Fri Jan 30, 2015 8:25 am

..[cut]..
Anyway, atleast take it as a compliment, your work on MetaRouter, its debugging and bug-finding is very good in my personal opinion.
I completely agree, great job Nathan!
 
User avatar
NathanA
Forum Veteran
Forum Veteran
Topic Author
Posts: 829
Joined: Tue Aug 03, 2004 9:01 am

Re: HOWTO: Dual-booting RouterOS and OpenWRT on RouterBoard

Wed Feb 11, 2015 1:08 am

I have decided to split the patches for 2.6.35 support in general from the rb-mipsbe specific patches, so that I can add support for other architectures later and maintain them separately. So there are now two files to download instead of one:
From my earlier build instructions, you will need to repeat step 4 for both files, and then step 5 changes to...
patch -p1 < target/linux/generic-2.6/kamikaze-generic-2.6.35.patch
Finally, you can ignore/dispense with step 6; it is no longer necessary.

-- Nathan
 
User avatar
NathanA
Forum Veteran
Forum Veteran
Topic Author
Posts: 829
Joined: Tue Aug 03, 2004 9:01 am

Re: HOWTO: Dual-booting RouterOS and OpenWRT on RouterBoard

Mon Feb 16, 2015 1:44 pm

I posted an update to the MIPSBE architecture patches with the following changes:
  1. Fixed issues with USB port not powering up on some AR93xx SoC based boards.
  2. Updated ag71xx ethernet driver from OpenWRT trunk in order to add ethernet support for RB951Ui and RB2011UiAS.
Adding support for the ethernet hardware on other MIPSBE RouterBoards should be much easier going forward.

Most USB ports on most MIPSBE MikroTik hardware (including CRS devices) should be working at this point. Also, if you build getty into busybox and then build a netbootable image, if you have a PL2303-based USB serial adapter plugged in during boot, it will give you a busybox shell over the USB console after it is finished booting. This way you can get access to a console even if ethernet is not supported on your particular model and there is no built-in serial console on your model, either.

Please note that for models that use a micro-USB port with a USB OTG cable, the OTG cable must be plugged in during boot, otherwise the USB port will not work. If you unplug the cable after it boots up, that's fine, but it must be present when the USB drivers load, otherwise you will need to plug it in and reboot again in order to get the port working.

I don't have new binaries/images yet, but will post them within the next day or two.

-- Nathan
 
User avatar
bajodel
Long time Member
Long time Member
Posts: 551
Joined: Sun Nov 24, 2013 8:30 am
Location: Italy

Re: HOWTO: Dual-booting RouterOS and OpenWRT on RouterBoard

Mon Feb 16, 2015 3:53 pm

I posted an update to the MIPSBE architecture patches with the following changes:
..[CUT]..
-- Nathan
Your Kamikaze works well but sometimes RB reboot when I "halt" it so I've decided to do some lab :-)
With the help of your instructions I've arranged to build up the toolchain and I've made a quite stable AA (attitude adj) image.
My goal is to try to compile postfix package in AA (present in Barrier Braker/trunk).

As soon as possible I will restart from the begining with your new advices (trying to undestand what I'm doing rather than merely following instructions).

Thanks Nathan
 
User avatar
NathanA
Forum Veteran
Forum Veteran
Topic Author
Posts: 829
Joined: Tue Aug 03, 2004 9:01 am

Re: HOWTO: Dual-booting RouterOS and OpenWRT on RouterBoard

Tue Feb 17, 2015 12:04 am

Your Kamikaze works well but sometimes RB reboot when I "halt" it so I've decided to do some lab :-)
You mean when you boot it directly, or when you run it as a MetaROUTER?

If you mean when you run it as a MetaROUTER, that's not a problem with "my" Kamikaze. That is a RouterOS bug. RouterOS can sometimes crash and reboot itself when you shutdown or reboot a MetaROUTER. It doesn't just happen with imported MetaROUTERS, but also with RouterOS ones. I have a ticket open on this that is over 2 months old (2014120366000411), and even well before then, it was already known to MikroTik support and developers; see this thread and this thread, and my lengthy response on that second thread, located here.

I performed extensive testing, and found that the bug was introduced in RouterOS 6.12. If you downgrade to 6.11 or older, you will not run into it. The bug seems to coincide with some large internal changes that MikroTik made to their build processes (namely, GCC was upgraded from 4.7.1 to 4.8.2 between RouterOS 6.11 and 6.12, which is the only time during the 6.x series that MikroTik developers changed the version of GCC used to build their software), though who knows for sure if that has anything to do with it...it could be that they made some core changes to the kernel around the same time (possibly in order to fix kernel build failures with the newer compiler version) that are directly or indirectly responsible for this bug as well as other MIPS MetaROUTER instabilities I have been fighting that seem to have cropped up at around the same time.

-- Nathan
 
User avatar
bajodel
Long time Member
Long time Member
Posts: 551
Joined: Sun Nov 24, 2013 8:30 am
Location: Italy

Re: HOWTO: Dual-booting RouterOS and OpenWRT on RouterBoard

Thu Feb 19, 2015 1:59 am

running as a MetaROUTER, yes..I forgot to specify
and thanks for the posts links, now I know more about the issue.

If I'm not wrong the AA compiled by me with your instructions has not the problem, but I must verify.. maybe the patches used are already aware of the problem

Somewhere in this thread you spoke about a package back porting you have done, asterisk maybe .. do you think backporting postfix from BB to AA (my goal) is a too complex task?
Probably I'm not skilled enough :) .. and yes, there are always things to learn .. any advice? :D
 
User avatar
NathanA
Forum Veteran
Forum Veteran
Topic Author
Posts: 829
Joined: Tue Aug 03, 2004 9:01 am

Re: HOWTO: Dual-booting RouterOS and OpenWRT on RouterBoard

Thu Feb 19, 2015 5:07 am

If I'm not wrong the AA compiled by me with your instructions has not the problem, but I must verify.. maybe the patches used are already aware of the problem
No, unfortunately, it affects all MetaROUTERs equally. Like I said (and as the other threads I linked to pointed out), it even affects RouterOS MetaROUTERs, not just OpenWRT ones. JanisK himself has verified this and has been able to reproduce the problem at MikroTik HQ using only RouterOS guests, not OpenWRT. If you haven't encountered it with your AA image yet, then that's just because you have been lucky so far, and it is just coincidence that you ran into it with mine, but you will run into it with OpenWRT AA eventually. And it doesn't happen on every shutdown: it is random (or at least seemingly random, but of course, we both know that there is a logical explanation for what is going on and that certain conditions must be met, but that we just don't know what those exact conditions are).

There is nothing you or anyone else can do patch-wise to OpenWRT in order to "work around" the issue. The issue cannot be corrected *within* the MetaROUTER guest. The problem is with the MetaROUTER hypervisor code, which lives and runs on the RouterOS host OS. The only ones that have any power to do anything about this issue are MikroTik themselves, in the RouterOS code.
Somewhere in this thread you spoke about a package back porting you have done, asterisk maybe .. do you think backporting postfix from BB to AA (my goal) is a too complex task?
Package backporting is much easier than driver backporting, which involves mucking about in the bowels of the kernel. Assuming that the application you want to package has no specific kernel dependencies (and most don't...Asterisk is an exception), in most cases, you can probably just take the package directory from SVN/git and plop it in the 'package' directory of your local buildroot, run 'make menuconfig', select it, and off you go. The only time this gets sticky is if the package in question has a dependency on some other package (a library of some sort, usually) that either you don't have in your snapshot of the OpenWRT buildroot or where the version you have of that package happens to be too old to fulfill the dependency. In that case, you have to backport those packages and all of THEIR dependencies, too.

Really, the only way to know is to try it, and when your build breaks, figure out what broke, fix that problem, try building again, and then fix the next problem, and the next, and the next, etc. up until it finally builds cleanly. Just take it one breakage at a time.

-- Nathan
 
LeoCombes
Frequent Visitor
Frequent Visitor
Posts: 78
Joined: Mon May 28, 2007 3:56 pm

Re: HOWTO: Dual-booting RouterOS and OpenWRT on RouterBoard

Tue Feb 24, 2015 3:51 pm

Good work Nathan.
Thanks for sharing!
 
User avatar
Larsa
Forum Guru
Forum Guru
Posts: 1025
Joined: Sat Aug 29, 2015 7:40 pm
Location: The North Pole, Santa's Workshop

Re: HOWTO: Dual-booting RouterOS and OpenWRT on RouterBoard

Mon Feb 13, 2017 9:49 pm

I posted an update to the MIPSBE architecture patches with the following changes... Nathan
Hi Nathan!

I'm currently working on a 4.9 kernel for the B2011UiAS and I wonder if "http://www.nconx.com/~nathan/openwrt-rb ... 2.6.35.txz" might be the latest available patchset? Btw, in case you wonder, my objective is to do a performance comparison of current iptables versus nftables in 4.9...

Thanks in advance!
Regards, Lars.


Ps...
very impressive work you've done so far!
 
User avatar
NathanA
Forum Veteran
Forum Veteran
Topic Author
Posts: 829
Joined: Tue Aug 03, 2004 9:01 am

Re: HOWTO: Dual-booting RouterOS and OpenWRT on RouterBoard

Fri Mar 03, 2017 3:34 pm

I'm currently working on a 4.9 kernel for the B2011UiAS and I wonder if "http://www.nconx.com/~nathan/openwrt-rb ... 2.6.35.txz" might be the latest available patchset?
No, not anywhere close to the latest. 2.6.35 was the kernel used by MikroTik in RouterOS 5. RouterOS 6 is based off of 3.3. RouterOS's major version number changes (5 > 6 > 7) whenever the underlying Linux kernel changes (2.6.35 > 3.3 > ??).

The patches I supplied are a mish-mash of their 2.6.35 patchset combined with some things backported from later 3.3 patchsets I obtained. Only reason for backport is that I was basing my OS images on OpenWRT Kamikaze 8.09.2, and it seemed easier at the time to backport the newer hardware support to a kernel that already ran on Kamikaze vs. trying to make 3.3 work.

MikroTik's kernel is constantly evolving over the course of the entire major (e.g., 6.x) release cycle, as they work to fix bugs and support new hardware. If you send them an e-mail requesting the current up-to-date patches, they'll eventually get around to assembling and sending them to you. The last time I requested patches from MikroTik, I received them Aug. 30, so right after release of ROS 6.36.2, thus it's safe to assume they are of that vintage. If you supply me with contact info, I can forward those on to you.

-- Nathan
 
User avatar
caiot5
just joined
Posts: 15
Joined: Wed Mar 27, 2013 5:48 pm
Location: Brazil

Re: HOWTO: Dual-booting RouterOS and OpenWRT on RouterBoard

Mon Jun 25, 2018 7:16 am

Hi Nathan, nice work!
I have a question regarding devel-login.
With 5.25 x86 version there were a mod which allowed us to install debian alongside with RouterOS (kernel hooks), that I use until today.
Since devel-login came in public, I was wondering whether if is it possible to do the same with a MIPS routerboard since there is a MIPS openwrt version.
So the general idea is to install the routerOS over one partition and openwrt on another then from devel-login chroot into openwrt to be able to use a package manager and general openwrt packages.

Do you think would it be possible?
 
User avatar
NathanA
Forum Veteran
Forum Veteran
Topic Author
Posts: 829
Joined: Tue Aug 03, 2004 9:01 am

Re: HOWTO: Dual-booting RouterOS and OpenWRT on RouterBoard

Fri Jun 29, 2018 3:36 am

Hi caiot5,

If you could make it work with Debian on x86 in a similar way, I'm sure it would be doable with OpenWRT. You wouldn't even need a working/bootable OpenWRT kernel, since you'd be running RouterOS...you would just need the OpenWRT userland to live on the second partition.

I have no interest in working on this, though, so best of luck if you do, and perhaps you could come back and let us all know how you fared if you are successful. :)

The other thing to consider is that the most recent versions of RouterOS (6.4x) have changed how to enable devel-login, and it is no longer as easy to do as before. It also won't survive OS upgrades...you will have to re-implement it after every upgrade.

-- Nathan

Who is online

Users browsing this forum: No registered users and 12 guests