How To Install Lineage OS and Optionally, Build Lineage From Scratch

Search This thread

jenneh

Senior Member
Hello Friends!

Today I wanted to re-write a guide for installing Lineage OS on the 2019 Pro.

This guide will be more to the point and have only the needed tools.

The SOURCE for the Lineage zip shared in the download section below.

DOWNLOAD (636MB):
1.PNG

NOTE YOU MAY NEED TO RUN THIS CODE IF YOU GET THE MORE THAN ONE DEVICE ERROR, OR IF THE BATCH WINDOW CLOSES BEFORE ACTUALLY FLASHING LINEAGE
Code:
adb kill-server
You do not have to download anything I share, here is the code for the batches:
BootTw.bat:
Code:
fastboot boot tw.img

SendOnlyLineage.bat:
Code:
adb push lineage.zip /sdcard

.SendGapps&Lineage.bat:
Code:
adb push gapps.zip /sdcard
adb push lineage.zip /sdcard

Therefore you can download your own TWRP, gapps, and lineage, rename them and use the provided code.
Please see the Prerequisites section on this THREAD if you need help with unlocking the bootloader, adb, or the usb driver.

You can have any firmware installed for this in theory. It was tested recently on 8.2.3
HOW TO USE:
Boot your shield to the bootloader menu.

Unzip Lineage.zip

Now run .bootTW.bat to load teamwin on the shield.
4.jpg

Swipe to allow modifications on the shield, this will allow our device to be adb accessible.
3.PNG

Now run your choice of .SendGapps&Lineage.bat or .SendOnlyLineage.bat

This will push lineage and optionally gapps to the /sdcard folder on the shield.

Now in TWRP select the INSTALL button, go down to sdcard and select Lineage.
5.jpg
6.jpg

When Lineage is complete, you may install GAPPS if you want playstore access.

After rebooting, your machine will now post into Lineage!
7.jpg

8.jpg

Fully installed without GAPPS it is a Blank Slate. Beautiful XD
SOME NOTES:

This is not a beginner's OS. There will be problems.
Also the AI upscaling feature doesn't come with this OS.
The version of Lineage used in this guide is 17.1, Android 10
IMG_20230102_114209.jpg

The ORIGINAL Guide if you want to see how much harder I made things not knowing what to do :)

This may be useful to locking the bootloader while lineage is installed!
 
Last edited:

jenneh

Senior Member
The next two comments are notes about porting to different OSs and downloading the original source code. They are not full guides as I have not personally succeeding in fully building anything myself yet, just initiating repos and data gathering but will update when we get there..

The code shared is specifically for an Ubuntu machine running 22.04.1 Download Ubuntu

I have made some amendments to the original guide wrote by the LineageOS Devs.

Some additional dependencies were added like: adb, fastboot, python-is-python3 and more.

A command: make otatools was added to fix the extracting blobs issue. THANKS!

The original guides are included below so you can learn what every step does in detail if you like.
Code:
sudo dpkg --add-architecture i386
sudo apt update

sudo apt install adb bc bison brotli build-essential bzr \
curl fastboot flex g++-multilib gcc-multilib git gnupg gperf imagemagick \
lib32ncurses5-dev lib32readline-dev lib32z1-dev libc6-dev libelf-dev libgl1-mesa-dev \
liblz4-tool libgl1-mesa-glx:i386  libncurses5  libncurses5-dev:i386 libreadline6-dev:i386 \
libsdl1.2-dev libssl-dev libxml2 libxml2-utils lzop pngcrush rsync libx11-dev:i386 \
lzop mingw-w64-i686-dev python3-markdown rsync schedtool tofrodos squashfs-tools \
x11proto-core-dev xsltproc zip zlib1g-dev:i386 python-is-python3 -y

mkdir -p ~/bin
echo export PATH=\$PATH:\$HOME/bin >> ~/.bashrc
source ~/.bashrc
mkdir -p ~/android/lineage
cd ~/android/lineage

curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+rx ~/bin/repo

git config --global user.email "[email protected]"
git config --global user.name "Your Name"

repo init -u https://github.com/LineageOS/android.git -b lineage-17.1
repo sync --force-sync

make otatools

source build/envsetup.sh
breakfast mdarcy
If you experience any error with breakfast, run this code:
Code:
repo sync
breakfast mdarcy
Download Lineage for MDARCY
Code:
mkdir ~/android/system_dump/
cd ~/android/system_dump/
unzip ~/Downloads/lineage-17.1-20220202-nightly-mdarcy-signed.zip
brotli --decompress --output=system.new.dat system.new.dat.br
brotli --decompress --output=vendor.new.dat vendor.new.dat.br
git clone https://github.com/xpirt/sdat2img
python sdat2img/sdat2img.py system.transfer.list system.new.dat system.img
python sdat2img/sdat2img.py vendor.transfer.list vendor.new.dat vendor.img
mkdir system/
sudo mount system.img system/
sudo mount vendor.img system/vendor/
cd ~/android/lineage/device/nvidia/mdarcy
./extract-files.sh ~/android/system_dump/

cd ~/android/lineage
breakfast mdarcy

croot
brunch mdarcy

cd $OUT
Code:
sudo dpkg --add-architecture i386
sudo apt update

sudo apt install adb bc bison brotli build-essential bzr \
curl fastboot flex g++-multilib gcc-multilib git gnupg gperf imagemagick \
lib32ncurses5-dev lib32readline-dev lib32z1-dev libc6-dev libelf-dev libgl1-mesa-dev \
liblz4-tool libgl1-mesa-glx:i386  libncurses5  libncurses5-dev:i386 libreadline6-dev:i386 \
libsdl1.2-dev libssl-dev libxml2 libxml2-utils lzop pngcrush rsync libx11-dev:i386 \
lzop mingw-w64-i686-dev python3-markdown rsync schedtool tofrodos squashfs-tools \
x11proto-core-dev xsltproc zip zlib1g-dev:i386 python-is-python3 -y

mkdir -p ~/bin
echo export PATH=\$PATH:\$HOME/bin >> ~/.bashrc
source ~/.bashrc
mkdir -p ~/android/lineage
cd ~/android/lineage

curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+rx ~/bin/repo

git config --global user.email "[email protected]"
git config --global user.name "Your Name"

repo init -u https://github.com/LineageOS/android.git -b lineage-18.1
repo sync --force-sync

make otatools

source build/envsetup.sh
breakfast foster
If you experience any error with breakfast, run this code:
Code:
repo sync
breakfast foster
Download Lineage for FOSTER
Code:
mkdir ~/android/system_dump/
cd ~/android/system_dump/
unzip ~/Downloads/lineage-18.1-20221214-nightly-foster-signed.zip
brotli --decompress --output=system.new.dat system.new.dat.br
brotli --decompress --output=vendor.new.dat vendor.new.dat.br
git clone https://github.com/xpirt/sdat2img
python sdat2img/sdat2img.py system.transfer.list system.new.dat system.img
python sdat2img/sdat2img.py vendor.transfer.list vendor.new.dat vendor.img
mkdir system/
sudo mount system.img system/
sudo mount vendor.img system/vendor/
cd ~/android/lineage/device/nvidia/foster
./extract-files.sh ~/android/system_dump/

cd ~/android/lineage
breakfast foster

croot
brunch foster

cd $OUT
 
Last edited:

jenneh

Senior Member
I used an Ubuntu machine to download the repo PREMADE UBUNTU MACHINE
If you don't want to do all these steps, I have already downloaded the firmware and uploaded it to gdrive here:
UPLOADING

HOW TO DOWNLOAD THE FIRMWARE YOURSELF:
Select a firmware you want to download from here: https://developer.nvidia.com/shield-open-source
2.PNG

Will provide you with the repo code, you can initialize this in a linux machine with this code:

Some of this code may be unneeded, I am no Linux expert. I just recognized the repo code was similar to how we would initiate for Lineage, and I borrowed the code from doing that.
Code:
sudo dpkg --add-architecture i386
sudo apt update

#dependencies- paste the whole paragraph below, all at once:
sudo apt install adb bc bison brotli build-essential bzr \
curl fastboot flex g++-multilib gcc-multilib git gnupg gperf imagemagick \
lib32ncurses5-dev lib32readline-dev lib32z1-dev libc6-dev libelf-dev libgl1-mesa-dev \
liblz4-tool libgl1-mesa-glx:i386  libncurses5  libncurses5-dev:i386 libreadline6-dev:i386 \
libsdl1.2-dev libssl-dev libxml2 libxml2-utils lzop pngcrush rsync libx11-dev:i386 \
lzop mingw-w64-i686-dev python3-markdown rsync schedtool tofrodos squashfs-tools \
x11proto-core-dev xsltproc zip zlib1g-dev:i386 python-is-python3 -y

#install google repo client to bin and set it to PATH:
mkdir -p ~/bin
echo export PATH=\$PATH:\$HOME/bin >> ~/.bashrc
source ~/.bashrc
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+rx ~/bin/repo

#setup git, you can either use your real info or literally paste the commands below:
git config --global user.email "[email protected]"
git config --global user.name "Your Name"

#change the 8.2.3 to the name of the firmware you are downloading:
mkdir -p ~/nvidia/8.2.3
cd nvidia/8.2.3

#change this line out with the repo you want to download, the one below is 8.2.3:
repo init -u git://nv-tegra.nvidia.com/manifest/android/binary.git -b rel-32-shield-r1-opensource -m tlk/t210.xml
repo sync -j5
edit--- for those rolling on a 2015-2017 shield, someone awesome already has a port for you. for the rest of us, there is knowledge there in their guide

Porting instructions - a work in progress
1672907900904.png

Code:
sudo dpkg --add-architecture i386
sudo apt update

sudo apt install adb bc bison build-essential bzr \
curl fastboot flex g++-multilib gcc-multilib git gnupg gperf imagemagick \
lib32ncurses5-dev lib32readline-dev lib32z1-dev libc6-dev libelf-dev libgl1-mesa-dev \
liblz4-tool libgl1-mesa-glx:i386  libncurses5  libncurses5-dev:i386 libreadline6-dev:i386 \
libsdl1.2-dev libssl-dev libxml2 libxml2-utils lzop pngcrush rsync libx11-dev:i386 \
lzop mingw-w64-i686-dev python3-markdown rsync schedtool tofrodos squashfs-tools \
x11proto-core-dev xsltproc zip zlib1g-dev:i386 python-is-python3 -y

mkdir -p ~/bin
echo export PATH=\$PATH:\$HOME/bin >> ~/.bashrc
source ~/.bashrc

curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+rx ~/bin/repo

mkdir halium && cd halium
git config --global user.email "[email protected]"
git config --global user.name "Your Name"

repo init -u https://github.com/Halium/android -b halium-10.0 --depth=1
repo sync --force-sync
Go into /halium/devices/manifests and rename one of the unused manifests to match your device.
"nvidia_mdarcy" for this example.
Erase the contents and replace with:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project path="device/nvidia/mdarcy" name="LineageOS/android_device_nvidia_mdarcy" />
<project path="device/nvidia/foster" name="LineageOS/android_device_nvidia_foster" />
</manifest>
Code:
./halium/devices/setup mdarcy
hybris-patches/apply-patches.sh --mb

source build/envsetup.sh
breakfast mdarcy
#copied the mdarcy folder extracted from lineage 17.1 zip
mka mkbootimg
Kali Nethunter Porting Source
"In order to port NetHunter to a new device, it’s important to understand how NetHunter is separated. NetHunter is divided by the rootfs (also known as the chroot but will be referred to here as rootfs) and the kernel. For the most part, the rootfs is not important to your Android device as it only contains Kali Linux. The kernel is integral to getting things like Bluetooth, wireless USB, and HID keyboard (etc) working."
Local Config Example
 
Last edited:

AP12345

Member
Nov 11, 2022
5
1
Hi I am planning to get a Nvidia shield pro 2019. I want to install lineageos and root it but would like to have all HDR & 4k codecs still supported and use the AI upscaling feature. Since you have experience with the device, could you tell me if this is all possible in one and if not what alternatives you know?
 

jenneh

Senior Member
Hi I am planning to get a Nvidia shield pro 2019. I want to install lineageos and root it but would like to have all HDR & 4k codecs still supported and use the AI upscaling feature. Since you have experience with the device, could you tell me if this is all possible in one and if not what alternatives you know?
Sorry.. I do not know the answer to this, I am just learning these things myself and writing notes here publicly for anyone to pickup but here is the actual main thread for lineage os on the shield and the dev is very active https://forum.xda-developers.com/t/rom-official-lineageos-for-the-shield-android-tv.3632652/
 
  • Like
Reactions: AP12345

Top Liked Posts