Dobrica Pavlinušić's random unstructured stuff
Galaxy Nexus i9250: Revision 22
Schematics and service manual for i9250: {file: Samsung_i9250_schem_sm.rar}

{toc: }

.pre
127|root@maguro:/ # cat /proc/cpuinfo
Processor : ARMv7 Processor rev 10 (v7l)
processor : 0
BogoMIPS : 1194.24

processor : 1
BogoMIPS : 1194.24

Features : swp half thumb fastmult vfp edsp thumbee neon vfpv3
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x2
CPU part : 0xc09
CPU revision : 10

Hardware : Tuna
Revision : 0009
Serial : 014994b30201c013
.pre

^ BLE

* https://github.com/metc/galaxy-nexus-ble

^ GSM modem over serial port

* https://github.com/2b-as/xgoldmon

^ HID keyboard

* https://github.com/pelya/android-keyboard-gadget

^ Unlegacy Android

ASOP for OMAP4 devices:

https://forum.xda-developers.com/galaxy-nexus/development/rom-omap4-aosp-project-t3334574

https://github.com/Unlegacy-Android/

^^ kernel

http://unlegacy-android.cf/

https://github.com/Unlegacy-Android/android_kernel_samsung_tuna

.pre
dpavlin@klin:/virtual/android/galaxy-nexus$ git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/

dpavlin@klin:/virtual/android/galaxy-nexus/omap$ git checkout -b asop-7.1 unlegacy/aosp-7.1

dpavlin@klin:/virtual/android/galaxy-nexus/omap$ make tuna_defconfig ARCH=arm

dpavlin@klin:/virtual/android/galaxy-nexus/omap$ cp include/linux/compiler-gcc4.h include/linux/compiler-gcc5.h


dpavlin@klin:/virtual/android/galaxy-nexus/omap$ make -j9 ARCH=arm CROSS_COMPILE=arm-none-eabi-
.pre

^ Links

Somewhat interesting things that I can take a look at some time in the future:

* https://github.com/swetland/omap4boot

^ Odin

* http://glassechidna.com.au/heimdall/

^ serial

* https://wiki.postmarketos.org/wiki/Serial_debugging#USB_debug_cable

{image: Nexus-usb-debug.png}

| Device | Codename | Resistor (R3) | Connected VCC |
| Google Galaxy Nexus (GSM) | samsung-maguro | 619K ohm | No |
| Samsung Galaxy Mini 2 | samsung-s6500d | 530K ohm | No |
| Samsung Galaxy S4 Mini LTE | samsung-i9195 | 619K ohm | No |
| Samsung Galaxy S5 | samsung-klte | 619K ohm | No |

It seems that other suggestion is 150k from https://redmine.replicant.us/projects/replicant/wiki/SamsungSerial - I will have to test which value works

^ UART modes

* https://wiki.postmarketos.org/wiki/Micro-USB_Interface_Controller

| Resistance | Jig | Boot |
| 150k | Inactive | Inactive |
| 523k | Active | Inactive |
| 619k | Active | Active |

.pre
RID_USB_OTG_MODE, /* 0 0 0 0 0 GND USB OTG Mode */
RID_AUD_SEND_END_BTN, /* 0 0 0 0 1 2K Audio Send_End Button*/
RID_AUD_REMOTE_S1_BTN, /* 0 0 0 1 0 2.604K Audio Remote S1 Button */
RID_AUD_REMOTE_S2_BTN, /* 0 0 0 1 1 3.208K Audio Remote S2 Button */
RID_AUD_REMOTE_S3_BTN, /* 0 0 1 0 0 4.014K Audio Remote S3 Button */
RID_AUD_REMOTE_S4_BTN, /* 0 0 1 0 1 4.82K Audio Remote S4 Button */
RID_AUD_REMOTE_S5_BTN, /* 0 0 1 1 0 6.03K Audio Remote S5 Button */
RID_AUD_REMOTE_S6_BTN, /* 0 0 1 1 1 8.03K Audio Remote S6 Button */
RID_AUD_REMOTE_S7_BTN, /* 0 1 0 0 0 10.03K Audio Remote S7 Button */
RID_AUD_REMOTE_S8_BTN, /* 0 1 0 0 1 12.03K Audio Remote S8 Button */
RID_AUD_REMOTE_S9_BTN, /* 0 1 0 1 0 14.46K Audio Remote S9 Button */
RID_AUD_REMOTE_S10_BTN, /* 0 1 0 1 1 17.26K Audio Remote S10 Button */
RID_AUD_REMOTE_S11_BTN, /* 0 1 1 0 0 20.5K Audio Remote S11 Button */
RID_AUD_REMOTE_S12_BTN, /* 0 1 1 0 1 24.07K Audio Remote S12 Button */
RID_RESERVED_1, /* 0 1 1 1 0 28.7K Reserved Accessory #1 */
RID_RESERVED_2, /* 0 1 1 1 1 34K Reserved Accessory #2 */
RID_RESERVED_3, /* 1 0 0 0 0 40.2K Reserved Accessory #3 */
RID_RESERVED_4, /* 1 0 0 0 1 49.9K Reserved Accessory #4 */
RID_RESERVED_5, /* 1 0 0 1 0 64.9K Reserved Accessory #5 */
RID_AUD_DEV_TY_2, /* 1 0 0 1 1 80.07K Audio Device Type 2 */
RID_PHONE_PWD_DEV, /* 1 0 1 0 0 102K Phone Powered Device */
RID_TTY_CONVERTER, /* 1 0 1 0 1 121K TTY Converter */
RID_UART_CABLE, /* 1 0 1 1 0 150K UART Cable */
RID_CEA936A_TY_1, /* 1 0 1 1 1 200K CEA936A Type-1 Charger(1) */
RID_FM_BOOT_OFF_USB, /* 1 1 0 0 0 255K Factory Mode Boot OFF-USB */
RID_FM_BOOT_ON_USB, /* 1 1 0 0 1 301K Factory Mode Boot ON-USB */
RID_AUD_VDO_CABLE, /* 1 1 0 1 0 365K Audio/Video Cable */
RID_CEA936A_TY_2, /* 1 1 0 1 1 442K CEA936A Type-2 Charger(1) */
RID_FM_BOOT_OFF_UART, /* 1 1 1 0 0 523K Factory Mode Boot OFF-UART */
RID_FM_BOOT_ON_UART, /* 1 1 1 0 1 619K Factory Mode Boot ON-UART */
RID_AUD_DEV_TY_1_REMOTE, /* 1 1 1 1 0 1000.07K Audio Device Type 1 with Remote(1) */
RID_AUD_DEV_TY_1_SEND = RID_AUD_DEV_TY_1_REMOTE , /* 1 1 1 1 0 1002K Audio Device Type 1 / Only Send-End(2) */
RID_USB_MODE, /* 1 1 1 1 1 Open USB Mode, Dedicated Charger or Accessory Detach */
.pre

^ PostmarketOS

.pre
dpavlin@nuc:/nuc/pmbootstrap$ ./pmbootstrap.py install --no-fde
[17:54:17] *** (1/5) PREPARE NATIVE CHROOT ***
[17:54:18] *** (2/5) CREATE DEVICE ROOTFS ("samsung-maguro") ***
[17:54:23] (rootfs_samsung-maguro) install
[17:54:27] (rootfs_samsung-maguro) install
[17:54:30] (rootfs_samsung-maguro) write /etc/os-release
[17:54:30] (rootfs_samsung-maguro) mkinitfs samsung-maguro
[17:54:34] *** SET LOGIN PASSWORD FOR: 'dpavlin' ***
New password:
Retype new password:
passwd: password updated successfully
[17:54:43] NOTE: No valid keymap specified for device
[17:54:46] *** (3/5) PREPARE INSTALL BLOCKDEVICE ***
[17:54:47] (native) create samsung-maguro.img (361M)
[17:54:47] (native) mount /dev/install (samsung-maguro.img)
[17:54:47] (native) partition /dev/install (boot: 31M, root: the rest)
[17:54:47] (native) format /dev/installp2
[17:54:48] (native) mount /dev/installp2 to /mnt/install
[Tue Sep 25 17:55:21 2018] EXT4-fs (loop0p2): mounted filesystem with ordered data mode. Opts: (null)
[17:54:48] (native) format /dev/installp1 (boot, ext2), mount to /mnt/install/boot
[Tue Sep 25 17:55:21 2018] EXT4-fs (loop0p1): mounting ext2 file system using the ext4 subsystem
[Tue Sep 25 17:55:21 2018] EXT4-fs (loop0p1): mounted filesystem without journal. Opts: (null)
[17:54:48] *** (4/5) FILL INSTALL BLOCKDEVICE ***
[17:54:48] (native) copy rootfs_samsung-maguro to /mnt/install/
[17:54:53] *** (5/5) FLASHING TO DEVICE ***
[17:54:53] Run the following to flash your installation to the target device:
[17:54:53] * pmbootstrap flasher flash_rootfs
[17:54:53] Flashes the generated rootfs image to your device:
[17:54:53] /nuc/pmbootstrap-work/chroot_native/home/pmos/rootfs/samsung-maguro.img
[17:54:53] (NOTE: This file has a partition table, which contains /boot and / subpartitions. That way we don't need to change the partition layout on your device.)
[17:54:53] * pmbootstrap flasher flash_kernel
[17:54:53] Flashes the kernel + initramfs to your device:
[17:54:53] /nuc/pmbootstrap-work/chroot_rootfs_samsung-maguro/boot
[17:54:53] (NOTE: fastboot also supports booting the kernel/initramfs directly without flashing. Use 'pmbootstrap flasher boot' to do that.)
[17:54:53] * If the above steps do not work, you can also create symlinks to the generated files with 'pmbootstrap export' and flash outside of pmbootstrap.
[17:54:53] NOTE: chroot is still active (use 'pmbootstrap shutdown' as necessary)
[17:54:53] Done

dpavlin@nuc:/nuc/pmbootstrap$ alias pmbootstrap=/nuc/pmbootstrap/pmbootstrap.py
dpavlin@nuc:/nuc/pmbootstrap$ pmbootstrap flasher flash_rootfs
[17:57:10] (native) flash rootfs image
< waiting for any device >
[Tue Sep 25 17:59:17 2018] usb 2-3.1: new high-speed USB device number 22 using xhci_hcd
[Tue Sep 25 17:59:17 2018] usb 2-3.1: New USB device found, idVendor=18d1, idProduct=4e30, bcdDevice= 1.00
[Tue Sep 25 17:59:17 2018] usb 2-3.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[Tue Sep 25 17:59:17 2018] usb 2-3.1: Product: Android 1.0
[Tue Sep 25 17:59:17 2018] usb 2-3.1: Manufacturer: Google, Inc
[Tue Sep 25 17:59:17 2018] usb 2-3.1: SerialNumber: 014994B00C01A013
target didn't report max-download-size
Erasing 'system'...
OKAY [ 0.047s]
Sending 'system' (369664 KB)...
OKAY [ 50.498s]
Writing 'system'...
OKAY [ 26.436s]
Finished. Total time: 77.024s
[18:00:02] NOTE: chroot is still active (use 'pmbootstrap shutdown' as necessary)
[18:00:02] Done
dpavlin@nuc:/nuc/pmbootstrap$ [Tue Sep 25 19:24:27 2018] usb 2-3.1: USB disconnect, device number 22
[Tue Sep 25 19:24:27 2018] usb 2-3.1: new high-speed USB device number 23 using xhci_hcd
[Tue Sep 25 19:24:27 2018] usb 2-3.1: unable to get BOS descriptor
[Tue Sep 25 19:24:27 2018] usb 2-3.1: New USB device found, idVendor=0451, idProduct=d010, bcdDevice= 0.00
[Tue Sep 25 19:24:27 2018] usb 2-3.1: New USB device strings: Mfr=33, Product=37, SerialNumber=0
[Tue Sep 25 19:24:27 2018] usb 2-3.1: Product: OMAP4440
[Tue Sep 25 19:24:27 2018] usb 2-3.1: Manufacturer: Texas Instruments
[Tue Sep 25 19:24:30 2018] usb 2-3.1: USB disconnect, device number 23
.pre