Android Build--Make otapackage (boot image)

Source: Internet
Author: User

$ (built_target_files_package):                  $ (Installed_bootimage_target)                   $ (Installed_radioimage_target)                   $ (Installed_recoveryimage_target)                  $ ( Installed_systemimage)                   $ (Installed_userdataimage_target)                   $ (Installed_android_info_txt_target)                   $ (Built_ota_tools)                    $ (Apkcerts_file)                   $ (host_out_executables)/fs_config                  | $ (ACP)

In the previous blog post, we found that $ (built_target_files_package) depends on the object after the colon (":"), such as $ (installed_bootimage_target), and so on. That is to say $ (installed_bootimage_target) must exist, then $ (built_target_files_package) to generate. This article is intended to analyze how $ (installed_bootimage_target) is generated. That is how boot.img is generated.

ifneq  ($ (strip $ (Target_no_kernel)), true) # ---------------------------------------------------- -------------# the boot image, which is a collection of other  images. internal_bootimage_args :=         $ (Addprefix --second  ,$ (installed_2ndbootloader_target))          --kernel $ (installed_kernel_target)          --ramdisk $ (INSTALLED_ Ramdisk_target) internal_bootimage_files := $ (filter-out --%,$ (Internal_bootimage_args)) BOARD_ kernel_cmdline := $ (strip $ (board_kernel_cmdline)) ifdef board_kernel_cmdline   internal_bootimage_args += --cmdline  "$ (board_kernel_cmdline)" endifboard_kernel_base :=  $ (strip $ (board_kernel_base)) ifdef board_kernel_base  internal_bootimage_args + = --base $ (board_kernel_base) endifboard_kernel_pagesize := $ (strip $ (BOARD_KERNEL_PAGESIZE)) ifdef  board_kernel_pagesize  internal_bootimage_args += --pagesize $ (BOARD_KERNEL_ PAGESIZE) endifinstalled_bootimage_target := $ (product_out)/boot.imgifeq  ($ (TARGET_BOOTIMAGE_USE _EXT2), True) tmp_dir_for_image := $ (call intermediates-dir-for,executables,boot_img)/ bootimginternal_bootimage_args += --tmpdir $ (tmp_dir_for_image) INTERNAL_BOOTIMAGE_ARGS +=  --genext2fs $ (mkext2img) $ (installed_bootimage_target):  $ (mkext2img)  $ (INTERNAL_BOOTIMAGE_ FILES)         $ (Call pretty, "target boot image: [ Email protected]         $ (hide)  $ (MKEXT2BOOTIMG)  $ ( Internal_bootimage_args)  --output [email protected]else # target_bootimage_use_ext2  != true$ (installed_Bootimage_target):  $ (mkbootimg)  $ (internal_bootimage_files)          $ (Call pretty, "target boot image: [email protected]")          $ (hide)  $ (mkbootimg)  $ (Internal_bootimage_args)  --output [ email protected]        $ (hide)  $ (call  assert-max-image-size,[email protected],$ (board_bootimage_partition_size), raw) endif # TARGET_ Bootimage_use_ext2else    # target_no_kernel# hack: the top-level  targets depend on the bootimage.  not all targets# can  produce a bootimage, though, and emulator targets need the  Ramdisk# instead.  fake it out by calling the ramdisk the  bootimage.# todo: make the emulator use bootimages, and make mkbootimg accept#        kernel-less inputs. installed_bootimage_target := $ (Installed_ramdisk_target) endif


1 lines: $ (target_no_kernel) not defined, so this judging condition is true. Execute the code in IFNEQ <--> else.

27 Line: Installed_bootimage_target: = $ (product_out)/boot.img

That's the goal we're going to build.

39 Rows: Generate BOOT.IMG-dependent objects and command scripts that generate BOOT.IMG. where $ (internal_bootimage_files) is the object we need to focus on. is also the most important dependent object. It's defined in line 10th.

10 lines: $ (internal_bootimage_files) is the object identified by the symbol "--" in $ (Internal_bootimage_args).

--kernel $ (installed_kernel_target)--ramdisk $ (installed_ramdisk_target)

Two objects: $ (installed_kernel_target) and $ (installed_ramdisk_target)

$ (Installed_kernel_target) is also zimage

$ (installed_ramdisk_target) is ramdisk.img

So where is $ (installed_kernel_target) defined? Build/target/board/android.mk

IFNEQ ($ (Strip $ (Target_no_kernel)), true) Installed_kernel_target: = $ (product_out)/kernelelse Installed_kernel_ TARGET: =endif-include $ (target_device_dir)/androidboard.mk

Here we have to pay attention not only to line 2nd, but also to the 6th line. This is explained later in how to add Linux kernel to the AOSP compiler system. You can skip this first.


We continue to analyze how ramdisk.img is generated.

# ################################################################## targets for boot/os  images# ################################################################## ------------------- ----------------------------------------------# the ramdiskinternal_ramdisk_files := $ ( filter $ (target_root_out)/%,         $ (ALL_PREBUILT)           $ (all_copied_headers)           $ (all_generated_sources)          $ (ALL_DEFAULT_ installed_modules)) built_ramdisk_target := $ (product_out)/ramdisk.img# we just build  this directly to the install location. installed_ramdisk_target := $ (Built_ramdisk_target) $ (installed_ramdisk_target):  $ (MKBOOTFS)  $ (internal_ramdisk_files)  | $ (minigzip)         $ (Call pretty, "target ram disk: [email protected]" )         $ (hide)  $ (mkbootfs)  $ (target_root_out)  |  $ (minigzip)  > [email protected]

By this point the entire boot.img generation has been finished from the big outline. So what's the small outline? Here's a small outline I mean some details, such as $ (all_prebuilt), $ (all_copied_headers) ... What's that? These will be discussed in detail in other chapters.

This article is from the "Android" blog, so be sure to keep this source http://rosemary.blog.51cto.com/9548014/1771553

Android Build--Make otapackage (boot image)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.