Heyo,
I was trying to compile a VCOM Driver (https://aur.archlinux.org/packages/advantech-vcom) for unbricking a MediaTek phone, but unfortunetly it crashed. I was using yay to build the package and that's the log:
:: Checking for conflicts...
:: Checking for inner conflicts...
[Aur:1] advantech-vcom-2.2.1-4
1 advantech-vcom (Build Files Exist)
==> Packages to cleanBuild?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==>
:: PKGBUILD up to date, Skipping (1/0): advantech-vcom
1 advantech-vcom (Build Files Exist)
==> Diffs to show?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==>
:: (1/1) Parsing SRCINFO: advantech-vcom
==> Making package: advantech-vcom 2.2.1-4 (czw, 1 gru 2022, 12:18:43)
==> Retrieving sources...
-> Found vcom_linux_2.2.1.rar
-> Found 0000-advman.systemd.patch
-> Found 0001-adv_main-access_ok_kernel-5-0.patch
-> Found 0002-adv_mmap-vm_fault_t-5-1.patch
-> Found 0003-gcc-10-duplicate-variables-vc_mon-stk_mon.patch
-> Found 0004-adv_main-proc_create_data-kernel-5.6.patch
==> Validating source files with md5sums...
vcom_linux_2.2.1.rar ... Passed
0000-advman.systemd.patch ... Passed
0001-adv_main-access_ok_kernel-5-0.patch ... Passed
0002-adv_mmap-vm_fault_t-5-1.patch ... Passed
0003-gcc-10-duplicate-variables-vc_mon-stk_mon.patch ... Passed
0004-adv_main-proc_create_data-kernel-5.6.patch ... Passed
==> Validating source files with sha256sums...
vcom_linux_2.2.1.rar ... Passed
0000-advman.systemd.patch ... Passed
0001-adv_main-access_ok_kernel-5-0.patch ... Passed
0002-adv_mmap-vm_fault_t-5-1.patch ... Passed
0003-gcc-10-duplicate-variables-vc_mon-stk_mon.patch ... Passed
0004-adv_main-proc_create_data-kernel-5.6.patch ... Passed
==> Making package: advantech-vcom 2.2.1-4 (czw, 1 gru 2022, 12:18:48)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Found vcom_linux_2.2.1.rar
-> Found 0000-advman.systemd.patch
-> Found 0001-adv_main-access_ok_kernel-5-0.patch
-> Found 0002-adv_mmap-vm_fault_t-5-1.patch
-> Found 0003-gcc-10-duplicate-variables-vc_mon-stk_mon.patch
-> Found 0004-adv_main-proc_create_data-kernel-5.6.patch
==> Validating source files with md5sums...
vcom_linux_2.2.1.rar ... Passed
0000-advman.systemd.patch ... Passed
0001-adv_main-access_ok_kernel-5-0.patch ... Passed
0002-adv_mmap-vm_fault_t-5-1.patch ... Passed
0003-gcc-10-duplicate-variables-vc_mon-stk_mon.patch ... Passed
0004-adv_main-proc_create_data-kernel-5.6.patch ... Passed
==> Validating source files with sha256sums...
vcom_linux_2.2.1.rar ... Passed
0000-advman.systemd.patch ... Passed
0001-adv_main-access_ok_kernel-5-0.patch ... Passed
0002-adv_mmap-vm_fault_t-5-1.patch ... Passed
0003-gcc-10-duplicate-variables-vc_mon-stk_mon.patch ... Passed
0004-adv_main-proc_create_data-kernel-5.6.patch ... Passed
==> Removing existing $srcdir/ directory...
==> Extracting sources...
==> Starting prepare()...
UNRAR 6.20 beta 2 freeware Copyright (c) 1993-2022 Alexander Roshal
Extracting from vcom_linux_2.2.1.rar
Creating vcom_linux_2.2.1 OK
Creating vcom_linux_2.2.1/advps OK
Extracting vcom_linux_2.2.1/advps/advps.c OK
Extracting vcom_linux_2.2.1/advps/Makefile OK
Creating vcom_linux_2.2.1/config OK
Extracting vcom_linux_2.2.1/config/advttyd.conf OK
Extracting vcom_linux_2.2.1/COPYING OK
Creating vcom_linux_2.2.1/daemon OK
Extracting vcom_linux_2.2.1/daemon/Makefile OK
Extracting vcom_linux_2.2.1/daemon/vcom.h OK
Extracting vcom_linux_2.2.1/daemon/vcom_client.c OK
Extracting vcom_linux_2.2.1/daemon/vcom_debug.h OK
Extracting vcom_linux_2.2.1/daemon/vcom_monitor.h OK
Extracting vcom_linux_2.2.1/daemon/vcom_monitor_dbg.h OK
Extracting vcom_linux_2.2.1/daemon/vcom_monitor_pre_stat.h OK
Extracting vcom_linux_2.2.1/daemon/vcom_proto.h OK
Extracting vcom_linux_2.2.1/daemon/vcom_proto_cmd.h OK
Extracting vcom_linux_2.2.1/daemon/vcom_proto_ioctl.h OK
Extracting vcom_linux_2.2.1/daemon/vc_client_common.c OK
Extracting vcom_linux_2.2.1/daemon/vc_client_common.h OK
Extracting vcom_linux_2.2.1/daemon/vc_client_idle.c OK
Extracting vcom_linux_2.2.1/daemon/vc_client_idle.h OK
Extracting vcom_linux_2.2.1/daemon/vc_client_netdown.c OK
Extracting vcom_linux_2.2.1/daemon/vc_client_netdown.h OK
Extracting vcom_linux_2.2.1/daemon/vc_client_netup.c OK
Extracting vcom_linux_2.2.1/daemon/vc_client_netup.h OK
Extracting vcom_linux_2.2.1/daemon/vc_client_pause.c OK
Extracting vcom_linux_2.2.1/daemon/vc_client_pause.h OK
Extracting vcom_linux_2.2.1/daemon/vc_client_sync.c OK
Extracting vcom_linux_2.2.1/daemon/vc_client_sync.h OK
Creating vcom_linux_2.2.1/driver OK
Extracting vcom_linux_2.2.1/driver/advconf.h OK
Extracting vcom_linux_2.2.1/driver/advioctl.h OK
Extracting vcom_linux_2.2.1/driver/advtype.h OK
Extracting vcom_linux_2.2.1/driver/advvcom.h OK
Extracting vcom_linux_2.2.1/driver/adv_main.c OK
Extracting vcom_linux_2.2.1/driver/adv_mmap.c OK
Extracting vcom_linux_2.2.1/driver/adv_uart.c OK
Extracting vcom_linux_2.2.1/driver/dkms.conf OK
Extracting vcom_linux_2.2.1/driver/Makefile OK
Creating vcom_linux_2.2.1/initd OK
Extracting vcom_linux_2.2.1/initd/advttyd.c OK
Extracting vcom_linux_2.2.1/initd/advttyd.h OK
Extracting vcom_linux_2.2.1/initd/Makefile OK
Creating vcom_linux_2.2.1/inotify OK
Extracting vcom_linux_2.2.1/inotify/Makefile OK
Extracting vcom_linux_2.2.1/inotify/vcom_inotf.c OK
Extracting vcom_linux_2.2.1/Makefile OK
Extracting vcom_linux_2.2.1/readme.txt OK
Creating vcom_linux_2.2.1/script OK
Extracting vcom_linux_2.2.1/script/advadd OK
Extracting vcom_linux_2.2.1/script/advls OK
Extracting vcom_linux_2.2.1/script/advman OK
Extracting vcom_linux_2.2.1/script/advrm OK
Extracting SOP_EKI-1500 series_LinuxVCOMDriver_LoopbackTestingGuide.pdf OK
Extracting VCOM 2 0 Driver for Linux Installation Guide.pdf OK
All OK
patching file driver/adv_main.c
patching file driver/adv_mmap.c
patching file daemon/vcom_client.c
patching file daemon/vcom.h
patching file daemon/vcom_monitor_dbg.h
patching file daemon/vcom_monitor.h
patching file daemon/vcom_monitor_pre_stat.h
patching file driver/adv_main.c
patching file script/advman
==> Sources are ready.
==> Making package: advantech-vcom 2.2.1-4 (czw, 1 gru 2022, 12:18:57)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> WARNING: Using existing $srcdir/ tree
==> Removing existing $pkgdir/ directory...
==> Starting build()...
make -C ./daemon
make[1]: Entering directory '/home/gameplayer/.cache/yay/advantech-vcom/src/vcom_linux_2.2.1/daemon'
gcc -Wall -I /home/gameplayer/.cache/yay/advantech-vcom/src/vcom_linux_2.2.1/daemon/../driver -o vcomd /home/gameplayer/.cache/yay/advantech-vcom/src/vcom_linux_2.2.1/daemon/vcom_client.c /home/gameplayer/.cache/yay/advantech-vcom/src/vcom_linux_2.2.1/daemon/vc_client_pause.c /home/gameplayer/.cache/yay/advantech-vcom/src/vcom_linux_2.2.1/daemon/vc_client_netdown.c /home/gameplayer/.cache/yay/advantech-vcom/src/vcom_linux_2.2.1/daemon/vc_client_common.c /home/gameplayer/.cache/yay/advantech-vcom/src/vcom_linux_2.2.1/daemon/vc_client_sync.c /home/gameplayer/.cache/yay/advantech-vcom/src/vcom_linux_2.2.1/daemon/vc_client_idle.c /home/gameplayer/.cache/yay/advantech-vcom/src/vcom_linux_2.2.1/daemon/vc_client_netup.c
make[1]: Leaving directory '/home/gameplayer/.cache/yay/advantech-vcom/src/vcom_linux_2.2.1/daemon'
make -C ./driver
make[1]: Entering directory '/home/gameplayer/.cache/yay/advantech-vcom/src/vcom_linux_2.2.1/driver'
make -C /lib/modules/6.0.7-artix1-1/build M=/home/gameplayer/.cache/yay/advantech-vcom/src/vcom_linux_2.2.1/driver LDDINC=/home/gameplayer/.cache/yay/advantech-vcom/src/vcom_linux_2.2.1/driver modules
make[2]: Entering directory '/usr/lib/modules/6.0.7-artix1-1/build'
CC [M] /home/gameplayer/.cache/yay/advantech-vcom/src/vcom_linux_2.2.1/driver/adv_main.o
/home/gameplayer/.cache/yay/advantech-vcom/src/vcom_linux_2.2.1/driver/adv_main.c: In function ‘adv_proc_open’:
/home/gameplayer/.cache/yay/advantech-vcom/src/vcom_linux_2.2.1/driver/adv_main.c:198:16: error: implicit declaration of function ‘PDE_DATA’; did you mean ‘NODE_DATA’? [-Werror=implicit-function-declaration]
198 | data = PDE_DATA(inode);
| ^~~~~~~~
| NODE_DATA
/home/gameplayer/.cache/yay/advantech-vcom/src/vcom_linux_2.2.1/driver/adv_main.c:198:14: warning: assignment to ‘struct adv_vcom *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
198 | data = PDE_DATA(inode);
| ^
/home/gameplayer/.cache/yay/advantech-vcom/src/vcom_linux_2.2.1/driver/adv_main.c: In function ‘adv_proc_release’:
/home/gameplayer/.cache/yay/advantech-vcom/src/vcom_linux_2.2.1/driver/adv_main.c:208:14: warning: assignment to ‘struct adv_vcom *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
208 | data = PDE_DATA(inode);
| ^
cc1: some warnings being treated as errors
make[3]: *** [scripts/Makefile.build:249: /home/gameplayer/.cache/yay/advantech-vcom/src/vcom_linux_2.2.1/driver/adv_main.o] Error 1
make[2]: *** [Makefile:1852: /home/gameplayer/.cache/yay/advantech-vcom/src/vcom_linux_2.2.1/driver] Error 2
make[2]: Leaving directory '/usr/lib/modules/6.0.7-artix1-1/build'
make[1]: *** [Makefile:30: modules] Error 2
make[1]: Leaving directory '/home/gameplayer/.cache/yay/advantech-vcom/src/vcom_linux_2.2.1/driver'
make: *** [Makefile:7: all] Error 2
==> ERROR: A failure occurred in build().
/usr/share/makepkg/util/message.sh: line 57: QUIET: unbound variable
/usr/bin/makepkg: line 131: logpipe: unbound variable
-> error making: advantech-vcom
I was also trying to install it from Advantech page (https://www.advantech.com/en/support/details/driver?id=1-X81PLM), but that's how it ended up:
make -C ./daemon
make[1]: Entering directory '/home/gameplayer/Downloads/vcom_linux_2.3.0/daemon'
cc -Wall -Werror -I /home/gameplayer/Downloads/vcom_linux_2.3.0/daemon/../driver -I /home/gameplayer/Downloads/vcom_linux_2.3.0/daemon/../shared/container -I /home/gameplayer/Downloads/vcom_linux_2.3.0/daemon/../shared/json -I /home/gameplayer/Downloads/vcom_linux_2.3.0/daemon/../shared/ssl_select -o vcomd /home/gameplayer/Downloads/vcom_linux_2.3.0/daemon/vcom_client.c /home/gameplayer/Downloads/vcom_linux_2.3.0/daemon/vc_client_pause.c /home/gameplayer/Downloads/vcom_linux_2.3.0/daemon/vc_client_netdown.c /home/gameplayer/Downloads/vcom_linux_2.3.0/daemon/vc_client_common.c /home/gameplayer/Downloads/vcom_linux_2.3.0/daemon/vc_client_sync.c /home/gameplayer/Downloads/vcom_linux_2.3.0/daemon/vc_client_idle.c /home/gameplayer/Downloads/vcom_linux_2.3.0/daemon/vc_client_netup.c /home/gameplayer/Downloads/vcom_linux_2.3.0/daemon/../shared/ssl_select/ssl_select.c /home/gameplayer/Downloads/vcom_linux_2.3.0/daemon/../shared/json/jstree.c /home/gameplayer/Downloads/vcom_linux_2.3.0/daemon/../shared/json/jsmn.c -lssl -lcrypto -D_VCOM_SUPPORT_TLS
/usr/bin/ld: /tmp/ccT6orQd.o:(.bss+0x0): multiple definition of `vc_mon'; /tmp/ccZVhetq.o:(.bss+0x0): first defined here
/usr/bin/ld: /tmp/ccT6orQd.o:(.bss+0x118): multiple definition of `stk_mon'; /tmp/ccZVhetq.o:(.bss+0x118): first defined here
/usr/bin/ld: /tmp/ccYOSgZb.o:(.bss+0x0): multiple definition of `vc_mon'; /tmp/ccZVhetq.o:(.bss+0x0): first defined here
/usr/bin/ld: /tmp/ccYOSgZb.o:(.bss+0x118): multiple definition of `stk_mon'; /tmp/ccZVhetq.o:(.bss+0x118): first defined here
/usr/bin/ld: /tmp/cccn0U4Y.o:(.bss+0x0): multiple definition of `vc_mon'; /tmp/ccZVhetq.o:(.bss+0x0): first defined here
/usr/bin/ld: /tmp/cccn0U4Y.o:(.bss+0x118): multiple definition of `stk_mon'; /tmp/ccZVhetq.o:(.bss+0x118): first defined here
/usr/bin/ld: /tmp/ccMt4AR9.o:(.bss+0x0): multiple definition of `vc_mon'; /tmp/ccZVhetq.o:(.bss+0x0): first defined here
/usr/bin/ld: /tmp/ccMt4AR9.o:(.bss+0x118): multiple definition of `stk_mon'; /tmp/ccZVhetq.o:(.bss+0x118): first defined here
/usr/bin/ld: /tmp/ccfgNUzG.o:(.bss+0x0): multiple definition of `vc_mon'; /tmp/ccZVhetq.o:(.bss+0x0): first defined here
/usr/bin/ld: /tmp/ccfgNUzG.o:(.bss+0x118): multiple definition of `stk_mon'; /tmp/ccZVhetq.o:(.bss+0x118): first defined here
/usr/bin/ld: /tmp/cc2Q6xJd.o:(.bss+0x0): multiple definition of `vc_mon'; /tmp/ccZVhetq.o:(.bss+0x0): first defined here
/usr/bin/ld: /tmp/cc2Q6xJd.o:(.bss+0x118): multiple definition of `stk_mon'; /tmp/ccZVhetq.o:(.bss+0x118): first defined here
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:55: vcomd] Error 1
make[1]: Leaving directory '/home/gameplayer/Downloads/vcom_linux_2.3.0/daemon'
make: *** [Makefile:29: build_basic] Error 2
Is there some way to install that driver on Artix with OpenRC init system & kernel 6.0+?
Somewhere (PKGBUILD or Makefile) there's this compiler directive: "-Werror=implicit-function-declaration" (treat warnings as errors and abort). Perhaps there's a broader "-Werror" too. Disable and retry.
I looked for that through `grep`, but finds nothing.
grep -r Werror *
I also tried adding `-Wno-error`, but didn't worked. Error is still the same.
That's a very complicated PKGBUILD.
I think the driver's quite tied to kernel versions. There is a more recent version of the driver which you tried to compile manually but at a guess the existent PKGBUILD would need a major rewrite to build to the 2.3.0 version.
If it was me trying to resurrect dead hardware I'd by tempted to try the following:
Email the maintainer (obfuscated address in the PKGBUILD) and politely ask if they could update to 2.3.0
Leave a similar message on the AUR page.
Bear in mind that systemd is mentioned repeatedly in the PKGBUILD, more than just a service file, so even if it builds it may still not work.
The instructions
https://advdownload.advantech.com/productfile/Downloadfile1/1-26F2D41/VCOM2.0%20Driver%20for%20Linux%20Installation%20Guide_v1.4.pdf
seem outdated, 2.2.1, but list compatible distros with that version.
I'd be tempted to install the most recent one listed you have experience with (eg Ubuntu 18) in a VM (Or maybe better a spare partition, unless you have bleeding edge hardware it should still work)
Then follow the instructions to compile and (if using the VM) connect the phone with USB passthrough to the VM.
I think the 2.3.0 version is failing to compile due to multiple definitions of the same variable. Older versions of gcc apparently tolerated this but newer versions do not. It maybe fixable with flags but I'm not sure?
Even after looking at the instructions I'm not sure what this does ? So take any of my advice with a pinch of salt.
It's just food for thought.
I tried to contact the maintainer of the AUR months ago, but no response.
There are some options to emulate systemd on OpenRC, but the driver fails at the beginning.
I'll try to run a VM, but the goal is to install the driver on the real machine.
I tried using some flags, but still fails to build.
What that does is basically modyfing detection of the MediaTek device after entering the state before bootloader. It's using USB controller and without it the MediaTek device is appering on 1 sec, later on dissapearing for a while and then again appearing.
I thought the goal was just to unbrick a phone?
But regardless if you have a spare partition, or even a reasonably sized USB3 key, it may well be possible to dual boot it on bare metal.
What I didn't consider before is availability of repo's. But it seems Ubuntu18.04 is a LTS release so the repo's should still be up I think?
I imagine to get it going on Artix an older kernel + headers, from the relevant era, and also gcc from that era might help.
Even just a slightly older gcc might help with the 2.3.0 version ? But Id sooner not try those downgrades on my daily driver.
Personally I'd try the VM.
The goal of the topic is to compile & install the driver.
Later on I'll unbrick phone with Stock ROM. ツ
Fair enough but I still suspect that you either need kernel headers + gcc from around the time the drivers were published or the ability to fix the problems in the code. I don't have the latter. It may, and hopefully will, be trivial.
One other possibility if you want to keep it within Artix is do it in a chroot.
I wish you luck.
Actually I totally lost a bricked device after reading that when it's hard bricked, it requires special device to recover + resoldering data chip.
So I can't do any tests with VCOM / SP Flash Tool. Guess, I'll close the topic..
Also VCOM Driver seems to don't have any support from the Advantech.