DHylands SGS2 Console

From MozillaWiki
Jump to: navigation, search

Run terminal emulator on host

Using a serial adapter, connect the serial adapter to your PC using the micro USB cable. Run a terminal emulator on the PC, and set it to 115200 baud, n81, no HW or SW flow control.

Personally, I like to use picocom, which can be installed using:

sudo apt-get install picocom

and run using:

picocom -b 115200 /dev/ttyUSB0

Setup permissions for /dev/ttyUSB0 on the host

In order to make /dev/ttyUSB0 have world read/write permissions (so anybody can use the serial port), I created a file called ftdi.rules with the following content (for Ubuntu 12.04):

SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", MODE="0666"

You should copy the ftdi.rules file into /etc/udev/rules.d and then execute:

sudo service udev restart

And unplug and replug the FTDI USB adapter in

Break into SBL (Samsung's Primitive BootLoader)

Power off the phone. Press and hold the HOME button and then plug in the serial adapter. The phone should automatically turn on and you should start to see bootloader messages coming out over the serial port. You can release the HOME button as soon as you start to see messages.

In the terminal emulator press and hold the RETURN key. You should drop into a prompt which looks like:

SBL>

You are now in the Samsung Primitive Bootloader. You can use the help command to see available commands. You should probably use the printenv command and record your environment settings.

Adjust some SBL environment variables

Enter the following commands:

setenv BOOT_DELAY 3
setenv SWITCH_SEL 6543
setenv CMDLINE loglevel=7 console=ttySAC2,115200
saveenv
boot

and you should now be seeing kernel boot messages flowing by. Once the kernel has booted you should also be able to press RETURN and get to a console, although it will be interrupted by the messages flowing by.

Setting BOOT_DELAY being set to 3, makes it easier to drop into the boot loader later on. It basically controls the how long SBL will stop and wait for a keypress in order to break into it.

Setting SWITCH_SEL controls some hardware on the phone which, along with the 510K resistor, causes the second serial port on the processor to be routed to the D+/D- lines on the USB connector. I think that this disconnects the MODEM (i.e. access to the cellular network).

Setting loglevel=7 on the kernel command line causes all printk's with KERN_INFO and lower to be printed. The original loglevel=4 causes only KERN_ERR and lower to be printed. This is documented in the kernel's Documentation/kernel_parameters.txt file.

Setting console=ttySAC2,115200 causes the kernel output to be directed to the second serial port.

Restore SBL environment back to original

To return the bootloader to the original settings, drop into the SBL> prompt as described above, and enter:

setenv BOOT_DELAY 0
setenv SWITCH_SEL 1
setenv CMDLINE loglevel=4 console=ram
saveenv
boot