ophub / amlogic-s9xxx-openwrt

Support for OpenWrt in Amlogic, Rockchip and Allwinner boxes. Support a311d, s922x, s905x3, s905x2, s912, s905d, s905x, s905w, s905, s905l, rk3588, rk3568, rk3399, rk3328, h6, etc.
GNU General Public License v2.0
1.82k stars 1.62k forks source link

Local Compile Guide #108

Closed odinotisan closed 3 years ago

odinotisan commented 3 years ago

How do we include packages like diy-part2.sh in local compilation?

ophub commented 3 years ago

In the source directory where openwrt is compiled, enter the path where the diy-part2.sh script is located and execute it, for example:

 ├── router                                           
     ├── amlogic-s9xxx-openwrt     # https://github.com/ophub/amlogic-s9xxx-openwrt related code files
     │   ├── router-config
     │       ├── lede-master
     │          ├── diy-part1.sh
     │          └── diy-part2.sh
     │
     ├── openwrt     # https://github.com/coolsnowwolf/lede related code files
     │   ├── bin
     │   ├── package
     │   └── feeds

cd router/openwrt     # Enter the openwrt directory
../amlogic-s9xxx-openwrt/router-config/lede-master/diy-part2.sh       #Enter the relative path of diy-part2.sh and press Enter to execute
odinotisan commented 3 years ago

Thank you @ophub

Do you face this issue router/openwrt/include/toplevel.mk:230: world] Error 2

ifeq ($(SDK),1)

%::
        @+$(PREP_MK) $(NO_TRACE_MAKE) -r -s prereq
        @./scripts/config/conf $(KCONF_FLAGS) --defconfig=.config Config.in
        @+$(ULIMIT_FIX) $(SUBMAKE) -r $@

else

%::
        @+$(PREP_MK) $(NO_TRACE_MAKE) -r -s prereq
        @( \
                cp .config tmp/.config; \  #### <====== ISSUE LINE 230
                ./scripts/config/conf $(KCONF_FLAGS) --defconfig=tmp/.config -w tmp/.config Config.in > /dev/null 2>&1; \
                if ./scripts/kconfig.pl '>' .config tmp/.config | grep -q CONFIG; then \
                        printf "$(_R)WARNING: your configuration is out of sync. Please run make menuconfig, oldconfig or defconfig!$(_N)\n" >&2; \
                fi \
        )
        @+$(ULIMIT_FIX) $(SUBMAKE) -r $@ $(if $(WARN_PARALLEL_ERROR), || { \
                printf "$(_R)Build failed - please re-run with -j1 to see the real error message$(_N)\n" >&2; \
                false; \
        } )

endif

I have clearly check that there is router/openwrt/.config file

ophub commented 3 years ago

Compile locally for the first time, set: make -j1 V=s

I suggest you use the router-config/lede-master/.config I provided to compile it once. Then modify it. This can detect that your local compilation environment is reliable.

# E.g
cd openwrt
cp -f ../amlogic-s9xxx-openwrt/router-config/lede-master/.config   .config
sync
odinotisan commented 3 years ago

I figured, it was due to running as root

export FORCE_UNSAFE_CONFIGURE=1

Here's the fix, who know it might help someone.

Was figuring how to load the config by reading your workflows. It happens you posted! Thank you so much!

Was trying to build for rtl8812au-ac. Hopefully it works.

ophub commented 3 years ago

Compilation of openwrt files, root user cannot be used.

https://github.com/coolsnowwolf/lede/blob/master/README_EN.md

Note:
DO NOT USE root USER FOR COMPILING!!!
odinotisan commented 3 years ago

Btw, the main readme for S905x2 has a tokopedia link to x96 mini instead of x96 max. Which doesn't work. In order for x96 mini to work, you have to use s905x and change the dtb file to s905w of tx3 mini. It works and boot up perfectly.

odinotisan commented 3 years ago

I figured, it was due to running as root

export FORCE_UNSAFE_CONFIGURE=1

Here's the fix, who know it might help someone.

Was figuring how to load the config by reading your workflows. It happens you posted! Thank you so much!

Was trying to build for rtl8812au-ac. Hopefully it works.

Compilation of openwrt files, root user cannot be used.

https://github.com/coolsnowwolf/lede/blob/master/README_EN.md

Note:
DO NOT USE root USER FOR COMPILING!!!

I missed that. Thanks!

ophub commented 3 years ago

Btw, the main readme for S905x2 has a tokopedia link to x96 mini instead of x96 max. Which doesn't work. In order for x96 mini to work, you have to use s905x and change the dtb file to s905w of tx3 mini. It works and boot up perfectly.

Thank you very much for the information, I have listed s905w separately.

odinotisan commented 3 years ago

It seems to be overriding the .config I have copied from this repo. Whenever make desconfig ran. Following the workflows action in this repo. It shows that it needs to run make desconfig instead of make menuconfig.

Any clue? I have this USB Wireless Adapter I am attempting to compile the module. TPLink T2U NANO.

http://en.techinfodepot.shoutwiki.com/wiki/TP-LINK_Archer_T2U_Nano

On the link above it shows RTL8811AU. But there are multiple revisions.

But when I did lsusb it show the same as HEX/USB MODE SWITCH of RTL8821AU.

Hence, I tried this module but does not work. https://github.com/aircrack-ng/rtl8812au

Then I read on openwrt forum. Someone made a patch. Read last few comments. https://forum.openwrt.org/t/rtl8812au-and-or-rtl8814au-drivers/67/193

Thus, I have created a repo for diy-part2.sh https://github.com/odinotisan/rtl8812au-ac Which is a patch for kmod-rtl8812au-ct, if you look into the package of kmod-rtl8812au-ct it points to aircrack-ng github repo of branch v5.6.4.2

But it's always not included in the build. Please help.

Does the lede make commqnd only allows 1core(I read it's recommended to use 1core when multiple are allowed)? It tooks to long me to try things out, that's also the reason I move from github actions to local compilation.

Any help is appreciated, thank you.

ophub commented 3 years ago

So you need to compile a kernel that contains the driver you want, and then package it into openwrt. E.g:

https://github.com/ophub/amlogic-s9xxx-openwrt/tree/main/amlogic-s9xxx/amlogic-kernel/5.4.132

odinotisan commented 3 years ago
* The driver is located in the `/lib/modules/*/kernel` directory

* When packaging openwrt, it has been replaced by `modules-*.tar.gz` in the kernel package:
  https://github.com/ophub/amlogic-s9xxx-openwrt/blob/5786d6f532f6ff1fe416bfeab000dc51732d08bb/make#L135

So you need to compile a kernel that contains the driver you want, and then package it into openwrt. E.g:

https://github.com/ophub/amlogic-s9xxx-openwrt/tree/main/amlogic-s9xxx/amlogic-kernel/5.4.132

* Download from the official website of the kernel and compile a kernel package that can be used by `amlogic arm64`. https://www.kernel.org/

* It is recommended that you start the `armbian` system on the current device for packaging. Or cross-compile on x86_64 devices. Can you compile the kernel?

I was about to tell you that x96 mini does not work with 5.12 or 5.13. I tried all the kernel provided through this repo. About to give up. It only works with 5.4.xx

ophub commented 3 years ago

Kernels 5.10 and above need the corresponding mainline u-boot support. There is no s905w at present, wait for flippy to provide it

ophub commented 3 years ago

I saw in the armbian community that balbes150 installed the armbian system in the TX3 of s905w, I copied the u-boot file from this system, you try this, it is the same as x96-mini:

https://github.com/ophub/amlogic-s9xxx-openwrt/commit/203e62983c275284afcd0f95660cff1432daaf8f

Installing Armbian on Amlogic S905w (Tanix TX3 Mini):

https://i12bretro.github.io/tutorials/0316.html

https://www.youtube.com/watch?v=n54aEMdXj7I

https://forum.armbian.com/topic/17106-installation-instructions-for-tv-boxes-with-amlogic-cpus

Since I don’t have s905w equipment, I can’t test it. Please feedback the result after testing. If this is not possible, I will look for it again. If you find a u-boot file of s905w that can be supported, please share it, thank you:

https://github.com/ophub/amlogic-s9xxx-openwrt/releases/tag/openwrt_s9xxx_lede_2021.08.24.1008

odinotisan commented 3 years ago

Thank you! I will give it a spin and update you! Thanks your hardwork!