[HTC U11  ROMs, Kernels, Recoveries, & Other Develo] nkk71:
[MENTION=4905624]j to the 4n[/MENTION] [MENTION=1792279]ivicask[/MENTION]

Hey guys, dozed off before I could post this yesterday, but here goes:

How to use a 2.xx.xxx.x radio needed by Oreo ROM while still on 1.xx.xxx.x firmware

First off let me just say, this is

not

the ideal method, it was simply a test to confirm whether or not I could get WiFi working without having to flash anything.

So what I did:

First:

Flash ViperU 2.0.0 beta, boot it up, to make sure it works.

Back to TWRP and took a backup of boot.img

-> Yes after flashing and booting the ROM, not the original boot.img, because I already wanted any ramdisk modifications to already be in place

Second:

Got the OCNDUGL_2.31.400.6_FullStock.zip (this is close enough for my Dual-SIM EMEA variant)

and extracted the radio.img

Pushed it to /tmp in TWRP, and mounted it

mkdir /tmp/RADIO
mount -t vfat -o ro /tmp/radio.img /tmp/RADIO

Since I know /system is already custom, and verity is disabled, I mounted /system and copied the radio files to "/system/RADIO"

Changed owner/group to system:system and perms to 440

Third:

Unpack the boot.img backup using [MENTION=4544860]osm0sis[/MENTION] AIK (this has to be [currently] done in linux, if you do it in windows it will not work / boot). The unpack as well as the below changes have to be done in "sudo" mode.

Edit the fstab.qcom file in the ramdisk and comment out

[B][COLOR="blue"]#[/COLOR][/B]/dev/block/bootdevice/by-name/radio /firmware/image vfat ro,uid=1000,gid=1000,dmask=227,fmask=337 wait

Edit init.rc (at line 46) to symlink /firmware/image just after the vendor symlink which looked like a good place to put it:

# Link /vendor to /system/vendor for devices without a vendor partition.
symlink /system/vendor /vendor

[B][COLOR="Blue"] # Link /firmware/image to /system/RADIO which has the OCNDUGL_2.31.400.6
# radio.img files.
symlink /system/RADIO /firmware/image
[/COLOR][/B]

Delete the "image" directory in the the /firmware dir, otherwise the above symlink wont work (you need a dir if you want to mount something, but if you're symlinking you don't want that dir, otherwise the symlink will be created below it)

Repack the boot.img, and use it (I initially tested using fastboot boot instead of flashing it to make sure).

Sidenote: I took the easiest possible approach, I can think of a dozen different and probably better ways to do this, and I'm certain someone else will come up with even more ideas, but some thoughts:

Using [MENTION=4544860]osm0sis[/MENTION] AK2 to make a flashable zip, or even add it to your installer

Using a different path, obviously using the system partition would never work for a verity enforced ROM, in the case of your full-ROM, this wasn't an issue for me

Instead of symlinking, loop or bind mounting the radio.img directly (though the initial trial of that failed for me, but I did not bother trying to fix it)

Personally, I would actually use a shell script (in a service entry or exec) to accomplish this, it allows much more flexibility, including mounting/symlinking/error checking/loops/etc.

Possibly use a real block partition for the needed radio.img (appreload comes to mind, dunno if that's being used) <- though not entirely sure about this one.

I'm not familiar enough with Magisk's ability to loop/bind mount the radio partition, but it might be worth checking out.

And so many other possibilities ;)

But I'll leave it to you guys or anyone who wants to play around with this idea/method of using a different radio to come up with some zip or whatever to make things easy.

For me this was just a simple test to see whether it would work or not.

Hope it helps. Enjoy :)

EDIT: and here's a shell output to confirm the above changes:

htc_ocnwhl:/ # ls -l /firmware/image
lrwxrwxrwx 1 root root 13 1970-06-13 04:35 /firmware/image -> /system/RADIO
htc_ocnwhl:/ # ls -l /firmware/image/*
-r--r----- 1 system system 230056 2017-12-02 16:27 /firmware/image/mba.mbn
-r--r----- 1 system system 1012 2017-12-02 16:27 /firmware/image/modem.b00
-r--r----- 1 system system 7400 2017-12-02 16:27 /firmware/image/modem.b01
-r--r----- 1 system system 8488 2017-12-02 16:27 /firmware/image/modem.b02
-r--r----- 1 system system 8728 2017-12-02 16:27 /firmware/image/modem.b03
-r--r----- 1 system system 219040 2017-12-02 16:27 /firmware/image/modem.b04
-r--r----- 1 system system 308779 2017-12-02 16:27 /firmware/image/modem.b05
-r--r----- 1 system system 50232 2017-12-02 16:27 /firmware/image/modem.b06
-r--r----- 1 system system 132268 2017-12-02 16:27 /firmware/image/modem.b07
-r--r----- 1 system system 352340 2017-12-02 16:27 /firmware/image/modem.b08
-r--r----- 1 system system 2550204 2017-12-02 16:27 /firmware/image/modem.b09
-r--r----- 1 system system 45 2017-12-02 16:27 /firmware/image/modem.b10
-r--r----- 1 system system 1101824 2017-12-02 16:27 /firmware/image/modem.b11
-r--r----- 1 system system 19002064 2017-12-02 16:27 /firmware/image/modem.b12
-r--r----- 1 system system 287632 2017-12-02 16:27 /firmware/image/modem.b13
-r--r----- 1 system system 1140 2017-12-02 16:27 /firmware/image/modem.b14
-r--r----- 1 system system 517552 2017-12-02 16:27 /firmware/image/modem.b16
-r--r----- 1 system system 16137345 2017-12-02 16:27 /firmware/image/modem.b17
-r--r----- 1 system system 2689224 2017-12-02 16:27 /firmware/image/modem.b18
-r--r----- 1 system system 67136 2017-12-02 16:27 /firmware/image/modem.b20
-r--r----- 1 system system 663737 2017-12-02 16:27 /firmware/image/modem.b21
-r--r----- 1 system system 11104256 2017-12-02 16:27 /firmware/image/modem.b22
-r--r----- 1 system system 131072 2017-12-02 16:27 /firmware/image/modem.b23
-r--r----- 1 system system 1048576 2017-12-02 16:27 /firmware/image/modem.b24
-r--r----- 1 system system 433920 2017-12-02 16:27 /firmware/image/modem.b25
-r--r----- 1 system system 81476 2017-12-02 16:27 /firmware/image/modem.b26
-r--r----- 1 system system 4848 2017-12-02 16:27 /firmware/image/modem.b27
-r--r----- 1 system system 224 2017-12-02 16:27 /firmware/image/modem.b28
-r--r----- 1 system system 8412 2017-12-02 16:27 /firmware/image/modem.mdt
-r--r----- 1 system system 405 2017-12-02 16:27 /firmware/image/modemr.jsn
-r--r----- 1 system system 5222165 2017-12-02 16:27 /firmware/image/qdsp6m.qdb
-r--r----- 1 system system 27 2017-12-02 16:27 /firmware/image/radiover.cfg
-r--r----- 1 system system 27 2017-12-02 16:27 /firmware/image/version.cfg
htc_ocnwhl:/ # cat /firmware/image/version.cfg
SSD:8998-002772-1711011019
htc_ocnwhl:/ # cat /firmware/image/radiover.cfg
SSD:8998-002772-1711011019

htc_ocnwhl:/ # mkdir /mnt/real_radio
htc_ocnwhl:/ # mount -t vfat -o ro /dev/block/bootdevice/by-name/radio /mnt/real_radio
htc_ocnwhl:/ # cat /mnt/real_radio/version.cfg
SSD:8998-001791-1705231845
htc_ocnwhl:/ # cat /mnt/real_radio/radiover.cfg
SSD:8998-001791-1705231845
htc_ocnwhl:/ #