Author Topic: Ubports for Cosmo  (Read 18260 times)

mibry

  • Jr. Member
  • **
  • Posts: 72
    • View Profile
Ubports for Cosmo
« on: November 05, 2020, 02:13:16 am »
There has been quite a bit of work on a ubports port for the cosmo.
To install ubports on the cosmo you will need linux installed, I will not explain that in this post as there are instruction on Planets website.

Download the latest flashable zip file (Will be named artifacts.zip) from https://gitlab.com/ubports/community-ports/android9/planet-cosmocom/planet-cosmocom/-/pipelines.
Unzip artifacts.zip, 2 files will be unziped to a new folder call "out". The files will be called rootfs.img and boot.img.
cd to the out folder and move the rootfs.img file to / and rename it to ubuntu.img
next flash the boot.img to one of the free boot slots using the following command "dd if=~/out/boot.img of=/dev/disk/by-partlabel/boot4 <- the last part will need to be changed to reflect you boot slot.

Next reboot and select the boot slot with ubuntu touch. Then follow the setup instructions.

Thanks go to @TheKit for working on Ubports for cosmo.
« Last Edit: November 05, 2020, 07:48:17 pm by mibry »

idc

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
Re: Ubports for Cosmo
« Reply #1 on: November 05, 2020, 06:23:44 am »
Thanks for the update. I shall try and give this a go when I have some spare time. Can you report on what currently is and isn't working?
I'm sure I'll not be alone in welcoming any reviews and comparisons anyone would care to make between Ubports, Planet's Linux, and Sailfish OS. (Years and years ago I backed Ubuntu's Kickstarter — or was it Indiegogo — in the hope I'd get a decent Linux phone; perhaps the Cosmo will eventually be it.)
Thanks very much.
Ian

oida

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Ubports for Cosmo
« Reply #2 on: November 05, 2020, 02:00:08 pm »
I have rooted android and gemian on my cosmo. do I need to overwrite gemian or can I flash in the free recovery slot? (boot2)
tia

mibry

  • Jr. Member
  • **
  • Posts: 72
    • View Profile
Re: Ubports for Cosmo
« Reply #3 on: November 05, 2020, 07:46:07 pm »
I don't believe it is a good idea to use recovery slot 2. From what has been said on the telegram group is that slot 2 does not have access to the modem. Someone on the telegram group created a script to change the boot images between Sailfishos, Gemian and Ubports using the Planet recovery install custom OS option. I will see if I can find it and post it here.
« Last Edit: November 05, 2020, 07:49:25 pm by mibry »

oida

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Ubports for Cosmo
« Reply #4 on: November 06, 2020, 11:38:42 am »
thx for the hint and saving me trouble.
afaik I only have two full partitions: android and linux. So I guess I need to delete eighter android or gemian for trying ubports?

Piece_Maker

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Ubports for Cosmo
« Reply #5 on: November 06, 2020, 02:53:56 pm »
The UBPorts image resides in the same main partition as Debian, so you don't need to delete either. The bootloader has extra boot options, and by using my script (attached) on your Cosmo alternative OS installer SD card thing you can flash the UBPorts boot.img to one of these boot options and essentially triple-boot Android, Debian and UBPorts. 

You'll also need to put the boot.img on your SD card in the same folder and change its name to 'ubports-boot.img' for my script to work, and also add this: 

Code: [Select]
echo "UBPorts,$MBF/Cosmo_Installer_UBPorts.sh" >> $INSTALLER_FILE 

To the bottom of the list_installers.sh file (above the 'rm -f $PARTITION_FILE' line) and, as noted above, put the ubuntu.img file in the root directory of your Gemian install. Now boot to recovery with the SD card inserted and install UBPorts to another boot partition of your choice (But not the second one, as noted above there's no networking there!)

I've found the UBPorts image to be the most fleshed-out alternate OS yet - the camera works, keyboard layout works, 4G works, Bluetooth works  8)

oida

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Ubports for Cosmo
« Reply #6 on: November 13, 2020, 08:27:29 am »
tried it now: looks quite promising, still alpha, keep the superb work, thx so far.
It did overwrite Gemian though, even I used the script. No problem since both are not usable at the moment:
In ubports: Network (wifi) only works once after reinstalling. After a standby it cannot find any more networks, even after a reboot.
Phone does not work, cannot connect to any carrier / resolving carriers does not work. Mobile data also does not work.
Trying OTA results i  rebooting to fastboot.
 
« Last Edit: November 16, 2020, 01:55:17 pm by oida »

soCket23

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Ubports for Cosmo
« Reply #7 on: November 21, 2020, 11:29:24 pm »
The UBPorts image resides in the same main partition as Debian, so you don't need to delete either. The bootloader has extra boot options, and by using my script (attached) on your Cosmo alternative OS installer SD card thing you can flash the UBPorts boot.img to one of these boot options and essentially triple-boot Android, Debian and UBPorts. 

You'll also need to put the boot.img on your SD card in the same folder and change its name to 'ubports-boot.img' for my script to work, and also add this: 

Code: [Select]
echo "UBPorts,$MBF/Cosmo_Installer_UBPorts.sh" >> $INSTALLER_FILE 

To the bottom of the list_installers.sh file (above the 'rm -f $PARTITION_FILE' line) and, as noted above, put the ubuntu.img file in the root directory of your Gemian install. Now boot to recovery with the SD card inserted and install UBPorts to another boot partition of your choice (But not the second one, as noted above there's no networking there!)

I've found the UBPorts image to be the most fleshed-out alternate OS yet - the camera works, keyboard layout works, 4G works, Bluetooth works  8)

Well I got a solid install of UB using the steps throughly, bu still ened up wiping Gemian I think. if you were genuinely able to boot Android, Rooted Droid, Debian and UB, I would lke to see it. the only thing I didn'y do is run that last line of code from step 1 in the top post. the only thing i didn't do was the last step of the first instruction post.

next flash the boot.img to one of the free boot slots using the following command "dd if=~/out/boot.img of=/dev/disk/by-partlabel/boot4 <- the last part will need to be changed to reflect you boot slot.

I was thinking about adding that line if code into the UBports-cosmo-installer.sh, loooking at the other installers I feel like that was the missing piece. buuuuut I am not code savvy enough to just through it in and hope for the best. also I think it needed edited a pinch to pull from the righ locations and the syntax seemed off.. I wish I could just image the whole device onto an extraneland the start from scratch , but I need another SD card for that. I'll let you know. WOuld love feedback on  my theory.


AND ITS STUCK. Opening terminal, going through some sort of instruction/show of features and the screen won’t swipe to keeping moving through it.
« Last Edit: November 22, 2020, 12:12:36 am by soCket23 »

Piece_Maker

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Ubports for Cosmo
« Reply #8 on: November 22, 2020, 05:39:20 pm »

Well I got a solid install of UB using the steps throughly, bu still ened up wiping Gemian I think. if you were genuinely able to boot Android, Rooted Droid, Debian and UB, I would lke to see it. the only thing I didn'y do is run that last line of code from step 1 in the top post. the only thing i didn't do was the last step of the first instruction post.

 

Here's a video showing my current setup: https://www.youtube.com/watch?v=eSw_2ovdBy0 

Did you overwrite your Debian boot option with the UBPorts one? You need to put it in another slot.

oida

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Ubports for Cosmo
« Reply #9 on: November 23, 2020, 09:38:42 am »

Well I got a solid install of UB using the steps throughly, bu still ened up wiping Gemian I think. if you were genuinely able to boot Android, Rooted Droid, Debian and UB, I would lke to see it. the only thing I didn'y do is run that last line of code from step 1 in the top post. the only thing i didn't do was the last step of the first instruction post.

 

Here's a video showing my current setup: https://www.youtube.com/watch?v=eSw_2ovdBy0 

Did you overwrite your Debian boot option with the UBPorts one? You need to put it in another slot.

You have no rooted Android.
I have and as long there is no AOSP android image from Pl. Co .I have to stay rooted for security reasons (blocking google etc)
So eighter Debian or UBports.
Both are not usable as a daily driver, nor is Android because of old security patches and issues.

MonkeyControl

  • Full Member
  • ***
  • Posts: 115
    • View Profile
    • http://
Re: Ubports for Cosmo
« Reply #10 on: November 24, 2020, 05:04:36 pm »
Wow, thanks for this, much appreciated.  This is great for the Cosmo. 
I been using UBPorts as a daily driver (on PinePhone), it's such a nice OS, and the UI is so slick. 
Now my Cosmo (which got parked after I damaged the CoDi, and repair looked unlikely under lockdown), will get its repair and may well get the sim card back. 
I got it installed and working last night, see photo of PinePhone and Cosmo both running UBPorts. 
Well impressed. 
« Last Edit: November 24, 2020, 05:14:37 pm by MonkeyControl »

Piece_Maker

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Ubports for Cosmo
« Reply #11 on: November 28, 2020, 07:30:05 pm »

Well I got a solid install of UB using the steps throughly, bu still ened up wiping Gemian I think. if you were genuinely able to boot Android, Rooted Droid, Debian and UB, I would lke to see it. the only thing I didn'y do is run that last line of code from step 1 in the top post. the only thing i didn't do was the last step of the first instruction post.

 

Here's a video showing my current setup: https://www.youtube.com/watch?v=eSw_2ovdBy0 

Did you overwrite your Debian boot option with the UBPorts one? You need to put it in another slot.

You have no rooted Android.
I have and as long there is no AOSP android image from Pl. Co .I have to stay rooted for security reasons (blocking google etc)
So eighter Debian or UBports.
Both are not usable as a daily driver, nor is Android because of old security patches and issues.

I don't think I ever claimed to have rooted Android, though I guess I could put it into my TWRP partition as that's next to useless anyway, it'd lose modem functionality though. The only way I've found to have additional 'slots' on the bootloader is to just manually re-install the rooted Android boot option from the SD card which is obviously a bit rubbish. It'd be nice to have two more slots on the bootloader, for rooted Android and Sailfish OS too, but I don't see how that's possible!

asyik

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Ubports for Cosmo
« Reply #12 on: December 21, 2020, 08:04:29 am »
Please help.

I cant seem to get the UBports installed successfully.

This is what i did.

1) Add to the bottom of the list_installers.sh file (above the 'rm -f $PARTITION_FILE' line)
Code: [Select]
echo "UBPorts,$MBF/Cosmo_Installer_UBPorts.sh" >> $INSTALLER_FILE
So it looks like this
Code: [Select]
#!/system/bin/sh
PARTED="/sbin/parted_static"
MBF="/sdcard/cosmo-customos-installer"
LS="/system/bin/ls"
OUTPUT="/tmp/output.txt"
PARTITION_FILE="/tmp/part_name.txt"
INSTALLER_FILE="/tmp/installers.txt"
ERROR="/tmp/error.txt"

echo "Detect Installers..." > $OUTPUT

log () {
echo -n "$1 " >> $OUTPUT
}

execute() {
log "Running \"$1\""
R=$($1 2> $ERROR)

if [ "$?" -eq "0" ]
then
log "OK\n"
else
log "ERROR: `cat /tmp/error`\n"
fia
}

part_name() {
PART=`$PARTED /dev/block/mmcblk0 p | grep "$1   " | awk '{ print $5 }'`
if [ $PART = "ext2" ] || [ $PART = "ext4" ]
then
$PARTED /dev/block/mmcblk0 p | grep "$1   " | awk '{ print $6 }' >> $PARTITION_FILE
else
echo $PART >> $PARTITION_FILE
fi
}

# Write installer list in $INSTALLER_FILE
# Format: Name,Installer file
echo "TWRP,$MBF/Cosmo_Installer_TWRP.sh" > $INSTALLER_FILE
echo "Debian KDE/Plasma,$MBF/Cosmo_Installer_Debian_kde.sh" >> $INSTALLER_FILE
echo "Rooted Android,$MBF/Cosmo_Installer_Rooted_Android.sh" >> $INSTALLER_FILE
echo "UBPorts,$MBF/Cosmo_Installer_UBPorts.sh" >> $INSTALLER_FILE

# Write partition list in $PARTITION_FILE
# Format: partition_name
#   partition_number  (partition name followed by \n followed by partition_name)
rm -f $PARTITION_FILE
part_name 38
part_name 41
part_name 42

2) Download artifacts.zip from https://gitlab.com/ubports/community-ports/android9/planet-cosmocom/planet-cosmocom/-/pipelines.

Unzip artifacts.zip

rootfs.img --> renamed to ubuntu.img
boot.img   --> renamed to ubports-boot.img

3) Download Cosmo_Installer_UBPorts.sh

Add this at the bottom of the Cosmo_Installer_UBPorts.sh file.
Code: [Select]
# Install root image into partition 43
execute "$DD if=$MBF/ubuntu.img of=$LINUX_ROOTFS bs=1m"

so it looks like this

Code: [Select]
#!/system/bin/sh
PARTED="/sbin/parted_static"
DD="/system/bin/dd"
MBF="/sdcard/cosmo-customos-installer"
BOOT_PARTITION="/dev/block/mmcblk0p"
LINUX_ROOTFS="/dev/block/mmcblk0p43"
OUTPUT="/tmp/output.txt"
ERROR="/tmp/error.txt"

echo "Installing UBPorts..." > $OUTPUT

log () {
echo -n "$1 " >> $OUTPUT
}

execute() {
log "Running \"$1\""
R=$($1 2> $ERROR)

if [ "$?" -eq "0" ]
then
log "OK\n"
else
log "ERROR: `cat /tmp/error`\n"
fi
}

# Installing boot image into user-selected boot partition
execute "$DD if=$MBF/ubports-boot.img of=$BOOT_PARTITION$1 bs=1m"

# Rename partition to specific OS
execute "$PARTED /dev/block/mmcblk0  name $1 UBPorts"

# Install root image into partition 43
execute "$DD if=$MBF/ubuntu.img of=$LINUX_ROOTFS bs=1m"

4) Put the ubuntu.img, ubports-boot.img , list_installers.sh and Cosmo_Installer_UBPorts.sh files and in cosmo-customos-installer directory

5) Boot to recovery with the SD card inserted

6) Install UBPorts to another boot partition  --> this case i chose the last partition

But no luck.

« Last Edit: December 21, 2020, 08:30:43 am by asyik »

oida

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Ubports for Cosmo
« Reply #13 on: December 21, 2020, 12:20:33 pm »

I don't think I ever claimed to have rooted Android, though I guess I could put it into my TWRP partition as that's next to useless anyway, it'd lose modem functionality though. The only way I've found to have additional 'slots' on the bootloader is to just manually re-install the rooted Android boot option from the SD card which is obviously a bit rubbish. It'd be nice to have two more slots on the bootloader, for rooted Android and Sailfish OS too, but I don't see how that's possible!

Off course you didn't, no offence, just a statement.
More boot slots would really be great.

I cannot get my simcard running. Any1 can? or it could be my provider.

MonkeyControl

  • Full Member
  • ***
  • Posts: 115
    • View Profile
    • http://
Re: Ubports for Cosmo
« Reply #14 on: December 23, 2020, 02:36:19 pm »
Quote

I cannot get my simcard running. Any1 can? or it could be my provider.

I got mine running on 2degrees and vodafonenz in NZ, it may be your provider. 
Try looking up your APN settings and having a tinker.