add missing '--pagesize', fix '--board' bug

pull/7/head
cfig 9 years ago
parent 78414cab0d
commit 601453ef84

@ -6,7 +6,7 @@ Utilies for editing Nexus(or Nexus compatible) devices boot.img , then you don't
## Prerequisite
#### Host OS requirement:
The recommended OS is Linux.
Linux or Mac.
#### Target Android requirement:
@ -16,6 +16,7 @@ The recommended OS is Linux.
- Marshmallow (API Level 23)
- Lollipop (API Level 21,22)
- AOSP master
You can get a full [Android version list](https://source.android.com/source/build-numbers.html) here.
@ -35,6 +36,7 @@ Your get the flattened kernel and /root filesystem under **$(CURDIR)/build/unzip
build/unzip_boot/
├── bootimg.json
├── kernel
├── second
└── root
Then you can edit the actual file contents, like rootfs or kernel.

@ -56,6 +56,8 @@ class CArgs {
ret.add("--board");
ret.add(board);
}
ret.add("--pagesize");
ret.add(Integer.toString(pagesize));
ret.add("--cmdline");
ret.add(cmdline);
if (null != os_version) {

@ -145,8 +145,13 @@ class Packer {
bf.putInt(0);
bf.putInt((parse_os_version(inArgs.os_version) << 11) | parse_os_patch_level(inArgs.os_patch_level))
bf.put(inArgs.board.getBytes())
bf.put(new byte[16 - inArgs.board.length()])
if (null == inArgs.board) {
bf.put(new byte[16]);
} else {
bf.put(inArgs.board.getBytes())
bf.put(new byte[16 - inArgs.board.length()])
}
bf.put(inArgs.cmdline.substring(0, Math.min(512, inArgs.cmdline.length())).getBytes())
bf.put(new byte[512 - Math.min(512, inArgs.cmdline.length())])
byte[] img_id = hashFile(inArgs.kernel, inArgs.ramdisk, inArgs.second)

@ -78,6 +78,9 @@ class Parser {
inImgInfo.os_patch_level = unparse_os_patch_level(os_and_patch & 0x7ff)
}
inImgInfo.board = new String(readBytes(is, 16), "UTF-8").trim();
if (0 == inImgInfo.board.length()) {
inImgInfo.board = null;
}
inImgInfo.cmdline = new String(readBytes(is, 512), "UTF-8")
inImgInfo.hash = readBytes(is, 32); //hash
inImgInfo.cmdline += new String(readBytes(is, 1024), "UTF-8")

@ -8,7 +8,7 @@ void Run(List<String> inCmd, String inWorkdir = null) {
ProcessBuilder pb = new ProcessBuilder(inCmd)
.directory(new File(inWorkdir))
.redirectErrorStream(true);
Process p = pb.start()
Process p = pb.start();
p.inputStream.eachLine {println it}
p.waitFor();
assert 0 == p.exitValue()

Loading…
Cancel
Save