View Single Post
Old 04-04-2013, 06:52 AM   #15
lisper
Junior Member
lisper has learned how to read e-bookslisper has learned how to read e-bookslisper has learned how to read e-bookslisper has learned how to read e-bookslisper has learned how to read e-bookslisper has learned how to read e-bookslisper has learned how to read e-bookslisper has learned how to read e-books
 
Posts: 8
Karma: 962
Join Date: Jun 2011
Device: Sony PRS-T1
booting different kernel on sony prs-t1

i succeeded in compiling and replacing the original 2.6.35.3 kernel.

i looked at /dev/block/mmcblk2 with hexdump and found the following entries (i formatted the output a bit):
Code:
stdin=serial                                                                                                                                           
stdout=serial                                                                                                                                          
stderr=serial                                                                                                                                          
ethact=FEC0                                                                                                                                            
loadaddr=0x70800000                                                                                                                                    
loadaddr_ramdisk=0x70C00000                                                                                                                            
bootdev=2                                                                                                                                              
rawtable=0xF40000                                                                                                                                      
bootcmd=mmc read 2 ${loadaddr} 0x800 0x1400;mmc read 2 ${loadaddr_ramdisk} 0x2800 0x1F4;bootm ${loadaddr} ${loadaddr_ramdisk}                          
bootargs=console=ttymxc2,115200 init=/init bootdev=2 rawtable=0xF40000                                                                                 
                                                                                                                                                       
stdin=serial                                                                                                                                           
stdout=serial                                                                                                                                          
stderr=serial                                                                                                                                          
ethact=FEC0                                                                                                                                            
loadaddr=0x70800000                                                                                                                                    
loadaddr_ramdisk=0x70C00000                                                                                                                            
bootdev=2                                                                                                                                              
rawtable=0xF40000                                                                                                                                      
bootcmd=mmc read 2 ${loadaddr} 0x3000 0x1400;bootm ${loadaddr}                                                                                         
bootargs=root=/dev/mmcblk2p1 rootfstype=ext4 rw rootwait init=/linuxrc console=ttymxc4,115200 bootdev=2 rawtable=0xF40000
this tells us that they use uboot for loading two different kernels. i replaced the second image, that starts at block 0x3000 (byte offset 0x600000) with a newly compiled one like this:
Code:
dd if=/dev/block/mmcblk2 of=kernel2backup bs=512 count=$((0x1400)) skip=$((0x3000))                                                                    
                                                                                                                                                       
make sure the kernel2backup file really starts with the uboot magic                                                                                    
sequence: 27 05 19 56                                                                                                                                  
                                                                                                                                                       
now be REALLY, REALLY CAREFUL                                                                                                                          
especially look at the dd manual for the difference between seek and skip                                                                              
dd of=/dev/block/mmcblk2 if=uImage bs=512 seek=$((0x3000))
the uImage you can create using the kernel source from sony (with make uImage)
here are some steps
Code:
wget http://www.sony.net/Products/Linux/Audio/Download/common/wgUBcpExj80eqi5pkrlZfw/uboot-110901.tgz

compile uboot and install tools/mkimage to /usr/bin
Code:
wget http://www.sony.net/Products/Linux/Audio/Download/common/L1KaMCC9mHxsZfoFPJnsBg/linux-2.6.35.3-110901.tgz
wget 

zcat /proc/config.gz > .config
make menuconfig (change what you want)
make uImage
make modules_install
the uImage is in arch/arm/boot/uImage


i managed to get a penguin displayed on the e-ink screen. however there is no text on the console. but i don't care, once i install xorg with an fbdev driver the screen should work okay with a terminal. now i would really like to backport the usb-otg support from a 3.4.9 kernel, so that i can attach a usb keyboard

so far i haven't managed to insmod the ar6k driver for the wifi card.

i have to wrote a small program which continuously updates the screen. the main logic is here:
Code:
#include <linux/fb.h>
#include "mxcfb.h"
#include <sys/mman.h>
#include <stdlib.h>
#include <sys/ioctl.h>

  int fd = open("/dev/fb0",O_RDWR);
  if(!fd || fd==-1)
    exit(1);
  {
    struct mxcfb_update_data u;
    u.update_region.top=0;
    u.update_region.left=0;
    u.update_region.width=800;
    u.update_region.height=600;
    // i read in  mxc_epdc_fb.c in the kernel source                            
    // to figure out the following                                              
    u.update_mode =  UPDATE_MODE_FULL;
    u.waveform_mode = 4;  // fast black-and-white waveform, with no flashing
    //WAVEFORM_MODE_AUTO;     // blinking gray value waveform                              
    int marker = 1;
    u.update_marker = marker;
    u.flags=0;
    if(0>ioctl(fd,MXCFB_SEND_UPDATE,&u))
      printf("problem with update\n");
    if(0>ioctl(fd,MXCFB_WAIT_FOR_UPDATE_COMPLETE,&marker))
      printf("problem during wait\n");
  }
  close(fd);
lisper is offline   Reply With Quote