Sunday, January 31, 2021

Samsung Galaxy Tablet 10.1 GT-N8013 on Android 11 with LineageOS 18.1 (ALPHA/BETA)

Flash (firmware update) on 8 years old original Samsung Galaxy Tablet 10.1 GT-N8013 with latest Android 11 is possible now. theupgradeguide.com provided detailed steps and screenshots nicely to follow.

html6405 from xda-developers provides all the Downloads for : Samsung Galaxy Note 10.1 Wifi. Make sure that the latest TWRP recovery file and magisk_patched_n8010.img file are download from same place, instead of img file from twrp official site. This also applies to LineageOS and Open GApps zip files. Official sites might not provide support for GT-N8013 anymore.

TWRP image replace recovery.img file on GT-N8013, which is done by Odin or Heimdall (Jodin is Java wrapper around Heimdall) via Odin mode, aka bootloader mode. TWRP img is used in recovery mode: power + volume-up (release buttons after Samsung screen is displayed; volume-up key is on the left to SD card slot)

MagiskSU from topjohnwu replaces SuperSU for rooting recent version of Android devices. Magisk Manage app is included in Lineage OS, which will be used for creating magisk_patched_*****.img in place, so you can rename it as boot.img and flash boot partition in Odin mode (or just select "Direct Install" method, which will flash boot image in place.). After reboot, GT-N8013 is rooted, and passes SafetyNet Attestation checking via Magisk.

LineageOS 18.1 on GT-N8013 from htm6405: lineage-18.1-20210114-HTML6405 seems to have the common issue on LineageOS with charging over a hour, which might freeze and could not resume from standby screen. Hopefully this will be resolved by next release.

LineageOS boot up process is a little slow (initial boot is even slower), compared to original Samsung boot. I did not find an option to fast boot it yet.

After flashing GT-N8013 with LineageOS 18.1, Android display device info as GT-N8010, I understand the img file I used did  have subfix with n8010. It is fine.

Android (Trust System security) complains that This build was signed with public key, and SELinus is not enforcing, you system has been weakened, so I had to disable the trust, not the best practice really.

Also credit to Sonny Kurniawan on Blogger, who provided details on flashing Android Nougat. Yes, my stocked GT-N8013 has been collecting dust all these years. 😅

Always xda link for more and latest info.

As to OEM bootloader unlock, JJEgan from xda-developers says GT-N8013 is unlocked. I enabled Developer debug mode in original ROM (Android 4.1.2), and I don't recall there is option for bootloader unlock either. 

I used Heimdall on OS X Mojave to flash TWRP and magisk patched.img.

Update: I flashed GT-N8013 with LineageOS 18.1 BETA from html6045 with same version of TWRP as ALPHA release last December without any issue.

Note: Magisk is not installed on BETA release.

Tip: LineageOS might not include some language input method, but Gboard app from Google Playstore is pretty good, which detects extra language selected, and download most popular input method in the background.

Heimdall on OS X High Sierra/ Mojave

Samsung Galaxy devices use Odin to flash firmware, however Odin is only available on Windows unfortunately.

Heimdall is a cross-platform open-source tool suite used to flash firmware (aka ROMs) onto Samsung Galaxy devices from Benjamin Dobell, an alternative for Odin on Linux/Mac.

Packaged Heimdall binary from link doesn't work on High Sierra or latter, so you will have to compile source code from gitlab. Heimdall frontend requires Xcode 9.4 above.

bfabiszewski @bfabiszewski has merge request: Fix build on macOS High Sierra for Heimdall, which replaces three CMakeLists.txt files from source. Without these fixes, cmake step from Benjamin Dobell will fail.

I followed fix from bfabiszewski on OS X  Mojave and built Heimdall binary successfully.

It seems that best practice is to run Heimdall with sudo, and also for heimdall front end. One caveat or feature I noticed is that Heimdall tends to release kernel drive after some operations, which might cause next task failed with initialization error. If this happen, just disconnect/reconnect usb cable, and run heimdall detect to make sure Heimdall can detect Samsung Galaxy devices.

Saturday, January 9, 2021

Install pip on Python3

https://stackoverflow.com/questions/31273157/how-to-install-pip-on-compiled-from-source-python

Custom build Python might not come with pip, so you can rebuilt with the following options:

./configure --with-openssl=/usr/local/opt/openssl --with-ensurepip=install

pip need Python ssl module, which in turn need openssl.

Or,  python get-pip.py will also install pip. again, assuming Python is build with ssl module.
Download get-pip.py via:
curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py

The ensurepip package provides support for bootstrapping the pip installer into an existing Python installation or virtual environment. This bootstrapping approach reflects the fact that pip is an independent project with its own release cycle, and the latest available stable version is bundled with maintenance and feature releases of the CPython reference interpreter.

In most cases, end users of Python shouldn’t need to invoke this module directly (as pip should be bootstrapped by default), but it may be needed if installing pip was skipped when installing Python (or when creating a virtual environment) or after explicitly uninstalling pip.
python -m ensurepip

This invocation will install pip if it is not already installed, but otherwise does nothing. To ensure the installed version of pip is at least as recent as the one available in ensurepip, pass the --upgrade option:

python -m ensurepip --upgrade

By default, pip is installed into the current virtual environment (if one is active) or into the system site packages (if there is no active virtual environment).

Setting up GDB for Debugging Python 3.9.1 on OS X Mojave

https://unconj.ca/blog/setting-up-gdb-for-debugging-python-on-os-x.html

brew install gdb and codesign gdb (updated procedure from: https://sourceware.org/gdb/wiki/PermissionsDarwin)

Brew installed python3 is already in thin format, no need to use lipo to extract, although you can still use lipo to check python executable format. (Non-fat file: python3 is architecture: x86_64)

Providing python3 interpreter (not symbolic link) with path if necessary, after gdb , and this will solve error message like: "0x7ffeefbff800s": not in executable format: file format not recognized

Had to compile Python3 from source to get rid of the following warning: ( ./configure --with-pydebug). Uncommenting SSL related lines in Modules/Setup file is to load ssl module in Python

Reading symbols from python...
(No debugging symbols found in python)

Also build gdb from source code again (./configure --with-python=/usr/local/bin/python3 --disable-werror), as brew info gdb failed with Brew installed python@3.9. Codesign command again for gdb.







Python gdp support: https://devguide.python.org/gdb/

 ~/.gdbinit with content below:

set startup-with-shell off

add-auto-load-safe-path /usr/local/bin