xiaolu / mkbootimg_tools

Unpack and repack boot.img,support dtb(dt.img).
530 stars 365 forks source link

How to pack my own ZImage (kernel) to a new boot.img #2

Closed hkfriends closed 11 years ago

hkfriends commented 11 years ago

Hi there

I can use your tools to unpack stock boot.img to zImage and ramdisk... then I can make change to ramdisk and then re-pack ok .... very good!!

unfortunately I have download kernel source and re-build (customize) my kernel and build new zImage

but I cannot pack my own (new) zImage and the ramdisk, I belive dt.img need to re-build....

can you tell me how to use your script to do that? it seems no paramter for me to pass dt.img path

大大, 簡單的是怎樣把我自己compile的kernel (zImage), 合拼ramdisk + dt.img 為boot.img ? 貌似dt.img 要compile過, 同時你的script不能指特定zImage 戓 dt.img 謝謝幫忙

xiaolu commented 11 years ago

For example,e330s:

      page_size      : 2048
      base_addr      : 0x00000000
      kernel size    : 6911360
      kernel_addr    : 0x00008000
      ramdisk_size   : 2685222
      ramdisk_addr   : 0x02000000
      second_size    : 0
      second_addr    : 0x00f00000
      dtb_size       : 1427456
      tags_addr      : 0x01e00000
      cmdline        : console=null androidboot.hardware=qcom user_debug=31 maxcpus=2 msm_rtb.filter=0x3F

make recovery.img:

    mkbootimg_dtb --kernel zImage --ramdisk ramdisk.gz --base 0x00000000 --offset 0x02000000 --tags-addr 0x01e00000 --dt dt.img --cmdline "console=null androidboot.hardware=qcom user_debug=31 maxcpus=2 msm_rtb.filter=0x3F"  -o recovery.img
xiaolu commented 11 years ago

在你编译完内核以后,在arch/arm/boot/下,没有生成*.dtb文件? 如果有的话,直接运行:

    scripts/dtbTool -s 2048 -o arch/arm/boot/dt.img -p scripts/dtc/ arch/arm/boot/
    DTB combiner:
    Input directory: '/media/diskd/kernel/SHV-E330S_JB_Opensource/Kernel/arch/arm/boot/'
    Output file: '/media/diskd/kernel/SHV-E330S_JB_Opensource/Kernel/arch/arm/boot/dt.img'
    Found file: msm8974-sec-ks01-r03.dtb ... chipset: 2114015745, platform: 3, rev: 0
    Found file: msm8974-sec-ks01-r07.dtb ... chipset: 2114015745, platform: 7, rev: 0
    Found file: msm8974-sec-ks01-r06.dtb ... chipset: 2114015745, platform: 6, rev: 0
    Found file: msm8974-sec-ks01-r04.dtb ... chipset: 2114015745, platform: 4, rev: 0
    Found file: msm8974-sec-ks01-r11.dtb ... chipset: 2114015745, platform: 11, rev: 0
    Found file: msm8974-sec-ks01-r02.dtb ... chipset: 2114015745, platform: 2, rev: 0
    Found file: msm8974-sec-ks01-r00.dtb ... chipset: 2114015745, platform: 0, rev: 0
    Found file: msm8974-sec-ks01-r05.dtb ... chipset: 2114015745, platform: 5, rev: 0
    Found file: msm8974-sec-ks01-r01.dtb ... chipset: 2114015745, platform: 1, rev: 0
    => Found 9 unique DTB(s)

    Generating master DTB... completed

就可以生成dt.img 如果没有dtb文件,需要自己编译dtb文件:

    scripts/dtc/dtc -O dtb -o arch/arm/boot/msm8974-sec-ks01-r00.dtb -b 0  -d arch/arm/boot/.msm8974-sec-ks01-r00.dtb.d arch/arm/boot/dts/msm8974-sec-ks01-r00.dts

    scripts/dtc/dtc -O dtb -o arch/arm/boot/msm8974-sec-ks01-r01.dtb -b 0  -d arch/arm/boot/.msm8974-sec-ks01-r00.dtb.d arch/arm/boot/dts/msm8974-sec-ks01-r01.dts
hkfriends commented 11 years ago

Yes i has the following dtb files:

/usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot/ msm8974-v2-ef56s-pp10.dtb msmsamarium-rumi.dtb msmsamarium-sim.dtb zImage Image

What is the param -p scripts/dtc/ ??? for

./dtbTool -s 2048 -o /usr/android/kernel/dt.img -p scripts/dtc /usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot DTB combiner: Input directory: '/usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot' Output file: '/usr/android/kernel/dt.img' Found file: msmsamarium-rumi.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag Found file: msmsamarium-sim.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag Found file: msm8974-v2-ef56s-pp10.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag => Found 0 unique DTB(s)

DTB files http://pan.baidu.com/share/link?shareid=1428949089&uk=1597028979

My kernel: Pantech A880s http://opensource.pantech.com/model/list.asp?Category=Mobile

xiaolu commented 11 years ago

@hkfriends 我用你给的boot.rar成功生成了dt.img,命令如下,我在dtbTool里加了调试代码,终于发现是你的命令参数里的路径(-p scripts/dtc)有问题,需要改成-p scripts/dtc/。

    xiaolu@xiaolu-ubuntu64:/media/diskd/kernel/SHV-E330S_JB_Opensource/Kernel$ /media/diskd/kernel/SHV-E330S_JB_Opensource/Kernel/scripts/dtbTool  -v -s 2048 -o ./dt.img -p /media/diskd/kernel/SHV-E330S_JB_Opensource/Kernel/scripts/dtc/ /media/diskd/boot/DTB combiner:
      Input directory: '/media/diskd/boot/'
      Output file: './dt.img'
    Found file: msmsamarium-sim.dtb ... chipset: 195, platform: 0, rev: 0
    Found file: msm8974-v2-ef56s-pp10.dtb ... chipset: 126, platform: 567, rev: 131072
       additional chipset: 186, platform: 567, rev: 131072
       additional chipset: 185, platform: 567, rev: 131072
    Found file: msmsamarium-rumi.dtb ... chipset: 195, platform: 0, rev: 0
    ... duplicate info, skipped
    => Found 4 unique DTB(s)

    Generating master DTB... 
     (writing '/media/diskd/boot/msm8974-v2-ef56s-pp10.dtb' - 147456 bytes) 
     (writing '/media/diskd/boot/msmsamarium-sim.dtb' - 4096 bytes) Total wrote 153600 bytes
    completed
hkfriends commented 11 years ago

it is strange...i am still has error

=> Found 0 unique DTB(s) root@ubuntu:/usr/android/a880s# ./dtbTool -v -s 2048 -o ./dt.img -p /usr/android/kernel/scripts/dtc/ /usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot DTB combiner: Input directory: '/usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot' Output file: './dt.img' Found file: msmsamarium-rumi.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag Found file: msmsamarium-sim.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag Found file: msm8974-v2-ef56s-pp10.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag => Found 0 unique DTB(s) root@ubuntu:/usr/android/a880s#

1) ./dtbTool ---> I download this binary from your github 2) /usr/android/kernel/scripts/dtc/ --> this is the dtc scripts from A880s source 3) /usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot --> this is place from my newly built obj

I have 4 files in here: root@ubuntu:/usr/android/a880s# ls /usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot compressed msm8974-v2-ef56s-pp10.dtb msmsamarium-sim.dtb Image msmsamarium-rumi.dtb zImage

root@ubuntu:/usr/android/a880s# ls /usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot compressed msm8974-v2-ef56s-pp10.dtb msmsamarium-sim.dtb Image msmsamarium-rumi.dtb zImage root@ubuntu:/usr/android/a880s# ls /usr/android/kernel/scripts/dtc/ checks.c dtc-lexer.lex.c_shipped flattree.c srcpos.c data.c dtc-parser.tab.c fstree.c srcpos.h dtc.c dtc-parser.tab.c_shipped libfdt treesource.c dtc.h dtc-parser.tab.h livetree.c util.c dtc-lexer.l dtc-parser.tab.h_shipped Makefile util.h dtc-lexer.lex.c dtc-parser.y Makefile.dtc version_gen.h root@ubuntu:/usr/android/a880s#

hkfriends commented 11 years ago

I also download E330S source code: but the same error: how to debug dtbTool ??

root@ubuntu:/usr/android/a880s# ./dtbTool -v -s 2048 -o ./dt.img -p /usr/android/SHV-E330S_JB_Opensource/Kernel/scripts/dtc/ /usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot DTB combiner: Input directory: '/usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot' Output file: './dt.img' Found file: msmsamarium-rumi.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag Found file: msmsamarium-sim.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag Found file: msm8974-v2-ef56s-pp10.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag => Found 0 unique DTB(s) root@ubuntu:/usr/android/a880s#

xiaolu commented 11 years ago

-p /usr/android/kernel/obj/KERNEL_OBJ/scripts/dtc/

发送自HTC手机

----- Reply message ----- 发件人: "hkfriends" notifications@github.com 收件人: "xiaolu/mkbootimg_tools" mkbootimg_tools@noreply.github.com 抄送: "xiaolu" server@163.com 主题: [mkbootimg_tools] How to pack my own ZImage (kernel) to a new boot.img (#2) 日期: 周六, 9月 7 日, 2013 年 08:08

it is strange...i am still has error

=> Found 0 unique DTB(s)

root@ubuntu:/usr/android/a880s# ./dtbTool -v -s 2048 -o ./dt.img -p /usr/android/kernel/scripts/dtc/ /usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot

DTB combiner:

Input directory: '/usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot'

Output file: './dt.img'

Found file: msmsamarium-rumi.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag

Found file: msmsamarium-sim.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag

Found file: msm8974-v2-ef56s-pp10.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag

=> Found 0 unique DTB(s)

root@ubuntu:/usr/android/a880s#

1) ./dtbTool ---> I download this binary from your github

2) /usr/android/kernel/scripts/dtc/ --> this is the dtc scripts from A880s source

3) /usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot --> this is place from my newly built obj

I have 4 files in here:

root@ubuntu:/usr/android/a880s# ls /usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot

compressed msm8974-v2-ef56s-pp10.dtb msmsamarium-sim.dtb

Image msmsamarium-rumi.dtb zImage

root@ubuntu:/usr/android/a880s# ls /usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot

compressed msm8974-v2-ef56s-pp10.dtb msmsamarium-sim.dtb

Image msmsamarium-rumi.dtb zImage

root@ubuntu:/usr/android/a880s# ls /usr/android/kernel/scripts/dtc/

checks.c dtc-lexer.lex.c_shipped flattree.c srcpos.c

data.c dtc-parser.tab.c fstree.c srcpos.h

dtc.c dtc-parser.tab.c_shipped libfdt treesource.c

dtc.h dtc-parser.tab.h livetree.c util.c

dtc-lexer.l dtc-parser.tab.h_shipped Makefile util.h

dtc-lexer.lex.c dtc-parser.y Makefile.dtc version_gen.h

root@ubuntu:/usr/android/a880s#

— Reply to this email directly or view it on GitHub.

xiaolu commented 11 years ago

你把dtcTool放在内核的scripts目录下运行试试吧,scripts/dtbTool

发送自HTC手机

----- Reply message ----- 发件人: "hkfriends" notifications@github.com 收件人: "xiaolu/mkbootimg_tools" mkbootimg_tools@noreply.github.com 抄送: "xiaolu" server@163.com 主题: [mkbootimg_tools] How to pack my own ZImage (kernel) to a new boot.img (#2) 日期: 周六, 9月 7 日, 2013 年 08:39

I also download E330S source code:

but the same error: how to debug dtbTool ??

root@ubuntu:/usr/android/a880s# ./dtbTool -v -s 2048 -o ./dt.img -p /usr/android/SHV-E330S_JB_Opensource/Kernel/scripts/dtc/ /usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot

DTB combiner:

Input directory: '/usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot'

Output file: './dt.img'

Found file: msmsamarium-rumi.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag

Found file: msmsamarium-sim.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag

Found file: msm8974-v2-ef56s-pp10.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag

=> Found 0 unique DTB(s)

root@ubuntu:/usr/android/a880s#

— Reply to this email directly or view it on GitHub.

xiaolu commented 11 years ago

你要确定dtc所在的目录是否正确,dtc文件是否存在,dtb目录是否正确,*.dtb是否存在。

在 2013-09-07 08:39:28,hkfriends notifications@github.com 写道:

I also download E330S source code: but the same error: how to debug dtbTool ??

root@ubuntu:/usr/android/a880s# ./dtbTool -v -s 2048 -o ./dt.img -p /usr/android/SHV-E330S_JB_Opensource/Kernel/scripts/dtc/ /usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot DTB combiner: Input directory: '/usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot' Output file: './dt.img' Found file: msmsamarium-rumi.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag Found file: msmsamarium-sim.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag Found file: msm8974-v2-ef56s-pp10.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag => Found 0 unique DTB(s) root@ubuntu:/usr/android/a880s#

— Reply to this email directly or view it on GitHub.

xiaolu commented 11 years ago

@hkfriends 你的dtc没有编译出来。 我上传了一个编译好的dtc文件,你可以放在一个目录下比如 /usr/android/下,运行:

    ./dtbTool -v -s 2048 -o ./dt.img -p /usr/android/ /usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot
hkfriends commented 11 years ago

ok thanks... same error

root@ubuntu:/usr/android/a880s# ./dtbTool -v -s 2048 -o ./dt.img -p /usr/android/ /usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot DTB combiner: Input directory: '/usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot' Output file: './dt.img' Found file: msmsamarium-rumi.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag Found file: msmsamarium-sim.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag Found file: msm8974-v2-ef56s-pp10.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag => Found 0 unique DTB(s)

hkfriends commented 11 years ago

I also install DTC 1.3

apt-get install device-tree-compiler root@ubuntu:/usr/android/a880s# dtc -v Version: DTC 1.3.0

and download your 1.2 root@ubuntu:/usr/android# ./dtc -v Version: DTC 1.2.0-g37c0b6a0

still has error

xiaolu commented 11 years ago

@hkfriends 你的dtc路径错了。 /xxxx/dtbTool -s 2048 -o /xxxx/dt.img -p /xxxx/dtc/ /xxx/kernel/arch/arm/boot/

这条命令要保证 /xxxx/dtc/dtc存在 /xxx/kernel/arch/arm/boot/*.dtb存在。

![qq20130907235443](https://f.cloud.github.com/assets/555410/1101637/4e4082f8-17d6-11e3-8a5c-3d66fd5c5e41.jpg “github”)

![qq20130907235500](https://f.cloud.github.com/assets/555410/1101638/4e772092-17d6-11e3-8c4f-7170bd323071.jpg “github”)

![qq20130907235516](https://f.cloud.github.com/assets/555410/1101639/4e9aa09e-17d6-11e3-801d-9e03fe6e5fa9.jpg “github”)

![qq20130907235427](https://f.cloud.github.com/assets/555410/1101640/4ea20f28-17d6-11e3-8a0d-2e31ba2bd0e2.jpg “github”)

hkfriends commented 11 years ago

Yes, 路径 is ok 1) I downloaded your dtc binary and with correct permission in /usr/android/dtc 2) all *.dtb under /usr/android/ /usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot 3) ./dtbTool -v -s 2048 -o ./dt.img -p /usr/android/ /usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot

Here is the proof:

root@ubuntu:/usr/android/a880s# ls /usr/android/dtc -l -rwxrwxrwx 1 rootlam rootlam 94028 Sep 7 22:08 /usr/android/dtc

root@ubuntu:/usr/android/a880s# ls -l /usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot total 19116 drwxr-xr-x 2 root root 4096 Sep 6 22:07 compressed -rwxr-xr-x 1 root root 14570604 Sep 6 22:07 Image -rw-r--r-- 1 root root 147252 Sep 6 22:04 msm8974-v2-ef56s-pp10.dtb -rw-r--r-- 1 root root 1969 Sep 6 22:04 msmsamarium-rumi.dtb -rw-r--r-- 1 root root 2528 Sep 6 22:04 msmsamarium-sim.dtb -rwxr-xr-x 1 root root 6572544 Sep 6 22:07 zImage

root@ubuntu:/usr/android/a880s# ./dtbTool -v -s 2048 -o ./dt.img -p /usr/android/ /usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot DTB combiner: Input directory: '/usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot' Output file: './dt.img' Found file: msmsamarium-rumi.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag Found file: msmsamarium-sim.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag Found file: msm8974-v2-ef56s-pp10.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag => Found 0 unique DTB(s) root@ubuntu:/usr/android/a880s#

xiaolu commented 11 years ago

@hkfriends ./dtbTool -v -s 2048 -o ./dt.img -p /usr/android/ /usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot/ 这样试试

xiaolu commented 11 years ago

/usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot/ 末尾要加/ @hkfriends

hkfriends commented 11 years ago

good... it is working :)

I tested either -p or without -p is ok (as I already installed DTC by apt-get install device-tree-compiler

the output parameter must ended with "/"

Many thanks^^

Ok , then how can i use this dt.img and with my own zImage + ramdisk ==>to make my boot.img?

root@ubuntu:/usr/android/a880s# ./dtbTool -v -s 2048 -o ./dt.img -p /usr/android/dtc/ /usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot/ DTB combiner: Input directory: '/usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot/' Output file: './dt.img' Found file: msmsamarium-rumi.dtb ... chipset: 195, platform: 0, rev: 0 Found file: msmsamarium-sim.dtb ... chipset: 195, platform: 0, rev: 0 ... duplicate info, skipped Found file: msm8974-v2-ef56s-pp10.dtb ... chipset: 126, platform: 567, rev: 131072 additional chipset: 186, platform: 567, rev: 131072 additional chipset: 185, platform: 567, rev: 131072 => Found 4 unique DTB(s)

Generating master DTB... (writing '/usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot/msm8974-v2-ef56s-pp10.dtb' - 147456 bytes) (writing '/usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot/msmsamarium-rumi.dtb' - 2048 bytes) Total wrote 151552 bytes completed root@ubuntu:/usr/android/a880s# ./dtbTool -v -s 2048 -o ./dt.img /usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot/ DTB combiner: Input directory: '/usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot/' Output file: './dt.img' Found file: msmsamarium-rumi.dtb ... chipset: 195, platform: 0, rev: 0 Found file: msmsamarium-sim.dtb ... chipset: 195, platform: 0, rev: 0 ... duplicate info, skipped Found file: msm8974-v2-ef56s-pp10.dtb ... chipset: 126, platform: 567, rev: 131072 additional chipset: 186, platform: 567, rev: 131072 additional chipset: 185, platform: 567, rev: 131072 => Found 4 unique DTB(s)

Generating master DTB... (writing '/usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot/msm8974-v2-ef56s-pp10.dtb' - 147456 bytes) (writing '/usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot/msmsamarium-rumi.dtb' - 2048 bytes) Total wrote 151552 bytes completed root@ubuntu:/usr/android/a880s#

hkfriends commented 11 years ago

Ok , then how can i use this dt.img and with my own zImage + ramdisk ==>to make my boot.img?

It seems your script "mkboot" has no such handling paramter:

repack boot.img: mkboot [img] [ramdisk.gz or ramdisk dir] [newbootfile] mkboot boot.img ramdisk newboot.img unpack boot.img & decompress ramdisk: mkboot [img] [output dir] mkboot boot.img boot20130905

xiaolu commented 11 years ago

@hkfriends

For example,e330s:

      page_size      : 2048
      base_addr      : 0x00000000
      kernel size    : 6911360
      kernel_addr    : 0x00008000
      ramdisk_size   : 2685222
      ramdisk_addr   : 0x02000000
      second_size    : 0
      second_addr    : 0x00f00000
      dtb_size       : 1427456
      tags_addr      : 0x01e00000
      cmdline        : console=null androidboot.hardware=qcom user_debug=31 maxcpus=2 msm_rtb.filter=0x3F

make recovery.img:

    mkbootimg_dtb --kernel zImage --ramdisk ramdisk.gz --base 0x00000000 --offset 0x02000000 --tags-addr 0x01e00000 --dt dt.img --cmdline "console=null androidboot.hardware=qcom user_debug=31 maxcpus=2 msm_rtb.filter=0x3F"  -o recovery.img
hkfriends commented 11 years ago

it is strange: my dt.img is based on my own zImage to build, now myboot.img should be ok to boot... but i still got FAILED (remote: dtb not found)

./mkbootimg_dtb --kernel /usr/android/kernel/obj/KERNEL_OBJ/arch/arm/boot/zImage --ramdisk ./tmp/ramdisk.gz --base 0x00000000 --offset 0x02000000 --tags-addr 0x01e00000 --dt ./dt.img --cmdline "console=null androidboot.hardware=qcom user_debug=31 maxcpus=2 msm_rtb.filter=0x3F" -o myboot.img

H:\sdk>fastboot boot myboot.img downloading 'boot.img'... OKAY [ 0.297s] booting... FAILED (remote: dtb not found) finished. total time: 0.309s

xiaolu commented 11 years ago

@hkfriends --offset 0x02000000 --tags-addr 0x01e00000 --cmdline 这几个参数需要从原版boot,img获取 ./mkboot boot.img tmp就能获取到

hkfriends commented 11 years ago

Yes, the same as yours

root@ubuntu:/usr/android/a880s# ./mkboot boot.img tmptest Unpack & decompress boot.img to tmptest kernel : /usr/android/a880s/tmptest/zImage ramdisk : /usr/android/a880s/tmptest/ramdisk.gz page_size : 2048 base_addr : 0x00000000 kernel size : 6580376 kernel_addr : 0x00008000 ramdisk_size : 1955053 ramdisk_addr : 0x02000000 second_size : 0 second_addr : 0x00f00000 dtb_size : 157696 tags_addr : 0x01e00000 cmdline : console=ttyHSL0,115200,n8 androidboot.hardware=qcom user_debug=31 maxcpus=2 msm_rtb.filter=0x3F ehci-hcd.park=3 loglevel=0 Unpack completed.

hkfriends commented 11 years ago

I upload my files zImage ==> my own zImage dt.img ==> this dt.img is based on same (zImage+DTB) to build myboot.img

http://pan.baidu.com/share/link?shareid=1765365218&uk=1597028979

This is the stock boot.img (good image from original) http://pan.baidu.com/share/link?shareid=1785651282&uk=1597028979

xiaolu commented 11 years ago

@hkfriends 我对比了两个boot.img,官方用的dt和你的不太一样,建议你使用官方的dt.img+你的zImage+ramdisk打包试试

xiaolu commented 11 years ago

@hkfriends 官方用的是tp20.dts ,开源内核里编译用的是pp10,是不是这个原因呢。

qq20130908015059

hkfriends commented 11 years ago

官方的dt.img+new zImage+ramdisk打包 ==> OK

but another problem... now my device is very slow....... not normal I think the dt.img is not good for my new kernel zImage

hkfriends commented 11 years ago

i think i need to build my own dt.img but my own dt.img is not able to boot

what is the diff of tp20.dts and pp10

xiaolu commented 11 years ago

@hkfriends 你把编译得到的 *.ko放在/system/lib/modules/下了吗? 你的手机很慢和dt(device tree)应该没有关系的,可能是源码给的是比较老的,没有更好的优化过。

benjaminwan commented 11 years ago

@hkfriends TP20为主板的硬件版本,可以拆机查看主板,例如A840工程机主板型号WS20
20130529093125138

或者在/system/build.prop中可以找到ro.product.board_ver=TP20

从build.prop得出A880正式机主板型号为TP20,而其它型号可能为工程机。

在内核源代码include\pantech\BOARD_REV.h中指定需要编译的主板型号

define PT10 0X0010

define PT20 0X0020

define WS10 0X0030

define WS20 0X0040

define TP10 0X0050

define TP20 0X0060

define PP10 0X0070

define BOARD_VER TP10 (官方提供的源代码为TP10,可能用来测试工程机的,自己编译时应该改为TP20)

hkfriends commented 11 years ago

理解 , 讓我再試一次. 以前编译 a850,860,870 沒有這樣的問題..

ziyouwa commented 10 years ago

我这里运行dtbTool时发现这一句: /* Open the .dtb files in the specified path, decompile and extract "qcom,msm-id" parameter */ while ((dp = readdir(dir)) != NULL) { if ((dp->d_type == DT_REG)) { 上面这个if判断会导致无法识别我的dtb文件,注释掉这个判断就OK,求解:这个DT_REG是什么?在何处定义的?

xiaolu commented 10 years ago

@ziyouwa DT_REG 在 /usr/include/dirent.h定义。 表示这个是个常规文件,不是目录,不是符号链接,不是设备。

ziyouwa commented 10 years ago

@xiaolu 谢谢!还是不明白为什么识别不正确,的确是常规文件

nikich340 commented 9 years ago

Hello @xiaolu! I compiled dt.img from my msm8226-g2mds.dtb file in /arch/arm/boot/. But after I repacked boot.img and replaced dt.img in it and flash my phone did not boot! If I repack boot.img with stock dt.img phone working. In what can be problem? This is my kernel sources: https://github.com/NikitaProAndroid/android_kernel_lge_msm8226_g2mds/tree/cm-12.x My stock dt.img: https://yadi.sk/d/0N-k6tK2g38ys My own compiled dt.img: https://yadi.sk/d/li7GgtCQg396M

And what is VERy strange - they have the same size in bytes!! But with stock phone starting, with my - not starting...

nikich340 commented 9 years ago

I fix this problem using dtbToolCM with -2 parameter.

xiaolu commented 9 years ago

Ok.

pinglanke commented 7 years ago

@ziyouwa 我发现,在我的电脑分区文件系统为reiserfs时,d_type始终为0。那么,很可能是文件系统的问题。

dyteso commented 6 years ago

@xiaolu I am tried for a long time with this tool. I failed and failed to create dt.img using dtbTool. Today I tried dtbToolCM and it creates the dt.image succesfully.