Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build 3.0 images for n750 and tp-link routers #159

Open
wrought opened this issue Nov 23, 2019 · 13 comments
Open

build 3.0 images for n750 and tp-link routers #159

wrought opened this issue Nov 23, 2019 · 13 comments

Comments

@wrought
Copy link
Contributor

wrought commented Nov 23, 2019

assuming this needs to be edited https://github.com/sudomesh/sudowrt-firmware/blob/master/openwrt_config/arch_configs/ar71xx

then the firmware tested and bugs fixed from there

@bennlich
Copy link
Collaborator

Yessssssss

@paidforby
Copy link

x-post from mesh mailing list

assuming this needs to be edited https://github.com/sudomesh/sudowrt-firmware/blob/master/openwrt_config/arch_configs/ar71xx

Yes, line 3 needs to become `CONFIG_TARGET_ar71xx_generic_MYNETN750=y

then the firmware tested and bugs fixed from there

The bugs that need to be fixed will be in the pre-autoconf etc files and the post-autoconf etc files. I believe the biggest difference has to do with the layout of the ports/vlans. You can also reference the legacy makenode repo https://github.com/sudomesh/makenode to see if there are any hints. For example, this etc/config/network file looks important and it appears to be the only N750 specific file.

@wrought
Copy link
Contributor Author

wrought commented Dec 3, 2019

I'm rolling up my sleeves on this, but not making too much progress yet. I see the port/vlan layout differences especially concerning the switch configuration. Wishing there was some good documentation concerning OpenWRT's handling of building multiple images for different devices on the same architecture.

For instance, I added a config target line instead of replacing in arch_configs/ar71xx , as I would like to build both n600 and n750 images. Further, I'm not totally wrapping my head around how to resolve #157.

@paidforby
Copy link

You cannot target two different devices. Not sure why. It will only accept the second (i.e. the last executed) target. This is based on experience, though I may be able to find a source that corroborates my theory.

My idea for creating multiple images is to re-run the build for each target. If done correctly each build should only take a minute or two.

I don't have a lot of suggestion for working with the ports, I do love this diagram that you linked to, though.

@bennlich
Copy link
Collaborator

@wrought Have you looked at the makenode configs for the n750? We used to be able to configure sudowrt 0.2.x for those devices with makenode, so I think if we copy the n750 configs from there, it ought to work. I'm down to look at this with you sometime if it would help to have some company :)

@bennlich
Copy link
Collaborator

These are the n750 configs from makenode: https://github.com/sudomesh/makenode/tree/master/configs/ar71xx/home_nodes/mynet_n/n750

@paidforby
Copy link

You are correct @bennlich, and that directory only contains one configuration, /etc/config/network. I believe that you should be able to just drop in the n750 config from makenode as a replacement for the n600 config in autoconf here, https://github.com/sudomesh/sudowrt-firmware/blob/master/files/opt/mesh/templates/etc/config/network.

autoconf has not deviated from makenode that much yet, so the template configs are essentially interchangeable, though we should confirm that all the entries that need to be updated in the n750 network config match up uci set network commands in autoconf here https://github.com/sudomesh/sudowrt-firmware/blob/master/files/opt/mesh/autoconf#L74.

I still think autoconf needs to be refactored. This issue of handling different hardware is another good reason, in addition to the ones i listed in #153.

@paidforby
Copy link

I've (re)discovered the main difference between n600 and n750 configs. It appears that the n600 has a wan interface that is designated as 'eth1'. On the n750, the wan interface is designated as vlan 5 on the eth0 with 'eth0.5'.

The main change needs to be made in two files.
First, files/etc/config/network. This is the pre-autoconf network config file, and needs to have this vlan config added

config switch_vlan
  option device 'switch0'
  option vlan '5'
  option ports '0t 5'

and the wan interface changed to the following,

config interface 'wan'
  option ifname 'eth0.5'
  option proto 'dhcp'

Similarly, files/opt/mesh/templates/etc/config/network, the post-autoconf network config, needs the same lines changed/added.

@paidforby
Copy link

I made the suggested change in this commit to the n750 branch. Someone should build this and test it!

I also have some ideas on how to integrate this change into master so that y'all can automatically build binaries for both n600s and n750s. My ideas are loosely related to #153 so I may make some commits to master in preparation for a merge (assuming that commit worked).

paidforby pushed a commit that referenced this issue Dec 22, 2019
@paidforby
Copy link

Ok, so now it is actually building for n750. I realized the main reason for the existence for openwrt_rebuilder is to rebuild this for the n750. The lines of particular interest are,

  local build_dir=${workdir}/${BUILD_DIR}/builder.${arch}
  local kconfig=${build_dir}/scripts/kconfig.pl
  local config_dir=${workdir}/openwrt_config/arch_configs
  local config=${build_dir}/config.${arch}
  $kconfig 'm+' "${config_dir}/generic" "${config_dir}/${arch}" > "${config}"

In openwrt_build_configure, the configurations are saved to built_firmware/openwrt/config.ar71xx, but the configurations being used are in built_firmware/builder.ar71xx/config.ar71xx. So openwrt_rebuilder saves them to built_firmware/builder.ar71xx/config.ar71xx. I

t's always been unclear to me why these two directories exist, why don't we just always build in built_firmware/openwrt/. I'm sure this was an intentional design choice, I see a note in build_lib where it makes hardlinks to the build directory,

  local build_dir=${workdir}/${BUILD_DIR}/builder.${arch}

  if [ ! -d "$build_dir" ]; then 
    # Make hardlinks to avoid space duplication but to still isolate builds
    cp -lr "${workdir}/${BUILD_DIR}/openwrt" "${build_dir}"
  fi

I'm not sure why we need to "avoid space duplication" and "still isolate builds"... who knows.

@wrought
Copy link
Contributor Author

wrought commented Feb 19, 2020

Hi, thanks for your work on this @paidforby

Coming back to this task -- so it seems from what I can tell you're saying the n750 build is building but it has not been flashed and tested, is that correct? If so, I can run the build again and try to use the firmware it generates on the router I have.

In any event, it seems like the task of supporting both images would require further modification of the build scripts, right? That was what I would like to help accomplish so that we can continue to flash n600 and n750 models until we run out.

I also created issue #163 to track moving the configurations over to an openwrt package instead of maintaining the sudowrt-firmware pre-script scripts.

@paidforby
Copy link

Coming back to this task -- so it seems from what I can tell you're saying the n750 build is building but it has not been flashed and tested, is that correct? If so, I can run the build again and try to use the firmware it generates on the router I have.

So I believe I left this task at the following point: I built an n750 image. I flashed that image to an n750. It was apparently successful, but when the n750 boots it is not providing DHCP on any of the ports, nor can I ping by setting a static in the possible default ranges.

I'm not sure how much I debugged. I know that I did not have an ethernet to plug in and test the WAN port, not sure that would make much difference.

I think the key thing to play with is the etc/config/network file. But I could be wrong, I don't want to discourage you from following other leads.

HOWEVER, I think #163 is a much more worthy project to pursue. Maybe you could flash vanilla OpenWrt to the n750, install babeld and tunneldigger, and then figure out how to turn autoconf into a package.

@wrought
Copy link
Contributor Author

wrought commented Feb 26, 2020

Aha, I had misread your earlier comment, I am going to attempt to build, flash, test, and fix any issues to hopefully get this branch working for n750 builds (for now).

Otherwise, I plan to proceed with #163 at this point. In fact, we may have gotten some Microtik and other hardware to work with tonight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants