ophub / amlogic-s9xxx-armbian

Support for Armbian 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
5.8k stars 1.86k forks source link

Could you suggest the way to build armbian for Rockchip 3318/3328? #242

Closed dinhchinh82 closed 2 years ago

dinhchinh82 commented 2 years ago

@ophub I can see there are kernel/u-boot for RK3328 from https://github.com/unifreq/openwrt_packit/tree/master/files/rk3328.

So is it able to build Armbian firmware for RK3318/3328 which uses the latest kernel from unifreq like you made for S9xxx? Thank you.

ophub commented 2 years ago

rk3328 does not need u-boot, they use the mainline kernel, which is easier and easier to use than amlogic, you can refer to the practice of OpenWrt.

dinhchinh82 commented 2 years ago

rk3328 does not need u-boot, they use the mainline kernel, which is easier and easier to use than amlogic, you can refer to the practice of OpenWrt.

Should I download the kernel & uboot file from Flippy then replace the files in your Amlogic build?

ophub commented 2 years ago

No, delete u-boot and bootloader related code, ignore this

ophub commented 2 years ago

Kernel difference, uEnv.txt change to armbianEnv.txt

for btrfs:

cat > armbianEnv.txt <<EOF
verbosity=7
overlay_prefix=rockchip
rootdev=UUID=${ROOTFS_UUID}
rootfstype=btrfs
rootflags=compress=zstd:6
extraargs=usbcore.autosuspend=-1
extraboardargs=
fdtfile=/dtb/rockchip/${FDTFILE}
EOF

https://github.com/ophub/luci-app-amlogic/blob/daef961acf0085c2e732c199d554494ea754341a/luci-app-amlogic/root/usr/sbin/openwrt-kernel#L36

Remove codes:

https://github.com/ophub/amlogic-s9xxx-armbian/blob/154e13388a7d58fb283471653131bcd47e02d436/rebuild#L479-L485

https://github.com/ophub/amlogic-s9xxx-armbian/blob/154e13388a7d58fb283471653131bcd47e02d436/rebuild#L623-L632

dinhchinh82 commented 2 years ago

@ophub great. I will remove the code from amlogic-s9xxx-armbian/rebuild file according to your guide and try to build again.

dinhchinh82 commented 2 years ago

@ophub I've removed 2 parts of code from rebuild script according to your guide. https://github.com/dinhchinh82/amlogic-s9xxx-armbian/blob/3328/rebuild

By the way, I don't understand what I should do with this one: https://github.com/ophub/luci-app-amlogic/blob/daef961acf0085c2e732c199d554494ea754341a/luci-app-amlogic/root/usr/sbin/openwrt-kernel#L36

dinhchinh82 commented 2 years ago

I'm trying to build as setting below:

image
ophub commented 2 years ago

https://github.com/unifreq/openwrt_packit/blob/master/mk_rk3328_beikeyun.sh

You can learn his packaging script

dinhchinh82 commented 2 years ago

https://github.com/unifreq/openwrt_packit/blob/master/mk_rk3328_beikeyun.sh

You can learn his packaging script

I already read Flippy script but I don't understand how to run that script on Github action.

So I'm thinking that it's better to reuse your script to make it work via Github action. That's reason I make this issue.

dinhchinh82 commented 2 years ago

I just got failed on Github action why trying to rebuild armbian:

image
dinhchinh82 commented 2 years ago

@ophub could you help me to check the rebuild script that I updated according to your one:

https://github.com/dinhchinh82/amlogic-s9xxx-armbian/blob/3328/rebuild

ophub commented 2 years ago

https://github.com/ophub/amlogic-s9xxx-armbian/blob/a38714c3c62a0ab3fe1da036100274df6e285009/rebuild#L73

https://github.com/ophub/amlogic-s9xxx-armbian/blob/a38714c3c62a0ab3fe1da036100274df6e285009/rebuild#L359-L364

dinhchinh82 commented 2 years ago

I already added according to your base:

https://github.com/dinhchinh82/amlogic-s9xxx-armbian/blob/3691188209a7ca49279640e23ab91e666a8655e5/rebuild#L71

https://github.com/dinhchinh82/amlogic-s9xxx-armbian/blob/3691188209a7ca49279640e23ab91e666a8655e5/rebuild#L370

https://github.com/dinhchinh82/amlogic-s9xxx-armbian/blob/3691188209a7ca49279640e23ab91e666a8655e5/rebuild#L451

ophub commented 2 years ago

https://github.com/dinhchinh82/amlogic-s9xxx-armbian/blob/131cf8dc7972b111241cfb5c3e65fa4d3d85da4f/.github/workflows/rebuild-armbian.yml#L88

dinhchinh82/amlogic-s9xxx-armbian@main

ophub commented 2 years ago

https://github.com/unifreq/openwrt_packit/blob/4e247ba8aeb508f7fc54eec328502eaf5d26caed/public_funcs#L670

https://github.com/unifreq/openwrt_packit/blob/4e247ba8aeb508f7fc54eec328502eaf5d26caed/public_funcs#L1499

https://github.com/unifreq/openwrt_packit/blob/4e247ba8aeb508f7fc54eec328502eaf5d26caed/public_funcs#L1539

https://github.com/unifreq/openwrt_packit/blob/4e247ba8aeb508f7fc54eec328502eaf5d26caed/mk_rk3328_beikeyun.sh#L132

dinhchinh82 commented 2 years ago

https://github.com/unifreq/openwrt_packit/blob/4e247ba8aeb508f7fc54eec328502eaf5d26caed/public_funcs#L670

https://github.com/unifreq/openwrt_packit/blob/4e247ba8aeb508f7fc54eec328502eaf5d26caed/public_funcs#L1499

https://github.com/unifreq/openwrt_packit/blob/4e247ba8aeb508f7fc54eec328502eaf5d26caed/public_funcs#L1539

https://github.com/unifreq/openwrt_packit/blob/4e247ba8aeb508f7fc54eec328502eaf5d26caed/mk_rk3328_beikeyun.sh#L132

@ophub what should I do with the files above? Should I fork unifreq/openwrt_packit/ and build again from my repo?

Or should I copy the snippet code above to put into the rebuild file as below? https://github.com/dinhchinh82/amlogic-s9xxx-armbian/blob/131cf8dc7972b111241cfb5c3e65fa4d3d85da4f/rebuild#L489

ophub commented 2 years ago

This has the corresponding code in amlogic. You add judgment in the relevant part, refer to his judgment

if [ "${soc}" == "rk3328" ]; then
……
else
……
fi
dinhchinh82 commented 2 years ago

This has the corresponding code in amlogic. You add judgment in the relevant part, refer to his judgment

I just confused which source code file should I modify from your base source code to add the snippet code you mentioned above?

What I expect to do is building Armbian for RK3328 on Github action like you did with Almogic.

image
ophub commented 2 years ago

My script to compile firmware has only one file: rebuild

ophub commented 2 years ago

add: dtb-rockchip-xxx.tar.gz

dinhchinh82 commented 2 years ago

My script to compile firmware has only one file: rebuild

So all the snippet code you mentioned about should be updated to your rebuild script, right?

ophub commented 2 years ago

Yes, add judgment in the corresponding place to deal with this special SOC: rk3328

dinhchinh82 commented 2 years ago

Yes, add judgment in the corresponding place to deal with this special SOC: rk3328

I will try to judge the difference then report you the result. Hope you will support to build it successfully.

dinhchinh82 commented 2 years ago

@ophub I tried to build Rk3328 again yesterday and got success overall but some detail error. Can you help me to check how to fix the detail error?

(1.1) Start building Armbian [ rk3328 - 5.15.34 ]. Remaining space is 29G. [ rk3328 - 5.15.34 ] (1/6) Confirm version type. [ rk3328 - 5.15.34 ] (2/6) Extract old armbian files. [ rk3328 - 5.15.34 ] (3/6) Refactor related files. tar: /home/runner/work/amlogic-s9xxx-armbian/amlogic-s9xxx-armbian/tmp_dir/tmp_build/bootfs/dtb/rockchip: Cannot open: No such file or directory

image

Detail log build: https://github.com/dinhchinh82/amlogic-s9xxx-armbian/runs/6078974259?check_suite_focus=true

Detail rebuild script: https://github.com/dinhchinh82/amlogic-s9xxx-armbian/blob/3328/rebuild

Thank you.

ophub commented 2 years ago

https://github.com/unifreq/openwrt_packit/blob/4e247ba8aeb508f7fc54eec328502eaf5d26caed/public_funcs#L670

create without directory: mkdir -p dtb/rockchip

I see you copy his code directly, the parameter variables are not modified, this is unusable, you need to modify it according to the situation

Snip20220420_3

https://github.com/dinhchinh82/amlogic-s9xxx-armbian/blob/b50bf67d745e14a877f5cc43ffd108865fd57c6d/rebuild#L413

dinhchinh82 commented 2 years ago

@ophub As I think most of your script are enough to build Armbian Rk3328 with some modification any may not need any script from Flippy.

image

As this photo, there is a command to create the rockchip dtb folder

build_dtb=$(ls ${kernel_path}/${kernel}/dtb-rockchip-${kernel}-*.tar.gz 2>/dev/null | head -n 1)

tar -xzf ${build_dtb} -C ${tag_bootfs}/dtb/rockchip && sync

dinhchinh82 commented 2 years ago

@ophub I have another idea to make the RK3328 image manually first as below:

Step 1: build Armbian for S905X3 as usual

Step 2: plug TF card to the computer, create armbianEnv.txt file as you mentioned in the /boot partition.

Step 3: extract the rockchip dtb from dtb-rockchip-5.4.188-flippy-71+o.tar.gz the copy to /dtb/rockchip folder and update armbianEnv.txt file.

how do you think about this solution?

Beside the armbianEnv.txt and dtb file, is there any other difference between S905x and RK3328 armbian?

thank you.

dinhchinh82 commented 2 years ago

@ophub I can build RK3328 successfully as below then flash to the USB/TF but unable to boot the Armbian.

image

Build log: https://github.com/dinhchinh82/amlogic-s9xxx-armbian/runs/6091215912?check_suite_focus=true

Updated rebuild script: https://github.com/dinhchinh82/amlogic-s9xxx-armbian/blob/3328/rebuild

ophub commented 2 years ago

I read flippy's script, and I probably found the 4 differences that you posted above. You can look for others. Do you have this kind of equipment?

dinhchinh82 commented 2 years ago

I read flippy's script, and I probably found the 4 differences that you posted above. You can look for others. Do you have this kind of equipment?

I have T9 (RK3318 4+32G) https://www.youtube.com/watch?v=9OXfDRxIbvQ

I've ever tried the RK3318/Rk3328 firmware from jock and it boot successfully. https://forum.armbian.com/topic/17597-csc-armbian-for-rk3318rk3328-tv-box-boards/

by the way, the firmware from Jock is not stable, some time the box shutdown suddenly without any reason. That's reason I want to try Flippy firmware on this box.

dinhchinh82 commented 2 years ago

I read flippy's script, and I probably found the 4 differences that you posted above. You can look for others. Do you have this kind of equipment?

I don't use the flippy's script, only change some parts of your script related to dtb file, armbianEnv.txt file.

image

I don't know whether other generated firmware files are different between RK3328 & S905x or not?

image image image
ophub commented 2 years ago

Remove uEnv.ext when using armbianEnv.txt Delete amlogic when using rockchip under /boot/dtb Add soc judgment

If you have a device to test, first manually modify the local file, the test can be used, and then modify the compilation script to achieve the same purpose as manual modification.

dinhchinh82 commented 2 years ago

Remove uEnv.ext when using armbianEnv.txt Delete amlogic when using rockchip under /boot/dtb Add soc judgment

@ophub I already deleted these files but still unable to boot. Still going to Android UI.

If you have a device to test, first manually modify the local file, the test can be used, and then modify the compilation script to achieve the same purpose as manual modification

That's what I want to do first. I want to judge the local file manually to make sure it works before update the compilation script.

Here are steps I update the local files manually for RK3328:

Step 1: Burn the [Armbian_22.05.0_Aml_s905x3_bullseye_5.4.188_2022.04.17.0035.img.gz] to TF card

Step 2: Plug the TF card to computer.

Step 3: Create armbianEnv.txt file under the Boot partition as the content below (I use ext4):

verbosity=7 overlay_prefix=rockchip rootdev=UUID=0a6174af-7ccd-41b9-a6f5-0ee1e9e4ee70 rootfstype=ext4 rootflags=compress=zstd:6 extraargs=usbcore.autosuspend=-1 extraboardargs= fdtfile=/dtb/rockchip/rk3328-box.dtb

Step 4: Delete /dtb/amlogic folder

Step 5: Delete uEnv.txt file

Step 6: Boot the T9 box (RK3318 4+32G) from TF card but unable to boot to Armbian. I also tried both reset method using pushing AV port and adb shell remote update.

ophub commented 2 years ago

3328 and 3318 are used the same? Here is the OpenWrt file of 3328. You can try to change the dtb of armbianEnv.txt and see if it can be started. If OpenWrt can be started, and then debug armbian, they are basically the same.

https://github.com/ophub/flippy-openwrt-actions/releases/tag/openwrt_s9xxx_2022.04.21.0913

dinhchinh82 commented 2 years ago

3328 and 3318 are used the same?

As I know 3318 is similar to 3328 but cheaper. I've ever flashed RK3318 CSC firmware from Jock to both RK3328 and RK3318 box and they work.

Here is the OpenWrt file of 3328. You can try to change the dtb of armbianEnv.txt and see if it can be started.

I tried to flash your OpenWrt to TF card but later on, there is no way to edit dtb because there is no Boot partition to open like S905x armbian.

I plug the TF card with your OpenWrt to the T9 3318 box but got the error while booting as below: IMG_6221 IMG_6224

As the guide from Jock, the dtb for 3328/3318 box is rk3328-box.dtb.

https://forum.armbian.com/topic/17597-csc-armbian-for-rk3318rk3328-tv-box-boards/

ophub commented 2 years ago

This OpenWrt is packaged using flippy's script. If it can't be started, it's not easy to test armbian. I don't have such a device, so I can only see the difference from his script.

ophub commented 2 years ago

链接:https://pan.baidu.com/s/1kbvtyxpcmniLKN_ziH-kqQ 提取码:jla9 try his armbian

Snip20220421_1

dinhchinh82 commented 2 years ago

@ophub can you check the manual step to make Armbian for 3318 as this linke? https://github.com/ophub/amlogic-s9xxx-armbian/issues/242#issuecomment-1104644994

ophub commented 2 years ago

I don't have the equipment, I don't know

dinhchinh82 commented 2 years ago

I don't have the equipment, I don't know

Okay, I will try by myself to test if it work.

链接:https://pan.baidu.com/s/1kbvtyxpcmniLKN_ziH-kqQ 提取码:jla9 I don't have baidu account so there is no way to download.

Thank you very much for your support.

ophub commented 2 years ago

OpenWrt is completely packaged with his script, you can't start it after testing. If his rk3381's armbian can't start, just give up. There is no correct reference script, I don't know how to set it up. If his system can be activated, he can do so.

ophub commented 2 years ago

I don't have the equipment, I don't know

Okay, I will try by myself to test if it work.

链接:https://pan.baidu.com/s/1kbvtyxpcmniLKN_ziH-kqQ 提取码:jla9 I don't have baidu account so there is no way to download.

Thank you very much for your support.

Register for a free account and download

ophub commented 2 years ago

https://github.com/ophub/kernel/releases/tag/tools

Armbian_20.10_Beikeyun_buster_5.4.108-flippy-56+o.img.xz

dinhchinh82 commented 2 years ago

https://github.com/ophub/kernel/releases/tag/tools

Armbian_20.10_Beikeyun_buster_5.4.108-flippy-56+o.img.xz

I don' see any images from the link above.

Register for a free account and download

I tried to register an account but quite difficult. Registered successfully but unable to login to download for users outside China.

ophub commented 2 years ago

I uploaded it last night, I thought you had already downloaded it, I deleted it this morning and uploaded it for you just now

dinhchinh82 commented 2 years ago

I uploaded it last night, I thought you had already downloaded it, I deleted it this morning and uploaded it for you just now

@ophub Sorry I was busy today so I have not checked your reply.

Could you upload again by tomorrow (Saturday) and keep it about 2 hours from 9AM~11AM (Shanghai time, GMT+8)?

Thank you.

ophub commented 2 years ago

uploaded https://github.com/ophub/kernel/releases/tag/tools

dinhchinh82 commented 2 years ago

@ophub I can download file Armbian_20.10_Beikeyun_buster_5.4.108-flippy-56+o.img.xz from your link. It's fine to delete it to save your space now. Thank you.

dinhchinh82 commented 2 years ago

@ophub I've tested the Armbian_20.10_Beikeyun_buster_5.4.108-flippy-56+o.img.xz file but it got same error white booting as the previous build you send some days before:

https://user-images.githubusercontent.com/22479095/164474077-07f95728-556b-4023-8c6d-eae11d8f0701.JPG

Please note that after flashing to the TF card, there is unable to open the /boot partition to change the configuration on armbianEnv.txt as you mentioned before.

ophub commented 2 years ago

I don't have such equipment and am not familiar with how they should be set up. Search for relevant tutorials and test yourself.