[HELP] Finding and Editing the Bootscript file for Android 4

Stuck with a problem in your code? Seek help here.

[HELP] Finding and Editing the Bootscript file for Android 4

Postby arjay.lzo » January 28th, 2016, 6:04 pm

I initially consulted the HARDWARE experts with regards to my on-going project. Turns-out that working with the software side is more economical and more feasible on my end, my skills and resources.

How I started:
I have a defective Acer Laptop with a working 15.4" Normally Landscape Display. The LCD panel is suitable to salvage for now.

Then I have a Chinese made tablet, FnF i5 mini 2, it has a damaged Digitizer and LCD 7" display, yet its MOBO still lives!

I am able to setup the Tablet to connect on to my TV thru its HDMI, a large TV that consumes more power in order to watch movies and the rest thru the Android (HDMI).

So I figured, surely I can re-route the LVDS cable from the 15" in replacement to the broken 7" tablet, then yields to a better less consuming Multi-media device. A way that I will control the Tablet would be thru a DIY powered USB hub via the OTG (mouse and Keyboard). For now, I am controlling the broken tablet via VNC without a physical display.

So here is what I got:
It turns out that the 7" LCD panel for the tablet is set to be NORMALLY PORTRAIT, yet the 15" LCD from the laptop was Landscape.

with further research, a Replacement LCD Manufacturer indicated that;
Linux kernel allows to assign manual LCD resolution in bootargs supplied by u-boot. This is usually done by script called “boot.scr” in “boot” partition that is loaded and executed by u-boot. “boot.scr” has special format and usually is created with the help of “mkimage” util from source file called “boot.txt”. Below is example of my “boot.txt” that I use for Android (Linaro build 12.01):


also;
The most important bootarg here is “omapfb.video_mode=1024x600MR-16@60” – that’s exactly where we setup LCD resolution. 1024×600 sets resolution, “M” indicates the kernel will calculate a VESA mode on-the-fly instead of using modedb look-up, the “R” indicates reduced blanking which is for LCD panels, “16” is the color depth, “@60” is the # of frames per second.

Lets generate “boot.scr” file with the following commands:

mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Run uImage" -d boot.txt boot.scr
chmod a+x boot.scr

“mkimage” is available in package “uboot-mkimage”.


The FnF Ifive Mini 2 has 800x1280 according the the datasheet, morelikely is also indicated on the BOOT.SCR (if there is Boot.scr) for the JB 4.1.1

Current Challenge. I have scanned and search for a file named "BOOT.SCR" using ES-FIlemngr thru search, no relative file found. I might be looking for a different file...

I call upon all the android experts, the chef!
Attachments
IMG_20160128_235135.jpg
The 15" almost worked!
arjay.lzo
 
Posts: 8
Joined: January 28th, 2016, 9:30 am

Re: [HELP] Finding and Editing the Bootscript file for Andro

Postby bandersnatch » January 29th, 2016, 6:53 am

Hi again,

The
arjay.lzo wrote: This is usually done by script called “boot.scr” in “boot” partition


the "boot" partition is not normally mounted when Android is running.
You gotta mount the partition first in order to see the files it contains
See (e.g.) : android.stackexchange.com/questions/71646/i-cant-find-the-boot-recovery-partitions-on-my-android-phone-for-backup-where
Search for "android mount boot partition"

You also gotta save a new boot partition image or your changes will be lost on the next boot.

This is why in the HW forum I suggested using a tool to avoid all the manual mucking about.
(Yeah, yeah... this is heresy, true linux hackers use only NED & the shell ;)))!!! )
If you are not an Android crack then I recommend that you first gather as much information as possible
so that you know what you are doing & do not brick your OS..

STFB...
bandersnatch
 
Posts: 145
Joined: September 17th, 2014, 12:06 pm

Re: [HELP] Finding and Editing the Bootscript file for Andro

Postby arjay.lzo » January 29th, 2016, 8:58 am

Oh hello! Thank you for taking so much time replying on to my post.

I am now at the stage where I got into a so called template on how to make adjustments with the absence of the BOOT.SCR

I am now working on rebuilding my UBUNTU Environment, I somehow got used to BACKTRACK/Linux from my previous Pentest Projects. Your search strings has lead me to the exact steps on how to mount the Hidden Partition for the BOOT. It reminded me of the times I had to patch my laptop's WIFI module altogether working with Kernels and modules. I did not realize these at first. It felt like a complete dejavu.

I also manage to grab some breadcrumbs that will help me with Recompiling the altered LVDS/LCD kernel, then I got the source code from GIT. It will allow me to fill in the blanks, mostly numbers or figures which will be derived from the LCD's datasheet.

here;
Code: Select all
For your customized LCD :

(1)Calculate the LCD's time and fill the fb_videomode accroding to LCD datasheet.

static struct fb_videomode wvga_video_modes[] = {

{

  /* 800x480 @ 57 Hz , pixel clk @ 32MHz */ <--- Here is where I will input 1280x800

  "SEIKO-WVGA", 60, 800, 480, 29850, 89, 164, 23, 10, 10, 10,  # will replace it with AOU

  FB_SYNC_CLK_LAT_FALL,

  FB_VMODE_NONINTERLACED,

  0,},
{/*Add a new LCD*/
  /* 320x240 @ xx Hz , pixel clk @ xxMHz */ # target line for modification
  "MY-LCD", 60, 320, 240, xxx, xxx, xxx, xxx, xxx, xxx, xxx,
  FB_SYNC_CLK_LAT_FALL,
  FB_VMODE_NONINTERLACED,
  0,},
};

(2)Update static struct mxc_fb_platform_data wvga_fb_data[]

static struct mxc_fb_platform_data wvga_fb_data[] = {
{
  .interface_pix_fmt = V4L2_PIX_FMT_RGB666,  # target line for modification
  .mode_str = "MY-LCD",  # target line for modification
  .mode = wvga_video_modes,
  .num_modes = ARRAY_SIZE(wvga_video_modes),
  },
};

(4)Create a new LCD device   

static struct platform_device lcd_wvga_device = {
.name = "lcd_mine",
};

(5)Add a new driver for your LCD

It is not difficult to add a new driver for you LCD, you can refer to linux/drivers/video/mxc/mxc_seiko_wvga.c, create a new driver file at the same path. Notice that driver's name should be same as that of device:

static struct platform_driver lcd_driver = {

.driver = {

    .name = "lcd_mine"},

.probe = lcd_probe,

.remove = __devexit_p(lcd_remove),

.suspend = lcd_suspend,

.resume = lcd_resume,

};

(6)Register your LCD device(same as that of in bsp)

mxc_register_device(&lcd_wvga_device, NULL);


You also had the datasheet, the forum where I got these codes got cut off, do you happen to have any IDEA about these? Coming from the Datasheet?

"MY-LCD", 60, 320, 240, xxx, xxx, xxx, xxx, xxx, xxx, xxx,


I understand it will still take me or us both quite some time to reach on to the part where I key in the Values according to the datasheet. But we'll get there. I have been sitting and reading all day and night long.

The tablet has the Rockchip30. I may need to acquire the BSP file specific for the Tablet's board prior to fully compiling the kernel.

I also stumble on to several APPS/APKs which offers realtime Kernel alterations, yet the option or somehow strings I was looking for is not offered as these APPS only offers options more on clocking the CPU and the rest of built-in peripherals.
arjay.lzo
 
Posts: 8
Joined: January 28th, 2016, 9:30 am

Re: [HELP] Finding and Editing the Bootscript file for Andro

Postby bandersnatch » January 29th, 2016, 2:38 pm

Hi,

arjay.lzo wrote:You also had the datasheet, the forum where I got these codes got cut off, do you happen to have any IDEA about these? Coming from the Datasheet?


The key here is:
arjay.lzo wrote:static struct fb_videomode wvga_video_modes[] = {


G$$gle for fb_videomode:
www.kernel.org/doc/Documentation/fb/sh7760fb.txt
stackoverflow.com/questions/14706351/how-do-one-calculate-the-fb-videomode-parameters-in-linux-kernel
ALL the info you need is described in these 2 sites

The datasheet at:
static1.1.sqspcdn.com/static/f/489821/16715107/1383687390277/B154EW02-V3.pdf
is still available.... Grab it

I salute your willingness to "boldly go where you have never gone before" but I haven't the time to help you step by step.
I have no idea what your level of SW knowledge is but it seems as if you are venturing into new ground.
The most useful advice I can give you is ALWAYS HAVE A BACKUP/PLAN B when messing about with the kernel/boot partition.
This means that BEFORE trying out any changes you should ALWAYS FIRST ESTABLISH A RECOVERY PATH
Sorry to shout but this is absolutely essential.
In your case this means you need to:
1/ Create a backup image of your entire system onto some sort of external media #1 (SD-Card, WLAN drive.. whatever)
- Not hard but you gotta know some things. Do the research so that you are properly informed
2/ FInd out how to boot your Android device from some sort of external media #2 (SD-Card, WLAN drive.. whatever)
3/ Create a bootable image for your Android device on this external media #2 (SD-Card, WLAN drive.. whatever)
4/ CHECK that you can boot your Android device from this external media #2 (SD-Card, WLAN drive.. whatever)
- Configure the device to always FIRST look for a bootable partition on external media

This externally bootable image allows you to restore the original image on the internal flash drive if things go wrong...

You are now equipped with the essential resources & knowledge to start mucking about with the kernel.
With any luck nothing will go wrong and you won't need the backup but you will be endlessly grateful
for your backup if something goes wrong & you brick your Android device.
It is very easy to end up in a "Catch22" situation if something goes wrong with the Boot partition/Kernel.
You need to boot a running kernel in order to correct the Boot partition/Kernel problem but
the Boot partition/Kernel problem prevents you from booting a running kernel.

In other systems you can simply rip out the hard drive & reload the image from another computer but the flash memory
in tablets/smartphones is usually soldered onto the mainboard...
Especially HW hackers are not always aware of the disastrous consequences of omitting a comma or adding an extra zero
in kernel cofiguration files and are dismayed when their treasured table suddenly does nothing when switched on.
You can imagine how frustrating it is to have a piece of hardware that is electronically 100% OK but is bricked & unusable.

You can of course ignore my advice & just dive in if you have a large cardboard box full of expendable devices. ;^)
Whatever you do, learning how to do steps 1-4 above will always be useful to you in the future and represents essential
knowledge for any respectable kernel hacker.....

I hope this helps.
I wish you luck but cover your a** ;^)

STFB
bandersnatch
 
Posts: 145
Joined: September 17th, 2014, 12:06 pm

Re: [HELP] Finding and Editing the Bootscript file for Andro

Postby arjay.lzo » January 30th, 2016, 12:49 am

I owe you a beer! Thank you!

I have three of these Tablets, each one for my kids. All in working condition except for the beaten one which belongs to my eldest. He went ballistic leading to a LCD wreak. Funny that I really do have a cardboard box of devices, mostly are already been tweaked or modified as a result of my disease, an OCD. I got into a habit of salvaging parts and devices, last time I had a Home theater interfaced on a Bluetooth which ends up one less wire for my house and to my phone, plus! I get to roam around with a loud music.

In fact I am not an expert at all if I were to level my self on this venue. But I do have experience with Flashing phones, unbricking and fixing minute components. I had a Cellphone repair booth once with SMD soldering equipment and logic tester, most importantly a beloved DIY Serial programmer. Also I am good at both fixing and damaging laptop/desktop computers :) that is when I learn.

I cant thank you enough giving me these pointers.
I had spent an hour thinking of when will I start or where I will start with tinkering with the kernel since I already have the Following:
The V3 datasheet, I had it after disassembly of the 7" LCD
Official FW for the Tablet - I decided to dissect the OFW rather than pulling or dumping the BOOT and Kernel from my device. The OFW details is already given.
Flasher for the Rk30 (Tablet)
Mapped the Debug Ports of the Tablet's board, I am hoping that I will never make use of my serial or J-tag/UART programmer, it will definitely lead me to a deeper level, that I am sure I am not accustomed of.

AS of this time, I am having second thoughts about my LINUx/Ubuntu 12.04, my resources with regards to acquiring the Android dependencies are incomplete. I might reconsider getting the latest Ubuntu distro and see if I can DL all the requirements as well as the toolchains. Your thoughts?
arjay.lzo
 
Posts: 8
Joined: January 28th, 2016, 9:30 am


Return to Help Me! Software

Who is online

Users browsing this forum: No registered users and 2 guests

cron