[{"data":1,"prerenderedAt":273},["ShallowReactive",2],{"\u002Fblog\u002F2012\u002Fupdate-zip":3,"\u002Fblog\u002F2012\u002Fupdate-zip-surround":262},{"id":4,"title":5,"author":6,"badge":11,"body":13,"date":250,"description":251,"draft":252,"extension":253,"image":254,"meta":256,"navigation":257,"path":258,"seo":259,"stem":260,"__hash__":261},"posts\u002Fblog\u002F2012\u002Fupdate-zip.md","Create an update.zip file",{"name":7,"to":8,"avatar":9},"Nir Galon","https:\u002F\u002Fx.com\u002Fnirgn975",{"src":10},"\u002Favatar.webp",{"label":12},"android",{"type":14,"value":15,"toc":246},"minimark",[16,20,29,34,40,65,70,96,144,147,220,232,236,239,242],[17,18,19],"p",{},"I assume the most common and lighthearted example is the battery mod. For some reason in Android (don't ask me why, I don't know) the battery doesn't have percentages, only a drawing that gives us a (pretty rough) estimate of the battery's state (even though the system knows exactly how many percent it has, they're just not shown in the top bar). That's why the most popular file people flash is the \"battery with percentages\" mod (and sometimes a different battery drawing too).",[17,21,22,23,28],{},"Note that you can see in the post ",[24,25,27],"a",{"href":26},"\u002Fblog\u002F2012\u002Fanalyze-an-apk-file\u002F","Analyze an Apk file"," a bit more information about opening and modifying applications (apk files). In addition, I'll mention that this guide is general, you can put inside the zip file a boot animation, an apk we modified, a mod to change the battery display, basically anything. In this case I'll demonstrate with a BootAnimation file I created for myself.",[30,31,33],"h2",{"id":32},"_1-how-do-you-build-a-zip-file-that-can-be-flashed-in-recovery","1. How do you build a zip file that can be flashed in recovery?",[17,35,36],{},[37,38,39],"strong",{},"Step one, preparations:",[41,42,43,47,57],"ul",{},[44,45,46],"li",{},"The first thing we need is the file \u002F files we want to add to the Rom (in my case it's the file I prepared for myself: BootAnimation.zip).",[44,48,49,50,56],{},"Now we need to download the Testsign.jar file which will help us sign the zip, and it can be downloaded ",[24,51,55],{"href":52,"rel":53},"https:\u002F\u002Fcode.google.com\u002Fp\u002Fzen-droid\u002Fdownloads\u002Fdetail?name=testsign.jar&can=2&q=label%3AType-Executable",[54],"nofollow","from here",".",[44,58,59,60,64],{},"And last, we need to decide where (to which path) the files we want to add will go (in my case to the path ",[61,62,63],"code",{},"system\u002Fmedia\u002F",").",[17,66,67],{},[37,68,69],{},"Let's get to work:",[71,72,73,76,93],"ol",{},[44,74,75],{},"Open a folder with the name of the path it's going to. In this example we need to prepare a folder called media, and put the BootAnimation.zip file inside it. Note that it doesn't matter where we prepare the folder, you can open a new folder anywhere you'd like, even just on the desktop.",[44,77,78,79,82,83,88,89,92],{},"Now we need to prepare a few more folders, following the path ",[61,80,81],{},"META-INF\u002Fcom\u002Fgoogle\u002Fandroid",", and inside it open a new text file in ",[24,84,87],{"href":85,"rel":86},"http:\u002F\u002Fwww.sublimetext.com\u002F2",[54],"Sublime"," and name it ",[61,90,91],{},"update-script",". This is the path Recovery goes to look for the update-script file, and it will read this file for the instructions, or \"what to do\".",[44,94,95],{},"Open the file and copy into it:",[97,98,104],"pre",{"className":99,"code":100,"filename":101,"language":102,"meta":103,"style":103},"language-shell shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","ui_print(\"Applying New Bootanimation\");\nrun_program(\"\u002Fsbin\u002Fbusybox\", \"mount\", \"\u002Fsystem\");\ndelete(\"\u002Fsystem\u002Fmedia\u002Fbootanimation.zip\");\npackage_extract_dir(\"media\", \"\u002Fsystem\u002Fmedia\");\nrun_program(\"\u002Fsbin\u002Fbusybox\", \"umount\", \"\u002Fsystem\");\nui_print(\"New Bootanimation Installed\");\n","update-script.txt","shell","",[61,105,106,114,120,126,132,138],{"__ignoreMap":103},[107,108,111],"span",{"class":109,"line":110},"line",1,[107,112,113],{},"ui_print(\"Applying New Bootanimation\");\n",[107,115,117],{"class":109,"line":116},2,[107,118,119],{},"run_program(\"\u002Fsbin\u002Fbusybox\", \"mount\", \"\u002Fsystem\");\n",[107,121,123],{"class":109,"line":122},3,[107,124,125],{},"delete(\"\u002Fsystem\u002Fmedia\u002Fbootanimation.zip\");\n",[107,127,129],{"class":109,"line":128},4,[107,130,131],{},"package_extract_dir(\"media\", \"\u002Fsystem\u002Fmedia\");\n",[107,133,135],{"class":109,"line":134},5,[107,136,137],{},"run_program(\"\u002Fsbin\u002Fbusybox\", \"umount\", \"\u002Fsystem\");\n",[107,139,141],{"class":109,"line":140},6,[107,142,143],{},"ui_print(\"New Bootanimation Installed\");\n",[17,145,146],{},"And the last step is to understand what we wrote, for that we'll break the code down line by line and explain what's going on here:",[41,148,149,159,172,184,199,211],{},[44,150,151,154,155,158],{},[37,152,153],{},"The first line:"," ",[61,156,157],{},"ui_print(\"Applying New Bootanimation\");"," prints what's inside the quotes (which are inside the parentheses). This line isn't essential, the file will work without it too, but it's more elegant, clean, and lets whoever installs the script understand what's happening right now.",[44,160,161,154,164,167,168,171],{},[37,162,163],{},"The second line:",[61,165,166],{},"run_program(\"\u002Fsbin\u002Fbusybox\", \"mount\", \"\u002Fsystem\");"," runs busybox which makes the ",[61,169,170],{},"system\u002F"," folder writable (so we can write to it).",[44,173,174,154,177,180,181,183],{},[37,175,176],{},"The third line:",[61,178,179],{},"delete(\"\u002Fsystem\u002Fmedia\u002Fbootanimation.zip\");"," deletes the bootAnimation.zip file located at the path ",[61,182,63],{}," (so we can write the new file).",[44,185,186,154,189,192,193,196,197,56],{},[37,187,188],{},"In the fourth line:",[61,190,191],{},"package_extract_dir(\"media\", \"\u002Fsystem\u002Fmedia\");"," we tell the device to find, inside our file (the Package), the ",[61,194,195],{},"media"," folder (inside the folder where we put the bootAnimation.zip file) and move its contents to the path ",[61,198,63],{},[44,200,201,154,204,207,208,210],{},[37,202,203],{},"In the fifth line:",[61,205,206],{},"run_program(\"\u002Fsbin\u002Fbusybox\", \"umount\", \"\u002Fsystem\");"," we run busybox again and give it the umount command on the ",[61,209,170],{}," folder.",[44,212,213,154,216,219],{},[37,214,215],{},"The sixth line:",[61,217,218],{},"ui_print(\"New Bootanimation Installed\");"," like the first line, prints a message to the user.",[17,221,222,226,227,56],{},[223,224,225],"em",{},"Tip:"," A guy on XDA wrote a small program that can do this whole process for you. It's always better to know how everything is done and the lines of code, but this is a fairly technical operation, and the program definitely helps save time and simplify the process (especially for people who do this every day). In addition, the program has a few more options that can help. Here's the ",[24,228,231],{"href":229,"rel":230},"http:\u002F\u002Fforum.xda-developers.com\u002Fshowthread.php?t=1248486",[54],"link to the post on XDA",[30,233,235],{"id":234},"_2-summary","2. Summary",[17,237,238],{},"In a few steps you've prepared a file that can be flashed through Recovery and in which you can put anything you want (new Apk files to flash, replacing existing apk files, various mods, add-ons, a new Rom, etc.).",[17,240,241],{},"Note, that when you're changing something existing, for example an Apk file, you need to delete the old file first, and only then copy the new Apk file (as I demonstrated in this case, the delete line comes before the copy line for the file). If it's new files you simply need to copy them and not write the delete line.",[243,244,245],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":103,"searchDepth":116,"depth":116,"links":247},[248,249],{"id":32,"depth":116,"text":33},{"id":234,"depth":116,"text":235},"2012-12-16","Building a flashable update.zip file for Android Recovery in 5 steps.",false,"md",{"src":255},"\u002Fposts\u002F2020\u002Fjekyll-starter-kit-generator-3.x.x\u002Fgithub-social-coding.webp",{},true,"\u002Fblog\u002F2012\u002Fupdate-zip",{"title":5,"description":251},"blog\u002F2012\u002Fupdate-zip","QoG06nYys8OTRTNr3_UdcRWc9EXUd8duV39Z9_uD1CM",[263,268],{"title":264,"path":265,"stem":266,"description":267,"children":-1},"A little bit of Android Grammar","\u002Fblog\u002F2012\u002Flittle-android-bit-grammar","blog\u002F2012\u002Flittle-android-bit-grammar","A tour of Android's architecture: kernel, Dalvik, ADB, bootloader, and root.",{"title":269,"path":270,"stem":271,"description":272,"children":-1},"The Fun Part of Android","\u002Fblog\u002F2013\u002Ffun-part-android","blog\u002F2013\u002Ffun-part-android","How Android APKs are built, modified, and reverse-engineered with smali.",1786001638688]