Ändra xml i update.zip

Diskussion i 'Frågor, support och diskussion' startad av robboten, 23 aug 2009.

  1. robboten

    robboten Teen Droid Medlem

    Blev medlem:
    19 jun 2009
    Inlägg:
    411
    Mottagna gillanden:
    28

    MINA ENHETER

    Jag skulle vilja veta lite mer om update.zip.
    T ex, kan man ändra i en xml-fil för att bestämma redan innan flashning vilka widgets som ligger var?
    I så fall, vilken xml är detta i och hur editera denna?

    Eller i allmänhet har jag problem att öppna xml-filerna från update.zip.
    Öppnar jag i notepad ser du binärt ut och öppnar jag i eclipse säger den bara att filen är tom. Hur ändrar ni i xml-filerna (någon lär ju ha pillat med det iaf... ).
     
  2. TheNano

    TheNano Senior Droid Medlem

    Blev medlem:
    8 jun 2009
    Inlägg:
    1 709
    Mottagna gillanden:
    0

    MINA ENHETER

    Android Recovery Mode

    (muddogxp original, reprint please specify)


    About Recovery

    Recovery mode to use Android for restoration of factory settings, OTA upgrade, patch and upgrade firmware upgrade.

    General upgrade package by running the upgrade script to perform the META-INF/com/google/android/update-script custom upgrade script is a set of recovery system can identify the UI control, file system commands, such as write_raw_image (write FLASH district), copy_dir (copied directory). The package has been downloaded to the general SDCARD and under CACHE district. If interested in the contents of the package, you can download from http://forum.xda-developers.com/showthread.php?t=442480 upgrade package to look at the JF.

    Upgrade packages are also related to the digital signature, the signature approach and the general poor good sign JAR files. Public key will be compiled into a hard recovery, compile-time generated in: out / target / product / XX / obj / PACKAGING / ota_keys_inc_intermediates / keys.inc
    G1 start of the three models

    MAGIC KEY:

    *

    camera + power: bootloader mode, ADP-ri fastboot mode you can use
    *

    home + power: recovery mode
    *

    Normal start

    Bootloader normal start, and three ways, according to BCB (Bootloader Control Block, the next section) of the command Category:

    *

    command == 'boot-recovery' → start recovery.img. recovery mode
    *

    command == 'update-radio/hboot' → update firmware (bootloader)
    *

    → start other boot.img

    Recovery relates to other systems and documents

    *
    CACHE zoning documentation

    Recovery tool for NAND cache partition through the three documents and to deal with the main system. The main system (including restoration of factory settings and OTA upgrade) can be written into the order required for recovery, the recovery time course of the LOG and intent.
    o

    / cache / recovery / command: recovery order, write from the main system. All orders are as follows:
    +

    - send_intent = anystring - write the text out to recovery.intent
    +

    - update_package = root: path - verify install an OTA package file
    +

    - wipe_data - erase user data (and cache), then reboot
    +

    - wipe_cache - wipe cache (but not user data), then reboot
    o

    / cache / recovery / log: recovery process log, to read out from the main system
    o

    / cache / recovery / intent: recovery output intent
    *
    MISC district content

    Bootloader Control Block (BCB) storage recovery bootloader message. Is structured as follows:

    struct bootloader_message (

    char command [32];

    char status [32]; / / unknown use

    char recovery [1024];

    );
    o

    command can have the following two values

    "Boot-recovery": marked recovery in progress, or the instructions to enter the recovery mode should bootloader

    "Update-hboot/radio": instructions bootloader update firmware
    o

    recovery content

    "Recovery \ n

    <recovery command> \ n

    <recovery command> "

    One recovery command for CACHE: / recovery / command command


    Recovery Case two

    *
    FACTORY RESET (to restore factory settings)

    1.

    The user to choose "restore factory settings"
    2.

    System will be set up "- wipe_data" command to write / cache / recovery / command
    3.

    System restart, and go to recover mode (/ sbin / recovery)
    4.

    get_args () will be "boot-recovery" and "- wipe_data" write BCB
    5.

    erase_root () to format (erase) DATA Zoning
    6.

    erase_root () to format (erase) CACHE Zoning
    7.

    finish_recovery () Erase BCB
    8.

    Reboot the system

    *
    OTA INSTALL (OTA upgrade)

    1.
     
  3. TheNano

    TheNano Senior Droid Medlem

    Blev medlem:
    8 jun 2009
    Inlägg:
    1 709
    Mottagna gillanden:
    0

    MINA ENHETER

    OTA download to upgrade the system package to / cache / some-filename.zip
    2.

    Into the recovery command to upgrade the system "- update_package = CACHE: some-filename.zip"
    3.

    Restart, and go to recovery mode
    4.

    get_args () will be "boot-recovery" and "- update_package =..." write BCB
    5.

    install_package () for upgrading
    6.

    finish_recovery () Erase BCB
    7.

    ** If the package failed to install ** prompt_and_wait () to wait for user to choose ALT + S or ALT + W to upgrade or restore the factory settings
    8.

    main () calls maybe_install_firmware_update ()
    1.

    If the bag has hboot / radio's firmware will continue, otherwise return
    2.

    Will be "boot-recovery" and "- wipe_cache" write BCB
    3.

    Firmware image will be written into the cache partition
    4.

    Will be "update-radio/hboot" and "- wipe_cache" write BCB
    5.

    Reboot the system
    6.

    its own bootloader to update firmware
    7.

    bootloader will be "boot-recovery" into the BCB
    8.

    erase_root () Erase partition CACHE
    9.

    Clear BCB
    9.

    main () call reboot () reboot the system


    Recovery mode processes


    / init → init.rc → / sbin / recovery →

    main (): recovery.c


    *

    ui_init (): ui.c [UI initialize]
    o

    gr_init (): minui / graphics.c [set tty0 to graphic mode, open fb0]
    o

    ev_init (): minui / events.c [open / dev / input / event *]
    o

    res_create_surface: minui / resource.c [create surfaces for all bitmaps used later, include icons, bmps]
    o

    create 2 threads: progress / input_thread [create progress show and input event handler thread]
    *

    get_args (): recovery.c
    o

    get_bootloader_message (): bootloader.c [read mtdblock0 (misc partition) 2nd page for commandline]
    o

    check if nand misc partition has boot message. If yes, fill argc / argv.
    o

    If no, get arguments from / cache / recovery / command, and fill argc / argv.
    o

    set_bootloader_message (): bootloader.c [set bootloader message back to mtdblock0]
    *

    Parser argv [] filled above
    *

    register_update_commands (): commands.c [register all commands with name and hook function]
    o

    registerCommand (): commands.c
    +

    Register command with name, hook, type, cookie.
    +

    Commands, eg: assert, delete, copy_dir, symlink, write_raw_image.
    o

    registerFunction (): commands.c
    +

    Register function with name, hook, cookie.
    +

    Function, eg: get_mark, matches, getprop, file_contains
    *

    install_package ():
    o

    translate_root_path (): roots.c [ "SYSTEM: lib" and turns it into a string like "/ system / lib", translate the updater.zip path]
    o

    mzOpenZipArchive (): zip.c [open updater.zip file (uncompass)]
    o

    handle_update_package (): install.c
    +

    verify_jar_signature (): verifier.c [verify signature with keys.inc key; verify manifest and zip package archive]
    #

    verifySignature () [verify the signature file: CERT.sf / rsa.]
    *

    digestEntry (): verifier.c [get SHA-1 digest of CERT.sf file]
    *

    RSA_verify (public key: keys.inc, signature: CERT.rsa, CERT.sf 's digest): libc / rsa.c [Verify a 2048 bit RSA PKCS1.5 signature against an expected SHA-1 hash. Use public key to decrypt the CERT.rsa to get original SHA digest, then compare to digest of CERT.sf]
    #

    verifyManifest () [Get manifest SHA1-Digest from CERT.sf. Then do digest to MANIFEST.MF. Compare them]
    #

    verifyArchive () [verify all the files in update.zip with digest listed in MANIFEST.MF]
    +

    find_update_script (): install.c [find META-INF/com/google/android/update-script updater script]
    +

    handle_update_script (): install.c [read cmds from script file, and do parser, exec]
    #

    parseAmendScript (): amend.c [call yyparse () to parse to command]
    #

    exeCommandList (): install.c
    *

    exeCommand (): execute.c [call command hook function]
    *

    erase DATA / CACHE partition
    *

    prompt_and_wait (): recovery.c [wait for user input: 1) reboot 2) update.zip 3) wipe data]
    o

    ui_key_xxx get ALT + x keys
    o

    1) do nothing
    o

    2) install_package ( 'SDCARD: update.zip')
    o

    3) erase_root () → format_root_device () DATA / CACHE
    *

    may_install_firmware_update (): firmware.c [remember_firmware_update () is called by write_hboot / radio_image command, it stores the bootloader image to CACHE partition, and write update-hboot/radio command to MISC partition for bootloader message to let bootloader update itself after reboot]
    o

    set_bootloader_message ()
    o

    write_update_for_bootloader (): bootloader.c [write firmware image into CACHE partition with update_header, busyimage and failimage]
    *

    finish_recovery (): recovery.c [clear the recovery command and prepare to boot a (hopefully working) system, copy our log file to cache as well (for the system to read), and record any intent we were asked to communicate back to the system.]
    *

    reboot ()


    Recovery mode flowchart

    The following flow chart mapping the system boot loader from the conduct of the process after the bootloader.
     
  4. robboten

    robboten Teen Droid Medlem

    Blev medlem:
    19 jun 2009
    Inlägg:
    411
    Mottagna gillanden:
    28

    MINA ENHETER

    Tack för ditt svar. Men jag förstår inte hur recovery mode-guide kan hjälpa mig att förstå xml-filer i update.zip.

    Var jag otydlig kanske. Jag menar alltså hur jag kan ändra i en befintlig rom (update.zip) så att de widgets jag vill ha ligger på rätt ställe efter flash (t ex).

    Eller hur tänkte du theNano?
     
    Last edited: 23 aug 2009
  5. ZilverZurfarn

    ZilverZurfarn Adult Droid Medlem

    Blev medlem:
    10 jun 2009
    Inlägg:
    909
    Mottagna gillanden:
    276
    Telefon:
    Redmi Note 9 Pro

    MINA ENHETER

    Telefon:
    Redmi Note 9 Pro
    Platta:
    Huawei Mediapad T1
    De XMLer som finns i APK och updates är kompilerade och inte "human readable", vilket gör dem en PITA att ändra i.

    /Mats
     
  6. robboten

    robboten Teen Droid Medlem

    Blev medlem:
    19 jun 2009
    Inlägg:
    411
    Mottagna gillanden:
    28

    MINA ENHETER

    Tack ZilverZurfarn, då förstår jag.
    Finns det annat sätt att säga till en ROM var widgets ska ligga?
    Har sett att olika ROMs har olika ställen och olika widgets...
     
  7. ZilverZurfarn

    ZilverZurfarn Adult Droid Medlem

    Blev medlem:
    10 jun 2009
    Inlägg:
    909
    Mottagna gillanden:
    276
    Telefon:
    Redmi Note 9 Pro

    MINA ENHETER

    Telefon:
    Redmi Note 9 Pro
    Platta:
    Huawei Mediapad T1
    Jag förstår inte problemet riktigt - så länge jag inte gör en wipe, ligger de widgets jag har kvar där de är. Gör du en wipe skulle jag föreställa mig att det är betydligt mindre jobb att placera ut widgets för hand, än att uppdatera uppdateringen och få den att göra det åt dig.

    /Mats
     
  8. robboten

    robboten Teen Droid Medlem

    Blev medlem:
    19 jun 2009
    Inlägg:
    411
    Mottagna gillanden:
    28

    MINA ENHETER

    Jo jag vet, men det är mest bara av intresse jag undrar. Leka lite liksom.. :)
     
  9. ZilverZurfarn

    ZilverZurfarn Adult Droid Medlem

    Blev medlem:
    10 jun 2009
    Inlägg:
    909
    Mottagna gillanden:
    276
    Telefon:
    Redmi Note 9 Pro

    MINA ENHETER

    Telefon:
    Redmi Note 9 Pro
    Platta:
    Huawei Mediapad T1
    En nog så god anledning som något annat. Det jag har sett av redigering av XML-er, får man in och pilla med Hex-editor. Det finns en tutorial på XDA-Developers (i Theme-forumet för Dream) där det gås igenom, men jag blev inte mycket klokare, måste jag säga.

    /Mats
     
  10. robboten

    robboten Teen Droid Medlem

    Blev medlem:
    19 jun 2009
    Inlägg:
    411
    Mottagna gillanden:
    28

    MINA ENHETER

    Haha. Nä jag kollade på den oxå. Kan inte säga att jag förstod något heller.
    Får helt enkelt leka med något annat tills någon rotat mer i det.
    Tack iaf för hjälpen.