OpenWrt Forum Archive

Topic: Working on OpenWRT port to new hardware - help with Makefile please!

The content of this topic has been archived on 10 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I'm working on porting OpenWRT to some new hardware. A lot of this is new to me (previous embedded work has been on much simpler systems - PICs, etc), so I'm learning a lot as I go.

Anyway, I'm working on the Makefile found in openwrt/target/linux/ar71xx/image/Makefile

I've added line 2137 to that makefile:

$(eval $(call SingleProfile,EnGenius,64k,EAP1200H,eap1200h,EAP1200H,ttyS0,115200,$$(eap1200h_mtdlayout),KRuImage,,0x61))

I can't work out what the last parameter, '0x61' is used for. In fact, I can't even work out where this parameter eventually goes.

As far as I can trace, there's a definition on line 942 of that makefile:

SINGLE_PROFILES:=

# $(1)      : name of image build method to be used, e.g., TPLINK-LZMA, AthLzma.
# $(2)      : name of the build template to be used, e.g. 64k, 64kraw, 128k, etc.
# $(3)      : name of the profile to be defined.
# $(4)      : board name.
# $(5)~$(7) : arguments for $(mkcmdline)
#        board=$(1) console=$(2),$(3)
# $(8)~$(14): extra arguments.
define SingleProfile
  # $(1): action name, e.g. loader, buildkernel, squashfs, etc.
  define Image/Build/Profile/$(3)
    $$(call Image/Build/Template/$(2)/$$(1),$(1),$(4),$$(call mkcmdline,$(5),$(6),$(7)),$(8),$(9),$(10),$(11),$(12),$(13),$(14))
  endef
  SINGLE_PROFILES += $(3)
endef

So this parameter, now $10, gets passed to another macro, "Image/Build/Template/$(2)/$$(1)", but from there I can't follow what happens.

I would appreciate some help on this! I have already built and programmed the router with my first effort firmware - it goes into kernel panic, but fortunately the bootloader is intact.

A.

Any progress on this?, Is it any similar to the ESR1750 save for no switch?

It is very similar to the ESR1750, chipset is QCA9557-AT4A and Atheros AR8035-A Ethernet with one PHY. 5GHz radio is on a PCIe card.

So basically, a 2-radio wireless AP :-)

I did get this working, it was a pretty obscure problem (especially as this pushed my knowledge to the limit). It was ultimately because I based it on the ESR1750, which at the time was some kind of patch on the main trunk version of OpenWRT. There was some essential bit of c code which had to go into a version of machtypes.h that was being created by scripts. Or something like that.

(Last edited by bicyclerepairman on 13 May 2016, 06:02)

So, what were the changes that were needed on the makefile and machtypes.h to properly build for the EAP1200h?  Did you jot them down and can you share?  Thanks!

I made changes to a number of files, and kept a list of them:

/target/linux/ar71xx/generic/profiles/engenius.mk
    adds new router as option in "make menuconfig" 

/target/linux/ar71xx/config-4.1 
    assorted kernel config stuff

/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
    something to do with image checking (router name added at line 216, might actually be needed at line 442)

/target/linux/ar71xx/patches-4.1/700-MIPS-ath79-add-openwrt-machines.patch
    adds entry to "make kernel_menuconfig", and includes new router .c file 

/target/linux/ar71xx/base-files/lib/ar71xx.sh
    adds device name to some list (names may not match - line 469 - double entry to try to make sure) 

/target/linux/ar71xx/image/Makefile
    line 1273: flash map, line 2201 - SingleProfile call (last (10th) parameter is "board code" - took a wild guess!), (line 2310 - Multiprofile stuff - not sure if needed)

/target/linux/ar71xx/files/arch/mips/ath79/mach-eap1200h.c
    GPIO, MAC address, board set-up, etc

/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
    ath10k (PCIe 5Ghz) caldata and MAC (5G MAC adds 2 to eth0 MAC...) 

/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
    added at line 224: 
        ucidef_set_led_wlan "wlan2g" "WLAN 2.4 GHz" "eap1200h:blue:wlan-2g" "phy1tpt"
        ucidef_set_led_wlan "wlan5g" "WLAN 5 GHz" "eap1200h:green:wlan-5g" "phy0tpt"

/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
    added line 349, under access points, as no ethernet switch:
        "ucidef_set_interface_lan "eth0""

/target/linux/ar71xx/base-files/etc/diag.sh 
    just power LED, add around line 120:
        status_led="eap1200h:amber:power" 

I also kept a copy of the changed files, but as some of them were patch files, it might take a little work to use them now.

The discussion might have continued from here.