LG G2 Korean (lg-f320)

== Contributors ==
* HexagonWin
== Maintainer(s) ==
HexagonWin
== Users owning this device ==
== How to enter flash mode ==
For fastboot, this needs lg's proprietary download mode to be removed.
Please see LG G3 Europe device's wiki document for details.
After that, it can be ran by turning off device, connecting via usb cable to a computer or a charger, and clicking power and volume up simultaneousely and a bit waiting like that.
For recovery, do the same as above but disconnect usb cable.
== LG Verification fail error ==
LG's bootloader has a bad thing : Some verification.
you can use openbump, same as in LG G3 Europe device's wiki document. 
== Installation ==
Fastboot installation works well, but sometimes fail for an unknown reason.
Micro SD Card slot installation works well. You can also dualboot with android by installing pmOS on the micro sd card, and flashing pmOS and Android to each Recovery partition and the android boot partition.
Recovery zip installation was the most stable
== Problems ==
This device is not upstreamed yet, as I (HexagonWin) is being very busy. 
Because of LG's bootloader's verification things, it is a bit hard to load a boot image after making it, and needs open bump once.
== Mainline? ==
This device has MSM8974, it can be mainlined. The Google Nexus 5 (lg-hammerhead) is really similar to this device. 
20210703. I tried mainlining. No USB, no display, no everything, except that I know it boots. I don't have a UART, but with a kernel panic init script, the kernel panicks and reboot. And without it it just stays in manufacturer screen/fastboot log screen and doesn't panic.
For a future me : Here's the commands I used to create a boot.img with a mainline kernel. Although it is unclear if it actually booted, it was accepted by the stock bootloader. (Note : PMBootstrap is installed in /mnt/seagate/pmos/pmbootstrap/ and Linux Source Tree is in /mnt/seagate/pmos/linux/.
# Previousely, you have to put the F320 dts and do pmbootstrap install, pmbootstrap export!
# Envkernel.sh
source /mnt/seagate/pmos/pmbootstrap/helpers/envkernel.sh
cd /mnt/seagate/pmos/linux/
make clean
make qcom_defconfig
make -j12
pmbootstrap chroot -- apk add abootimg android-tools mkbootimg dtbtool
export DEVICE="$(pmbootstrap config device)"
export WORK="$(pmbootstrap config work)"
export TEMP="$WORK/chroot_native/tmp/mainline/"
mkdir -p "$TEMP"
cd /mnt/seagate/pmos/linux/.output/arch/arm/boot
cat zImage dts/qcom-msm8974-lge-f320.dtb > /mnt/seagate/pmos/linux/.zImage-dtb
cp /mnt/seagate/pmos/linux/.zImage-dtb "$TEMP"/zImage-dtb
cp /mnt/seagate/pmos/linux/.output/arch/arm/boot/zImage "$TEMP"/zImage
cp "/tmp/postmarketOS-export/boot.img-$DEVICE" "$TEMP/boot.img"
cp "/tmp/postmarketOS-export/initramfs-$DEVICE" "$TEMP/initramfs"
pmbootstrap chroot -- mkbootimg-osm0sis \
--kernel "/tmp/mainline/zImage-dtb" \
--ramdisk "/tmp/mainline/initramfs" \
--base "0x00000000" \
--second_offset "0x00f00000" \
--cmdline "console=ttyMSM0,115200,n8" \
--kernel_offset "0x00008000" \
--ramdisk_offset "0x05000000" \
--tags_offset "0x04800000" \
--pagesize "2048" \
--header_version "1" \
-o "/tmp/mainline/mlboot.img"
pmbootstrap chroot -- fastboot boot /tmp/mainline/mlboot.img
# If command above ^^^^ doesn't work
fastboot boot $(pmbootstrap config work)/chroot_native/tmp/mainline/mlboot.img
== UART ==
The UART method seems to be also same as the Nexus 5, it seems like it is using the 3.5 audio port. However, this is not yet tried.
This UART method also seems to be same for LG-D802 and/or other LG-D80* variants. This information is from a trusty manual from a secret source. 
== Parts ==
Please refer to this : http://www.deviceinfohw.ru/devices/item.php?item=373245
Note : Although it is named D802 in the page, it is because the Android OS that runs in it is for D802 (The international version), and the kernel is edited to work for this device F320.
== See also ==