Difference between revisions of "Samsung Galaxy SIII LTE (samsung-i9305)"

From postmarketOS
Jump to navigation Jump to search
(Created page with "Category:Supported Devices Category:Devices {{Infobox device | manufacturer = Samsung | name = Galaxy SIII LTE | codename = i9305 | image = File:samsung-i9305.jpg | i...")
 
(Add WiFi on mainline how to)
 
(57 intermediate revisions by 24 users not shown)
Line 1: Line 1:
[[Category:Supported Devices]]
 
[[Category:Devices]]
 
 
{{Infobox device
 
{{Infobox device
 
| manufacturer = Samsung
 
| manufacturer = Samsung
| name =  Galaxy SIII LTE
+
| name =  Galaxy S III
| codename = i9305
+
| codename = samsung-i9300, samsung-i9305
| image = File:samsung-i9305.jpg
+
| image = File:Samsung-i9300-galaxy-s-iii-ofic.jpg
| imagecaption = CHANGE_ME
+
| imagecaption = Samsung Galaxy SIII
 
| releaseyear = 2012
 
| releaseyear = 2012
 
| originalsoftware = Android 4.1.1
 
| originalsoftware = Android 4.1.1
 +
| chipset = Exynos 4412 Quad
 
| cpu = Quad-core 1.4 GHz Cortex-A9
 
| cpu = Quad-core 1.4 GHz Cortex-A9
 
| gpu = Mali-400MP4
 
| gpu = Mali-400MP4
| storage = 16GB (internal), up to 64GB (sdcard)
+
| storage = 16 GB/32 GB
 
| display = 720x1280 Super AMOLED
 
| display = 720x1280 Super AMOLED
| memory = 2GB
+
| memory = 1 GB(GT-i9300 & SHW-M440S)<br>2 GB(LTE Variants)
 +
| architecture = armv7
 +
<!-- the following status_* questions should be answered with Y - yes, P - partial, N - no, or left blank (for untested or unknown) -->
 +
| status_usbnet = Y
 +
| status_flashing = N
 +
| status_touch = Y
 +
| status_screen = Y
 +
| status_wifi = Y
 +
| status_xwayland = Y
 +
| status_fde = Y
 +
| status_mainline = Y
 +
| status_battery =
 +
| status_3d =
 +
| status_accel =
 +
| status_audio =
 +
| status_bluetooth =
 +
| status_camera =
 +
| status_gps =
 +
| status_mobiledata =
 +
| status_sms =
 +
| status_calls =
 +
| status =
 +
| booting = yes
 
}}
 
}}
 
+
__TOC__
 
== Contributors ==
 
== Contributors ==
 +
* [[User:Thiagaoplusplus|Thiagaopluplus]]
 
* tyxieblub
 
* tyxieblub
 +
* [[User:Colaur|Colaur]]
  
== Maintainer(s) ==
+
== Basic info ==
<!-- Only if this device doesn't run on linux-postmarketos yet! -->
 
<!-- This person needs to be willing to answer questions from users of this device -->
 
 
 
== What works ==
 
  
* Installation to sdcard (<code>pmbootstrap install --sdcard=/dev/mmcblk...</code>)
+
So far, what works for samsung-i9305 (Galaxy SIII LTE version) also works for the samsung-i9300 (Galaxy SIII international GSM version without LTE, Also known as Galaxy S III 3G SHW-M440S in South Korea) and samsung-shv-e210s (a Korean variant). (None of these SIII models should be confused with the North American SIII models, which require OS builds.)
* Touchscreen
 
* Weston (only on SD card)
 
* XWayland
 
* Wifi
 
  
== What does not work ==
+
Code name is MIDAS. Search for midas-mainline to find more info.
  
* The rest
+
== Users owning this device ==
 +
{{Device owners}}
  
 
== How to enter flash mode ==
 
== How to enter flash mode ==
Line 42: Line 58:
 
== Installation ==
 
== Installation ==
  
 +
Set phone to ODIN mode
 +
 +
  1. Turn off phone
 +
  2. Connect USB cable
 +
  3. Hold VOLUME_DOWN + HOME + POWER until you get Warning!! screen
 +
  4. Push VOLUME_UP to continue to ODIN mode screen
 +
 +
<source lang="bash">
 +
# Ready the build
 +
pmbootstrap init # (weston or xfce4 should do)
  
<source lang="shell">$ ./pmbootstrap.py init</source>
+
# Install rootfs to Micro SD Card
 +
pmbootstrap install --sdcard=/dev/mmcblk0/1/2/3 # (will depend on where your Micro SD Card is mounted)
  
Start the build process
+
# Put the i9305 / i9300 into odin mode with the steps above and flash the kernel (to boot from the Micro SD Card)
 +
pmbootstrap flasher flash_kernel # (in odin mode)
  
<source lang="shell">
+
# and it should reboot automatically
# Replace /dev/mmcblk with your actual sdcard device
 
$ ./pmbootstrap.py install --sdcard=/dev/mmcblk
 
 
</source>
 
</source>
  
Build and flash the kernel
+
==Installing with downstream kernel==
 +
 
 +
<source lang="bash">
 +
#FIRST PMBOOTSTRAP INSTALL
 +
mkdir ~/code
 +
cd ~/code
 +
git clone https://gitlab.com/postmarketOS/pmbootstrap.git
 +
 
 +
#CONFIG PMBOOTSTRAP
 +
alias pmbootstrap=~/code/pmbootstrap/pmbootstrap.py
 +
pmbootstrap init
 +
#work path default
 +
#samsung
 +
#i9305
 +
#n
 +
#wathever
 +
#weston
 +
#n
 +
#none
 +
#y
 +
#samsung-i9305
 +
#y
 +
 
 +
#FOR DEBUGGING (NOT REQUIRED)
 +
pmbootstrap initfs hook_add debug-shell
 +
#Check log with 'tail -f ~/.local/var/pmbootstrap/log.txt'
 +
 
 +
#CREATE RECOVERY ZIP (for flashing with TWRP)
 +
pmbootstrap install --android-recovery-zip
 +
 
 +
#COPY ON SDCARD
 +
cp ~/.local/var/pmbootstrap/chroot_buildroot_armhf/var/lib/postmarketos-android-recovery-installer/pmos-samsung-i9305.zip /media/computer/sdcard/
 +
#Insert sdcard in phone
 +
#Reboot on recovery with up+home+power
 +
#Install from zip
 +
#Reboot
 +
 
 +
#IF BOOT STANDBY (DEBUG)
 +
#Connect with USB cable
 +
telnet 172.16.42.1
 +
pmos_continue_boot
 +
</source>
 +
 
 +
== WiFi ==
 +
 
 +
To get the WiFi working, you'll need to modify the wpa_supplicant configuration. If this is not done, wpa_supplicant starts with -ip2p0 which is not supported on our device.
 +
 
 +
  $ echo 'wpa_supplicant_args="-Dwext"' | sudo tee /etc/conf.d/wpa_supplicant
 +
 
 +
You can use either NetworkManager or networking and wpa_supplicant. NetworkManager is recommend in most cases as it handles reconnection.
 +
 
 +
=== Network Manager ===
 +
 
 +
Ensure the networkmanger service is running
 +
 
 +
  $ sudo rc-status | grep 'networkmanager'
 +
 
 +
if it not visible, try to start the service:
 +
 
 +
  $ sudo rc-service networkmanager start
 +
 
 +
Search for available WiFi networks and connect to network
 +
 
 +
  $ sudo nmcli device wifi list ifname wlan0
 +
  $ sudo nmcli --ask dev wifi connect SSID
 +
 
 +
Reboot and you should be connected.
 +
 
 +
=== Networking and wpa_supplicant ===
 +
 
 +
You will need to manually configure the interfaces by creating <source>/etc/network/interfaces</source> e.g.,
 +
 
 +
  $ sudo vi /etc/network/interfaces
 +
 
 +
  <pre>
 +
  auto lo
 +
  iface lo inet loopback
 +
  auto wlan0
 +
  iface wlan0 inet dhcp
 +
  </pre>
 +
 
 +
Save changes and add networking to start with system
 +
 
 +
$ sudo rc-update add networking
 +
 
 +
Add WiFi network information
 +
 
 +
$ wpa_passphrase YOUR_SSID YOUR_PASSPHRASE | sudo tee /etc/wpa_supplicant/wpa_supplicant.conf
 +
 
 +
Restart services
 +
 
 +
$ sudo rc-service wpa_supplicant restart
 +
$ sudo rc-service networking start
 +
 
 +
=== WiFi on mainline ===
 +
 
 +
To get WiFi working on the mainline kernel install {{aport|linux-firmware-brcm}}, then on the device copy <code>nvram_net.txt</code> like this:
 +
 
 +
# cp /lib/firmware/postmarketos/nvram_net.txt /lib/firmware/brcm/brcmfmac4334-sdio.txt
 +
 
 +
Afterwards reboot the device and connect to a WiFi network with NetworkManager or wpa_supplicant.
 +
 
 +
== Mainline Kernel ==
 +
 
 +
Thanks in large part to the [http://blog.forkwhiletrue.me/pages/midas-mainline/ Midas on Mainline] work that was done a few years ago, we now have initial mainline support for this device. The pmOS patch that added initial support is [https://gitlab.com/postmarketOS/pmaports/-/commit/0bab9b5f8a99b6e80cf5def6590d82e6d5dddc3d here].
 +
 
 +
The pmports repo for this device's linux-postmarketos-exynos4 mainline kernel is [https://gitlab.com/postmarketOS/pmaports/-/tree/master/main/linux-postmarketos-exynos4 here].
 +
 
 +
@pmOS_devices announcement from Nov 11, 2020: https://twitter.com/pmOS_devices/status/1326525105162293249
 +
 
 +
Upstream dts: [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/exynos4412-i9305.dts exynos4412-i9305.dts]
 +
 
 +
Blog announcement: https://postmarketos.org/blog/2020/11/06/postmarketOS-in-2020-11-part-1/#mainline-all-the-phones-and-tablets
 +
 
 +
Upstream kernel support matrix: [http://blog.forkwhiletrue.me/pages/midas-mainline/ Midas on Mainline].
 +
 
 +
Note that [https://github.com/fourkbomb/linux/commit/2a6027178ae40c1d3baa965fe21b19cbf09493ce a patch is required] to make it work with the stock samsung bootloader and this is included in the pmports mainline repo above.
 +
 
 +
forkbomb from LineageOS got mainline u-boot running on this device and wrote about it in this blog post:
 +
[https://blog.forkwhiletrue.me/posts/an-almost-fully-libre-galaxy-s3/]
 +
 
 +
Replicant has this device booting with mainline Linux and almost mainline U-Boot with only the need for a few patches on top and would like to collaborate with us [https://github.com/postmarketOS/pmbootstrap/pull/1219#issuecomment-395876420]
 +
 
 +
The Qualcomm Gobi MDM9615 Modem seems to have mainline kernel support as well: [https://redmine.replicant.us/projects/replicant/wiki/GalaxyS3I9305#Hardware-table]
 +
 
 +
The Replicant project is working on getting the i9300 modem working with a mainline kernel in a way that pmOS can also utilize: https://redmine.replicant.us/issues/1954 https://git.replicant.us/contrib/GNUtoo/kernel_replicant_linux/log/?h=replicant-11-i9300-modem
 +
 
 +
LTE modem support with the mainline kernel on Replicant is being done here: https://redmine.replicant.us/issues/2206 The Note II discussed here has the same or very similar modem as the i9305.
 +
 
 +
Replicant and LineageOS successfully got the Lima driver for Mesa working on Mali when using mainline linux: [http://www.belg.in/replicant_9.webm video] [https://github.com/CustomROMs/android_local_manifests_i9300/issues/1#issuecomment-532308101 success announcement] linux-postmarketos-exynos4 now also has the same support.
 +
 
 +
Replicant currently supports this device [https://redmine.replicant.us/projects/replicant/wiki/GalaxyS3I9300 in 6.0] and is doing a lot of research in order to get it running with [https://redmine.replicant.us/projects/replicant/wiki/Upstream a mainline kernel with a mainline bootloader] for Replicant 11. [https://redmine.replicant.us/projects/replicant/wiki/Exynos4Bootrom More bootloader research is here.]
 +
 
 +
[https://github.com/xboot/xboot/tree/b71fe8174882277897649bfe2177bf3ca300af69/src/arch/arm32/mach-exynos4412 xboot] might be a completely free bootloader option. Looks to have zero proprietary blobs.
  
<source lang="shell">$ ./pmbootstrap.py flasher flash_kernel</source>
+
== See also ==
 +
* {{wikipedia|Samsung_Galaxy_S_III|Wikipedia}}
 +
* {{Device package|samsung-i9300}}
 +
* {{Kernel package|samsung-i9300}}
  
== Wifi ==  
+
=== Install with mainline kernel (WIP, not functional yet) ===
  
== Photos ==
+
Note: Is now "linux-postmarketos-exynos4" .
  
== Links ==
+
<source lang="bash">
 +
#Export image files in ~/.local/var/pmbootstrap/chroot_rootfs_samsung-i9305/boot/
 +
pmbootstrap export
 +
 
 +
#5,3M -rw-r--r--  1 root root 5,3M déc.  22 20:31 boot.img-samsung-i9305 (initramfs + vmlinuz)
 +
#1,3M -rw-r--r--  1 root root 1,3M déc.  22 20:31 initramfs-samsung-i9305
 +
#6,1M -rw-r--r--  1 root root 6,1M déc.  22 20:31 initramfs-samsung-i9305-extra
 +
#4,1M -rw-r--r--  1 root root 4,1M nov.  5 17:30 vmlinuz-samsung-i9305
 +
 
 +
#Get linux-next
 +
cd ~/code
 +
# Case 1 : first checkout
 +
git clone https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git linux
 +
cd linux/
 +
git fetch origin
 +
git reset --hard origin/master
 +
# Case 2 : update
 +
cd linux/
 +
git checkout master
 +
git pull
 +
 
 +
#Prepare compile with i9305 defconfig in ~/code/linux/arch/arm/configs
 +
source ~/code/pmbootstrap/helpers/envkernel.sh
 +
make exynos_defconfig
 +
#DTS : Note that ~/code/linux/arch/arm/boot/dts/exynos4412-i9305.dts already exists and should work
 +
#Makefile in ~/code/linux/arch/arm/boot/dts/ already contains this DTS
 +
 
 +
#Kernel compilation
 +
make -j5
 +
 
 +
#Prepare shell
 +
<code>
 +
pmbootstrap chroot -- apk add abootimg android-tools mkbootimg dtbtool findutils
 +
export DEVICE="$(pmbootstrap config device)"
 +
export WORK="$(pmbootstrap config work)"
 +
export TEMP="$WORK/chroot_native/tmp/mainline/"
 +
mkdir -p "$TEMP"
 +
 
 +
#Patch boot image
 +
cd ~/code/linux/.output/arch/arm/boot
 +
cat zImage dts/exynos4412-i9305.dtb > "$TEMP"/zImage-dtb
 +
cp "/tmp/postmarketOS-export/boot.img-$DEVICE" "$TEMP/boot.img"
 +
pmbootstrap chroot
 +
abootimg -u /tmp/mainline/boot.img  -k /tmp/mainline/zImage-dtb -c bootsize=8955904
 +
exit
 +
 
 +
#Flash with Heimdall - WARNING - NOT FUNCTIONNAL YET
 +
# enter download mode with down+home+power
 +
# Connect usb
 +
# click 'up'
 +
heimdall detect
 +
heimdall flash --BOOT ~/.local/var/pmbootstrap/chroot_native/tmp/mainline/boot.img
 +
</source>

Latest revision as of 15:18, 20 March 2021

Samsung Galaxy S III
Samsung Galaxy SIII
Samsung Galaxy SIII
Manufacturer Samsung
Name Galaxy S III
Codename samsung-i9300, samsung-i9305
Released 2012
Category testing
Original software Android 4.1.1
Hardware
Chipset Exynos 4412 Quad
CPU Quad-core 1.4 GHz Cortex-A9
GPU Mali-400MP4
Display 720x1280 Super AMOLED
Storage 16 GB/32 GB
Memory 1 GB(GT-i9300 & SHW-M440S)
2 GB(LTE Variants)
Architecture armv7
Features
USB Networking
Works
Flashing
Broken
Touchscreen
Works
Display
Works
WiFi
Works
Xwayland
Works
FDE
Works
Mainline
Works
Battery
3D Acceleration
Accelerometer
Audio
Bluetooth
Camera
GPS
Mobile data
SMS
Calls
USB OTG


Contributors

Basic info

So far, what works for samsung-i9305 (Galaxy SIII LTE version) also works for the samsung-i9300 (Galaxy SIII international GSM version without LTE, Also known as Galaxy S III 3G SHW-M440S in South Korea) and samsung-shv-e210s (a Korean variant). (None of these SIII models should be confused with the North American SIII models, which require OS builds.)

Code name is MIDAS. Search for midas-mainline to find more info.

Users owning this device

  • Arthurlutz (Notes: /e/ 0.11 (android 7 pie))
  • Cick0 (Notes: GT-i9300)
  • DALEK 77 (Notes: i9300)
  • Eloy
  • EnderNightLord (Notes: i9300 1gb ram)
  • Illen (Notes: is a GT-i9300. Battery is broken, works on charger. Runs mainline U-Boot/Linux.)
  • KuroeHanako (Notes: SHV-E210S, Pebble Blue)
  • Mossroy (Notes: sometimes used : It can not be flashed easily. Seems to have a hardware issue with current consumption, even with a new battery)
  • Neilvandyke (Notes: has GT-i9300)
  • Newbyte (Notes: i9300, seems to have died :()
  • Ungeskriptet (Notes: GT-i9300, Pebble Blue)


How to enter flash mode

  • Hold power + Home + volume down
  • When prompted, release all buttons and press volume up

Installation

Set phone to ODIN mode

 1. Turn off phone
 2. Connect USB cable
 3. Hold VOLUME_DOWN + HOME + POWER until you get Warning!! screen
 4. Push VOLUME_UP to continue to ODIN mode screen
# Ready the build
pmbootstrap init # (weston or xfce4 should do)

# Install rootfs to Micro SD Card
pmbootstrap install --sdcard=/dev/mmcblk0/1/2/3 # (will depend on where your Micro SD Card is mounted)

# Put the i9305 / i9300 into odin mode with the steps above and flash the kernel (to boot from the Micro SD Card)
pmbootstrap flasher flash_kernel # (in odin mode)

# and it should reboot automatically

Installing with downstream kernel

#FIRST PMBOOTSTRAP INSTALL
mkdir ~/code
cd ~/code
git clone https://gitlab.com/postmarketOS/pmbootstrap.git

#CONFIG PMBOOTSTRAP
alias pmbootstrap=~/code/pmbootstrap/pmbootstrap.py
pmbootstrap init
#work path default
#samsung
#i9305
#n
#wathever
#weston
#n
#none
#y
#samsung-i9305
#y

#FOR DEBUGGING (NOT REQUIRED)
pmbootstrap initfs hook_add debug-shell
#Check log with 'tail -f ~/.local/var/pmbootstrap/log.txt'

#CREATE RECOVERY ZIP (for flashing with TWRP)
pmbootstrap install --android-recovery-zip

#COPY ON SDCARD
cp ~/.local/var/pmbootstrap/chroot_buildroot_armhf/var/lib/postmarketos-android-recovery-installer/pmos-samsung-i9305.zip /media/computer/sdcard/
#Insert sdcard in phone
#Reboot on recovery with up+home+power
#Install from zip
#Reboot

#IF BOOT STANDBY (DEBUG)
#Connect with USB cable
telnet 172.16.42.1
pmos_continue_boot

WiFi

To get the WiFi working, you'll need to modify the wpa_supplicant configuration. If this is not done, wpa_supplicant starts with -ip2p0 which is not supported on our device.

 $ echo 'wpa_supplicant_args="-Dwext"' | sudo tee /etc/conf.d/wpa_supplicant

You can use either NetworkManager or networking and wpa_supplicant. NetworkManager is recommend in most cases as it handles reconnection.

Network Manager

Ensure the networkmanger service is running

 $ sudo rc-status | grep 'networkmanager'

if it not visible, try to start the service:

 $ sudo rc-service networkmanager start

Search for available WiFi networks and connect to network

 $ sudo nmcli device wifi list ifname wlan0
 $ sudo nmcli --ask dev wifi connect SSID

Reboot and you should be connected.

Networking and wpa_supplicant

You will need to manually configure the interfaces by creating

/etc/network/interfaces

e.g.,

 $ sudo vi /etc/network/interfaces
  auto lo
  iface lo inet loopback
  auto wlan0
  iface wlan0 inet dhcp
  

Save changes and add networking to start with system

$ sudo rc-update add networking

Add WiFi network information

$ wpa_passphrase YOUR_SSID YOUR_PASSPHRASE | sudo tee /etc/wpa_supplicant/wpa_supplicant.conf

Restart services

$ sudo rc-service wpa_supplicant restart
$ sudo rc-service networking start

WiFi on mainline

To get WiFi working on the mainline kernel install linux-firmware-brcm, then on the device copy nvram_net.txt like this:

# cp /lib/firmware/postmarketos/nvram_net.txt /lib/firmware/brcm/brcmfmac4334-sdio.txt

Afterwards reboot the device and connect to a WiFi network with NetworkManager or wpa_supplicant.

Mainline Kernel

Thanks in large part to the Midas on Mainline work that was done a few years ago, we now have initial mainline support for this device. The pmOS patch that added initial support is here.

The pmports repo for this device's linux-postmarketos-exynos4 mainline kernel is here.

@pmOS_devices announcement from Nov 11, 2020: https://twitter.com/pmOS_devices/status/1326525105162293249

Upstream dts: exynos4412-i9305.dts

Blog announcement: https://postmarketos.org/blog/2020/11/06/postmarketOS-in-2020-11-part-1/#mainline-all-the-phones-and-tablets

Upstream kernel support matrix: Midas on Mainline.

Note that a patch is required to make it work with the stock samsung bootloader and this is included in the pmports mainline repo above.

forkbomb from LineageOS got mainline u-boot running on this device and wrote about it in this blog post: [1]

Replicant has this device booting with mainline Linux and almost mainline U-Boot with only the need for a few patches on top and would like to collaborate with us [2]

The Qualcomm Gobi MDM9615 Modem seems to have mainline kernel support as well: [3]

The Replicant project is working on getting the i9300 modem working with a mainline kernel in a way that pmOS can also utilize: https://redmine.replicant.us/issues/1954 https://git.replicant.us/contrib/GNUtoo/kernel_replicant_linux/log/?h=replicant-11-i9300-modem

LTE modem support with the mainline kernel on Replicant is being done here: https://redmine.replicant.us/issues/2206 The Note II discussed here has the same or very similar modem as the i9305.

Replicant and LineageOS successfully got the Lima driver for Mesa working on Mali when using mainline linux: video success announcement linux-postmarketos-exynos4 now also has the same support.

Replicant currently supports this device in 6.0 and is doing a lot of research in order to get it running with a mainline kernel with a mainline bootloader for Replicant 11. More bootloader research is here.

xboot might be a completely free bootloader option. Looks to have zero proprietary blobs.

See also

Install with mainline kernel (WIP, not functional yet)

Note: Is now "linux-postmarketos-exynos4" .

#Export image files in ~/.local/var/pmbootstrap/chroot_rootfs_samsung-i9305/boot/
pmbootstrap export

#5,3M -rw-r--r--  1 root root 5,3M déc.  22 20:31 boot.img-samsung-i9305 (initramfs + vmlinuz)
#1,3M -rw-r--r--  1 root root 1,3M déc.  22 20:31 initramfs-samsung-i9305
#6,1M -rw-r--r--  1 root root 6,1M déc.  22 20:31 initramfs-samsung-i9305-extra
#4,1M -rw-r--r--  1 root root 4,1M nov.   5 17:30 vmlinuz-samsung-i9305

#Get linux-next
cd ~/code
# Case 1 : first checkout
git clone https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git linux
cd linux/
git fetch origin
git reset --hard origin/master
# Case 2 : update
cd linux/
git checkout master
git pull

#Prepare compile with i9305 defconfig in ~/code/linux/arch/arm/configs
source ~/code/pmbootstrap/helpers/envkernel.sh
make exynos_defconfig
#DTS : Note that ~/code/linux/arch/arm/boot/dts/exynos4412-i9305.dts already exists and should work
#Makefile in ~/code/linux/arch/arm/boot/dts/ already contains this DTS

#Kernel compilation
make -j5

#Prepare shell
<code>
pmbootstrap chroot -- apk add abootimg android-tools mkbootimg dtbtool findutils
export DEVICE="$(pmbootstrap config device)"
export WORK="$(pmbootstrap config work)"
export TEMP="$WORK/chroot_native/tmp/mainline/"
mkdir -p "$TEMP"

#Patch boot image
cd ~/code/linux/.output/arch/arm/boot
cat zImage dts/exynos4412-i9305.dtb > "$TEMP"/zImage-dtb
cp "/tmp/postmarketOS-export/boot.img-$DEVICE" "$TEMP/boot.img"
pmbootstrap chroot
abootimg -u /tmp/mainline/boot.img  -k /tmp/mainline/zImage-dtb -c bootsize=8955904
exit

#Flash with Heimdall - WARNING - NOT FUNCTIONNAL YET
# enter download mode with down+home+power
# Connect usb
# click 'up'
heimdall detect
heimdall flash --BOOT ~/.local/var/pmbootstrap/chroot_native/tmp/mainline/boot.img