Jump to content


Photo

building and packing a custom kernel

- - - - -

  • Please log in to reply
7 replies to this topic

#1
ergoen

ergoen

    Newbie

  • Members
  • Pip
  • 38 posts
  • Gender:Male
  • Location:Gothenburg, Sweden
  • Devices:LG Optimus 2x
Hi!

I've been trying to build my own kernel (using su660 sources) but have failed booting it so far, I'll describe my steps here and would appreciate if anyone with more knowledge could help me find what I'm doing wrong.

I've downloaded the kernel source code from LGe and build it using the readme provided with the .config found here in Pauls thread:

make ARCH=arm CROSS_COMPILE=../prebuilt/linux-x86/toolchain/arm-eabi-4.3.1/bin/arm-eabi-
make ARCH=arm CROSS_COMPILE=../prebuilt/linux-x86/toolchain/arm-eabi-4.3.1/bin/arm-eabi- zImage

This gives me the zImage file which is the kernel.
Now comes the packing of the boot.img. For this I have some android sources and done

make mkbootimg

This gives me the executable mkbootimg.
Now I extracted the ramdisk from the stock rom manually (using this guide: http://android-dls.c...ack_Boot_Images )
And then packed the kernel together with the ramdisk:

mkbootimg --cmdline 'no_console_suspend=1 console=null' --kernel zImage --ramdisk ramdisk.gz -o boot.img

This provides me with a boot image that doesn't boot. I've also tried

mkbootimg --cmdline 'no_console_suspend=1 console=null' --kernel zImage --ramdisk ramdisk.gz --base 0x10000000 -o boot.img

(taking the base value from Pauls thread http://android.modac...ings-braindump/ )

Is there something obvious I'm doing wrong?

Edited by theguv, 31 March 2011 - 06:42 AM.

  • 0

#2
PaulOBrien

PaulOBrien

    It's My Party

  • Founder
  • PipPipPipPipPipPip
  • 36,222 posts
  • Gender:Male
  • Location:Norwich, UK
  • Devices:All the Nexus!
  • Twitter:@paulobrien
I'm using 'mkbootimg --kernel zImage] --ramdisk ramdisk.cpio.gz -o boot.new.img --base 0x10000000' so not passing a command line, but that aside, basically the same as yours?

P

  • 0

You can follow me on Twitter - http://twitter.com/paulobrien / Follow MoDaCo on Twitter - http://twitter.com/modaco

Want to donate? MoDaCo is raising money for the Multiple Sclerosis society.

Posted Image


#3
ergoen

ergoen

    Newbie

  • Members
  • Pip
  • 38 posts
  • Gender:Male
  • Location:Gothenburg, Sweden
  • Devices:LG Optimus 2x

I'm using 'mkbootimg --kernel zImage] --ramdisk ramdisk.cpio.gz -o boot.new.img --base 0x10000000' so not passing a command line, but that aside, basically the same as yours?

P


Hm, thanks, that worked! (Note to self: should not follow random guides on the internet with weird extra flags without knowing what they do).

Although I seem to have broken the wifi, dmesg has lots of lines like:
<4>[ 56.494858] wireless: Unknown symbol register_netdev
<4>[ 56.495131] wireless: disagrees about version of symbol free_netdev

I will work more with this during the weekend, thanks again.

  • 0

#4
PaulOBrien

PaulOBrien

    It's My Party

  • Founder
  • PipPipPipPipPipPip
  • 36,222 posts
  • Gender:Male
  • Location:Norwich, UK
  • Devices:All the Nexus!
  • Twitter:@paulobrien
Excellent. Have you pushed the generated wifi ko to /system/lib/modules?

P

  • 0

You can follow me on Twitter - http://twitter.com/paulobrien / Follow MoDaCo on Twitter - http://twitter.com/modaco

Want to donate? MoDaCo is raising money for the Multiple Sclerosis society.

Posted Image


#5
ergoen

ergoen

    Newbie

  • Members
  • Pip
  • 38 posts
  • Gender:Male
  • Location:Gothenburg, Sweden
  • Devices:LG Optimus 2x

Excellent. Have you pushed the generated wifi ko to /system/lib/modules?

P


Nope, didn't have time for that in the morning, will do when I get back home. I thought that since the kernel version was the same, the old wifi modules should have worked, but I guess I have to read up a bit on how drivers work on linux..


Edit: Works with generated wireless.ko! Nice, I'll read up on cifs and the likes now.

Edited by theguv, 01 April 2011 - 02:46 PM.

  • 0

#6
flyingdog77

flyingdog77

    Newbie

  • MoDaCo Silver
  • Pip
  • 19 posts
  • Devices:LGP990

I'm using 'mkbootimg --kernel zImage] --ramdisk ramdisk.cpio.gz -o boot.new.img --base 0x10000000' so not passing a command line, but that aside, basically the same as yours?

P


I am using the same procedure. Got the ramdisk using split_bootimg.pl, compiled my kernel from the sources ahh btw, here are the LGP990 v10c sources (http://www.lg.com/gl...odelCode=LGP990) and used mkbootimg to rejoin my new kernel with the stock ramdisk:


./mkbootimg --kernel mydroid/kernel/arch/arm/boot/zImage --ramdisk boot.img-ramdisk.gz -o boot.img --base 0x10000000

I flashed the PARTITION 10 via nvflash using:

nvflash --bl fastboot.bin --download 10 boot.img

I have done it with a couple of different attempt before finding the lg source and it was obviously getting an invisible panic at the first LG logo.
I believe that this last kernel works fine because I can get over the LG to the second LG screen with the progress bar but the system stuck there.
I tried to adb and I see the phone but adb sheel gets a message saying the sh is not found on the whatever/bin/ so I think that the ramdisk is not working...

do you have guys any tip for me?

  • 0

#7
ergoen

ergoen

    Newbie

  • Members
  • Pip
  • 38 posts
  • Gender:Male
  • Location:Gothenburg, Sweden
  • Devices:LG Optimus 2x

I am using the same procedure. Got the ramdisk using split_bootimg.pl, compiled my kernel from the sources ahh btw, here are the LGP990 v10c sources (http://www.lg.com/gl...odelCode=LGP990) and used mkbootimg to rejoin my new kernel with the stock ramdisk:
./mkbootimg --kernel mydroid/kernel/arch/arm/boot/zImage --ramdisk boot.img-ramdisk.gz -o boot.img --base 0x10000000

I flashed the PARTITION 10 via nvflash using:

nvflash --bl fastboot.bin --download 10 boot.img

I have done it with a couple of different attempt before finding the lg source and it was obviously getting an invisible panic at the first LG logo.
I believe that this last kernel works fine because I can get over the LG to the second LG screen with the progress bar but the system stuck there.
I tried to adb and I see the phone but adb sheel gets a message saying the sh is not found on the whatever/bin/ so I think that the ramdisk is not working...

do you have guys any tip for me?


Hm, if that script extracted the ramdisk correctly it should work :S.
I didn't really do it that way, I extracted it manually (according to http://android-dls.c...ack_Boot_Images ). And then I didn't use nvflash for flashing. I adb push-ed the boot.img to the device, then I used dd if=boot.img of=/dev/block/mmcblk0p5 to flash it to the boot partition. Not sure what the partition 10 is which you speak of, but it should probably have worked :S

  • 0

#8
flyingdog77

flyingdog77

    Newbie

  • MoDaCo Silver
  • Pip
  • 19 posts
  • Devices:LGP990

Hm, if that script extracted the ramdisk correctly it should work :S.
I didn't really do it that way, I extracted it manually (according to http://android-dls.c...ack_Boot_Images ). And then I didn't use nvflash for flashing. I adb push-ed the boot.img to the device, then I used dd if=boot.img of=/dev/block/mmcblk0p5 to flash it to the boot partition. Not sure what the partition 10 is which you speak of, but it should probably have worked :S



yes, thanks for your answering.

the partitioning numbers in nvflash languages are a bit different then the ones seen from the kernel side. this is the schema:

[device]
type=hsmmc
instance=3

[partition]
name=BCT
id=2
type=boot_config_table
allocation_policy=sequential
filesystem_type=basic
size=3145728
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0

[partition]
name=PT
id=3
type=partition_table
allocation_policy=absolute
filesystem_type=basic
start_location=4194304
size=4096
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0

[partition]
name=EBT
id=4
type=bootloader
allocation_policy=sequential
filesystem_type=basic
size=1572864
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0
filename=fastboot.bin

[partition]
name=MBR
id=5
type=master_boot_record
allocation_policy=sequential
filesystem_type=basic
size=1048576
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0

[partition]
name=APP
id=6
type=data
allocation_policy=sequential
filesystem_type=basic
size=367001600
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0
filename=system.img

[partition]
name=CAC
id=7
type=data
allocation_policy=sequential
filesystem_type=ext3
size=67108864
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0

[partition]
name=MSC
id=8
type=data
allocation_policy=sequential
filesystem_type=ext3
size=2097152
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0

# extended partition
[partition]
name=EB1
id=9
type=extended_boot_record
allocation_policy=sequential
filesystem_type=basic
size=131072
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0

[partition]
name=LNX
id=10
type=data
allocation_policy=sequential
filesystem_type=basic
size=8388608
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0
filename=boot.img

[partition]
name=EB2
id=11
type=extended_boot_record
allocation_policy=sequential
filesystem_type=basic
size=131072
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0

[partition]
name=DRM
id=12
type=data
allocation_policy=sequential
filesystem_type=ext3
size=2306560
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0

[partition]
name=EB3
id=13
type=extended_boot_record
allocation_policy=sequential
filesystem_type=basic
size=131072
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0

[partition]
name=SOS
id=14
type=data
allocation_policy=sequential
filesystem_type=basic
size=20971520
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0
filename=recovery.img

[partition]
name=EB4
id=15
type=extended_boot_record
allocation_policy=sequential
filesystem_type=basic
size=131072
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0

[partition]
name=UDA
id=16
type=data
allocation_policy=sequential
filesystem_type=ext3
size=1610612736
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0

[partition]
name=EB5
id=17
type=extended_boot_record
allocation_policy=sequential
filesystem_type=basic
size=131072
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0

[partition]
name=UDB
id=18
type=data
allocation_policy=sequential
filesystem_type=ext3
size=0xFFFFFFFFFFFFFFFF
file_system_attribute=0
partition_attribute=0
allocation_attribute=8
percent_reserved=0

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users