Jump to content

Samsung Galaxy S Advance (samsung-janice): Difference between revisions

From postmarketOS Wiki
StandaSK (talk | contribs)
m Fix device & kernel package links
Knuxify (talk | contribs)
m gitlab.com -> gitlab.postmarketos.org (bot edit)
 
(43 intermediate revisions by 13 users not shown)
Line 2: Line 2:
| manufacturer = Samsung
| manufacturer = Samsung
| name = Galaxy S Advance
| name = Galaxy S Advance
| codename = samsung-i9070
| codename = samsung-janice
| image = File:Samsung Galaxy S Advance weston demo.jpg
| model = GT-I9070
| imagecaption = Samsung Galaxy S Advance running Weston demos
| image = File:samsung-janice-phosh.jpg
| imagecaption = Samsung Galaxy S Advance running Phosh under PostmarketOS
| releaseyear = 2012
| releaseyear = 2012
| originalsoftware = Android 2.3.6 on Linux 2.6.35
| originalsoftware = Android
| chipset = [[ST-Ericsson NovaThor U8500]]
| originalversion = 2.3.6 (Linux 2.6.35)
| chipset = ST-Ericsson NovaThor U8500
| cpu = Dual-core 1.0 GHz Cortex-A9
| cpu = Dual-core 1.0 GHz Cortex-A9
| gpu = Mali-400
| gpu = Mali-400
Line 13: Line 15:
| display = 480x800 AMOLED
| display = 480x800 AMOLED
| memory = 768 MB
| memory = 768 MB
| architecture = armhf
| architecture = armv7
| type = handset
| status_usbnet = Y
| status_usbnet = Y
| status_flashing = Y
| status_flashing = Y
Line 20: Line 23:
| status_wifi = Y
| status_wifi = Y
| status_xwayland = Y
| status_xwayland = Y
| status_fde = Y
| status_fde =
| status_mainline =  
| status_mainline = Y
| status_battery = Y
| status_battery = Y
| status_3d =  
| status_3d = Y
| status_accel =  
| status_accel = Y
| status_audio =  
| status_magnet = Y
| status_bluetooth =
| status_light = Y
| status_camera =
| status_proximity = Y
| status_gps =  
| status_hall = -
| status_mobiledata =  
| status_barometer = -
| status_sms =  
| status_powersensor = -
| status_calls =  
| status_cameraflash = Y
| status_keyboard = -
| status_touchpad = -
| status_usba = -
| status_hdmidp = -
| status_irtx = -
| status_irrx = -
| status_stylus = -
| status_haptics = Y
| status_ethernet = -
| status_audio = N
| status_bluetooth = P
| status_camera = N
| status_gps = N
| status_mobiledata = N
| status_sms = N
| status_calls = N
| status_nfc = Y
| booting = yes
| booting = yes
| status_otg = <!-- Is it possible to connect USB-OTG devices via an adapter? -->
| status_fossbootloader = Y
| status_uboot = yes
| status_uboot_primary = N
| status_uboot_secondary = Y
| status_uboot_mainline = Y
| status_uboot_internalstorage = Y
| status_uboot_sd =
| status_uboot_usbhost = Y
| status_uboot_usbperipheral = Y
| status_uboot_screen = Y
| status_uboot_keyboard = -
| status_uboot_buttons = Y
}}
}}
{{Based on SoC|ST-Ericsson NovaThor U8500|ST-Ericsson U8500}}
=== Contributors ===
=== Contributors ===
* drebrez
* drebrez


=== What works ===
== Installation ==
 
The mainline kernel can only be booted through U-Boot, not directly with the Samsung bootloader. U-Boot is installed as intermediate bootloader on the boot partition, so it does not replace the Samsung bootloader entirely. pmbootstrap can only support one bootloader configuration at the moment, which is why U-Boot is also recommended when installing the downstream kernel.
* Compiling the kernel
* Flashing with heimdall (see below)
* Booting initramfs
* Network through USB
* SSH
* Weston with touchscreen
* Wifi (Details below and in [https://github.com/postmarketOS/pmbootstrap/pull/138 #138])


=== What does not work ===
Boot into Download Mode using {{Button|Power}} + {{Button|Volume Down}} + {{Button|Home}} and follow follow the [[ST-Ericsson_NovaThor_U8500#U-Boot_on_Samsung_NovaThor_U8500_Devices|the NovaThor U8500 U-Boot installation instructions]] to install U-Boot.


* Unknown, but probably everything else
Finally, just follow the [[Installation guide]].


=== Boot process ===
== Variants ==


Unlike most other Android devices, the i9070 can not boot a <code>boot.img</code> (which consists of <code>kernel</code> + <code>initramfs</code>). Instead, the <code>boot.img</code> file is just a regular kernel.
A few different variants of this device were produced by Samsung, all named Samsung Galaxy S Advance but with different model codes. At least one of them has hardware differences.


However, it is possible to directly integrate a <code>initramfs</code> into the kernel at kernel compile time (this is totally different from the boot.img approach, if this is unclear to you, please ask in the channel), and this is what the Android ROMs do on the i9070. While it is not a big deal in the Android compilation process, it is a problem for postmarketOS, because we want to be able to build the <code>initramfs</code> independently from the kernel.
{| class="wikitable"
|+ Samsung Galaxy S Advance GT-I9070 variants
|-
! Model !! Features !! Notes
|-
| GT-I9070 || || Vanilla
|-
| GT-I9070chn || || Targeted for the chinese market
|-
| GT-I9070P || [[NFC]] || Test with <tt>nfctool -d nfc0 -1 -p</tt>
|-
|}


The following workaround is currently implemented:
=== Bluetooth ===
Bluetooth does not have any Bluetooth device address (bdaddr or "MAC address") set after boot at the moment. To make Bluetooth work, you need to manually configure one:


* We flash the ''real'' initramfs to the kernel2 partition (this partition usually contains a backup of the stock kernel)
# apk add bluez-btmgmt
* The initramfs [https://github.com/postmarketOS/pmbootstrap/blob/master/aports/device/linux-samsung-i9070/init init script built into the kernel] checks if the kernel2 partition contains a compressed initramfs, and if it does, it extracts it and passes execution to the real initramfs init script.
# btmgmt public-addr <bdaddr>
* This idea is based on something called [https://forum.xda-developers.com/galaxy-s2/orig-development/isorec-isolated-recovery-galaxy-s2-t3291176 &quot;isorec&quot;].


=== Device partitions ===
where <code><bdaddr></code> is a MAC address like <code>53:33:6d:69:6e:69</code>.


The following partitions are used for the postmarketOS:
The Bluetooth controller should then show up in <code>bluetoothctl</code>:


* Kernel =&gt; /dev/mmcblk0p15 (16MB)
# apk add bluez
* Kernel2 =&gt; /dev/mmcblk0p17 (16MB)
# rc-service bluetooth start
$ bluetoothctl


Possible partitions for the postmarketOS system image:
You can e.g scan for devices:


* SYSTEM =&gt; /dev/mmcblk0p3 (600MB)
[bluetooth]# show
* DATAFS =&gt; /dev/mmcblk0p5 (2GB)
[bluetooth]# power on
[bluetooth]# advertise on
[bluetooth]# system-alias golden
[bluetooth]# scan on


=== Flashing with heimdall ===
==Sensors==


In order to flash the kernel and the initramfs using <code>heimdall</code> you simply have to call <code>pmbootstrap flasher flash_kernel</code>
* Bosch BMA222 accelerometer
* Yamaha YAS530 [[magnetometer]]
* Sharp GP2AP002A00F proxomity and light sensor


This will write in the partitions specified in the [https://github.com/postmarketOS/pmbootstrap/blob/master/aports/device/device-samsung-i9070/deviceinfo#L18-L19 deviceinfo] file.
The accelerometer does work albeit it needs polling. iio-sensor-proxy does the right thing as can be confirmed at the command line:


At the moment is not possible to write the system image file (samsung-i9070.img) using heimdall. A temporary solution is to use the TWRP shell to perform a command like this:<br />
# monitor-sensor
<code>dd if=samsung-i9070.img of=/dev/mmcblk0p5</code>
Accelerometer orientation changed: bottom-up
 
Accelerometer orientation changed: right-up
=== How drebrez made wifi work ===
Accelerometer orientation changed: bottom-up
 
Accelerometer orientation changed: left-up
* build the kernel module (dhd.ko for the i9070)
Accelerometer orientation changed: normal
* get the vendor files for the [https://github.com/Epirex/android_vendor_samsung_u8500 Samsung U8500 devices]
Accelerometer orientation changed: right-up
* load the module using insmod with the firmware_path and nvram_path parameters
Accelerometer orientation changed: bottom-up


<code>insmod dhd.ko firmware_path=/etc/wifi/bcmdhd_sta.bin nvram_path=/etc/wifi/nvram_net.txt</code>
To test the sensors using iio_generic_buffer you first have to create a hrtimer trigger like this:


* set a mac address
# mkdir /sys/kernel/config/iio/triggers/hrtimer/instance1


<code>ifconfig wlan0 hw ether 01:02:03:04:05:06</code>
Then you can use this to poll values from the accelerometer or magnetometer like this:


* bring the interface up
# iio_generic_buffer -a -c 10 -n bma222 -t instance1
# iio_generic_buffer -a -c 10 -n yas530 -t instance1


<code>ifconfig wlan0 up</code>
The Light sensor can be read directly in sysfs:


* scan to find out what WiFi networks are detected
# cd /sys/bus/iio/devices/iio:device4/
# cat in_illuminance_raw


<code>iw dev wlan0 scan</code>
Look at proximity events like this:


* connect to WPA/WPA2 WiFi network
# echo 1 > events/in_proximity_thresh_either_en
# iio_event_monitor -a gp2ap002


<code>wpa_passphrase wifi_ssid wifi_key &gt;&gt; /etc/wpa_supplicant.conf</code>
Some udev hwdb updates might be needed for all devices to work properly with iio-sensor-proxy.


* start wpa_supplicant to connect to the network
==NFC==


<code>wpa_supplicant -B -D wext -i wlan0 -c /etc/wpa_supplicant.conf</code>
The NFC chip is a PNX544 and it is only mounted on the GT-I9070P version of Janice. To use [[NFC]] the back plate of the phone ''must'' be mounted, because the NFC antenna is in the back plate.


* verify that you are indeed connected to the SSID
Test NFC with:


<code>iw wlan0 link</code>
# nfctool -d nfc0 -1 -p


* start udhcpc to get an ip address
And place an NFC card on the back of the phone.


<code>udhcpc -b -i wlan0</code>


=== Links ===
=== Links ===
 
* [https://gitlab.postmarketos.org/postmarketOS/pmaports/-/tree/master/device/testing/device-samsung-janice Device package]
* [https://gitlab.com/postmarketOS/pmaports/-/tree/master/device/testing/device-samsung-i9070 Device package]
* [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/st/ste-ux500-samsung-janice.dts Upstream devicetree] in Torvalds' kernel tree
* [https://gitlab.com/postmarketOS/pmaports/-/tree/master/device/testing/linux-samsung-i9070 Kernel package]
* [https://github.com/Epirex/Samsung_STE_Kernel/tree/marshmallow Epirex's Kernel]
* [https://github.com/Epirex/android_vendor_samsung_u8500 Epirex's vendor files]


=== Photos ===
=== Photos ===
* [https://i.imgur.com/MuVLljM.jpg Initramfs asking for the password via telnet]
* [https://i.imgur.com/MuVLljM.jpg Initramfs asking for the password via telnet]
* [https://i.imgur.com/maobRbj.jpg postmarketOS demo menu (XWayland)]
* [https://i.imgur.com/maobRbj.jpg postmarketOS demo menu (XWayland)]
Line 135: Line 177:


=== Videos ===
=== Videos ===
* [http://i.imgur.com/9c66GAs.mp4 Weston with various programs running]
== Vendor kernel information ==
{{note|This information concerns the old vendor (downstream) kernel. Unless you know what you're doing, go with mainline instead!}}
=== How drebrez made wifi work ===
* build the kernel module (dhd.ko for samsung-janice)
* get the vendor files for the [https://github.com/Epirex/android_vendor_samsung_u8500 Samsung U8500 devices]
* load the module using insmod with the firmware_path and nvram_path parameters
<code>insmod dhd.ko firmware_path=/etc/wifi/bcmdhd_sta.bin nvram_path=/etc/wifi/nvram_net.txt</code>
* set a mac address


* [http://i.imgur.com/9c66GAs.mp4 Weston with various programs running]
<code>ifconfig wlan0 hw ether 01:02:03:04:05:06</code>
 
Proceed with the generic instruction on how to scan for networks and [[WiFi#Connecting_to_APs]].

Latest revision as of 13:59, 4 November 2024

Samsung Galaxy S Advance
Samsung Galaxy S Advance running Phosh under PostmarketOS
Samsung Galaxy S Advance running Phosh under PostmarketOS
Manufacturer Samsung
Name Galaxy S Advance
Codename samsung-janice
Model GT-I9070
Released 2012
Type handset
Hardware
Chipset ST-Ericsson NovaThor U8500
CPU Dual-core 1.0 GHz Cortex-A9
GPU Mali-400
Display 480x800 AMOLED
Storage 8/16 GB
Memory 768 MB
Architecture armv7
Software
Original software Android
Original version 2.3.6 (Linux 2.6.35)
FOSS bootloader yes
postmarketOS
Category testing
Pre-built images no
Mainline yes
Features
Flashing
Works
USB Networking
Works
Internal storage
No data
SD card
No data
Battery
Works
Screen
Works
Touchscreen
Works
Multimedia
3D Acceleration
Works
Audio
Broken
Camera
Broken
Camera Flash
Works
Connectivity
WiFi
Works
Bluetooth
Partial
GPS
Broken
NFC
Works
Modem
Calls
Broken
SMS
Broken
Mobile data
Broken
Miscellaneous
FDE
No data
USB OTG
No data
Sensors
Accelerometer
Works
Magnetometer
Works
Ambient Light
Works
Proximity
Works
Haptics
Works
U-Boot
Primary Bootloader
Broken
Secondary Bootloader
Works
Mainline
Works
Internal Storage
Works
SD card
No data
USB Host
Works
USB Peripheral
Works
Display
Works
Buttons
Works

Contributors

  • drebrez

Installation

The mainline kernel can only be booted through U-Boot, not directly with the Samsung bootloader. U-Boot is installed as intermediate bootloader on the boot partition, so it does not replace the Samsung bootloader entirely. pmbootstrap can only support one bootloader configuration at the moment, which is why U-Boot is also recommended when installing the downstream kernel.

Boot into Download Mode using Power + Volume Down + Home and follow follow the the NovaThor U8500 U-Boot installation instructions to install U-Boot.

Finally, just follow the Installation guide.

Variants

A few different variants of this device were produced by Samsung, all named Samsung Galaxy S Advance but with different model codes. At least one of them has hardware differences.

Samsung Galaxy S Advance GT-I9070 variants
Model Features Notes
GT-I9070 Vanilla
GT-I9070chn Targeted for the chinese market
GT-I9070P NFC Test with nfctool -d nfc0 -1 -p

Bluetooth

Bluetooth does not have any Bluetooth device address (bdaddr or "MAC address") set after boot at the moment. To make Bluetooth work, you need to manually configure one:

# apk add bluez-btmgmt
# btmgmt public-addr <bdaddr>

where <bdaddr> is a MAC address like 53:33:6d:69:6e:69.

The Bluetooth controller should then show up in bluetoothctl:

# apk add bluez
# rc-service bluetooth start
$ bluetoothctl

You can e.g scan for devices:

[bluetooth]# show
[bluetooth]# power on
[bluetooth]# advertise on
[bluetooth]# system-alias golden
[bluetooth]# scan on

Sensors

  • Bosch BMA222 accelerometer
  • Yamaha YAS530 magnetometer
  • Sharp GP2AP002A00F proxomity and light sensor

The accelerometer does work albeit it needs polling. iio-sensor-proxy does the right thing as can be confirmed at the command line:

# monitor-sensor
Accelerometer orientation changed: bottom-up
Accelerometer orientation changed: right-up
Accelerometer orientation changed: bottom-up
Accelerometer orientation changed: left-up
Accelerometer orientation changed: normal
Accelerometer orientation changed: right-up
Accelerometer orientation changed: bottom-up

To test the sensors using iio_generic_buffer you first have to create a hrtimer trigger like this:

# mkdir /sys/kernel/config/iio/triggers/hrtimer/instance1

Then you can use this to poll values from the accelerometer or magnetometer like this:

# iio_generic_buffer -a -c 10 -n bma222 -t instance1
# iio_generic_buffer -a -c 10 -n yas530 -t instance1

The Light sensor can be read directly in sysfs:

# cd /sys/bus/iio/devices/iio:device4/
# cat in_illuminance_raw

Look at proximity events like this:

# echo 1 > events/in_proximity_thresh_either_en
# iio_event_monitor -a gp2ap002

Some udev hwdb updates might be needed for all devices to work properly with iio-sensor-proxy.

NFC

The NFC chip is a PNX544 and it is only mounted on the GT-I9070P version of Janice. To use NFC the back plate of the phone must be mounted, because the NFC antenna is in the back plate.

Test NFC with:

# nfctool -d nfc0 -1 -p

And place an NFC card on the back of the phone.


Links

Photos

Videos

Vendor kernel information

Note This information concerns the old vendor (downstream) kernel. Unless you know what you're doing, go with mainline instead!

How drebrez made wifi work

  • build the kernel module (dhd.ko for samsung-janice)
  • get the vendor files for the Samsung U8500 devices
  • load the module using insmod with the firmware_path and nvram_path parameters

insmod dhd.ko firmware_path=/etc/wifi/bcmdhd_sta.bin nvram_path=/etc/wifi/nvram_net.txt

  • set a mac address

ifconfig wlan0 hw ether 01:02:03:04:05:06

Proceed with the generic instruction on how to scan for networks and WiFi#Connecting_to_APs.