diff options
author | Andrew Dodd <atd7@cornell.edu> | 2012-04-20 19:50:52 -0400 |
---|---|---|
committer | Andrew Dodd <atd7@cornell.edu> | 2012-04-20 19:51:42 -0400 |
commit | 7f623036a9c14e6c68171b36bd7a2e31f8796ae2 (patch) | |
tree | b0b7815517078bc788e5bb7fb31d7e3815cc2d29 | |
parent | 927ce94ade39ff03b1fa31ac15ac3616ef79197c (diff) | |
download | device_samsung_n7000-7f623036a9c14e6c68171b36bd7a2e31f8796ae2.zip device_samsung_n7000-7f623036a9c14e6c68171b36bd7a2e31f8796ae2.tar.gz device_samsung_n7000-7f623036a9c14e6c68171b36bd7a2e31f8796ae2.tar.bz2 |
Build stage2 initramfs into kernel.
Instead of attaching boot and recovery initramfs to the kernel, with a
header which must be scanned for, insert them into the builtin bootstrap
initramfs as cpio images.
Based on unhelpful's patch at:
https://github.com/CyanogenMod/android_device_samsung_galaxys2/commit/773b3a8dfdd6532e53380d4632b3682f6a80e2b9
Change-Id: Ie127fa0d1ef4e6ccb4c31ff5fdcdd719e1123feb
-rwxr-xr-x | mkshbootimg.py | 47 | ||||
-rwxr-xr-x | shbootimg.mk | 35 |
2 files changed, 30 insertions, 52 deletions
diff --git a/mkshbootimg.py b/mkshbootimg.py deleted file mode 100755 index dcc8294..0000000 --- a/mkshbootimg.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env python -import sys, os - -def copydata(outfile, infile): - while 1: - data = infile.read(512) - if (data): - outfile.write(data) - else: - break - -def alignoffset(outfile): - offset = outfile.tell() - outfile.seek((offset + 511) & ~511) - return outfile.tell() - -def appendimage(outfile, infile): - offset = alignoffset(outfile) - copydata(outfile, infile) - length = alignoffset(outfile) - offset - assert (offset % 512 == 0) - assert (length % 512 == 0) - return (offset/512, length/512) - -if len(sys.argv) < 4: - print "Usage:", sys.argv[0], "output kernel boot [recovery]" - sys.exit(1) - -outfile = open(sys.argv[1], 'wb') -kernel = open(sys.argv[2], 'r') -boot = open(sys.argv[3], 'r') -recovery = None -if (len(sys.argv) == 5): - recovery = open(sys.argv[4], 'r') -offset_table = "\n\nBOOT_IMAGE_OFFSETS\n" -copydata(outfile, kernel) -table_loc = alignoffset(outfile) -outfile.write('\x00' * 512) -offset_table += "boot_offset=%d;boot_len=%d;" % appendimage(outfile, boot) -if recovery: - offset_table += "recovery_offset=%d;recovery_len=%d;" % appendimage(outfile, recovery) -offset_table += "\n\n" -outfile.seek(table_loc) -outfile.write(offset_table) -outfile.flush() -os.fsync(outfile.fileno()) -outfile.close() diff --git a/shbootimg.mk b/shbootimg.mk index d0abf48..a83532f 100755 --- a/shbootimg.mk +++ b/shbootimg.mk @@ -1,9 +1,34 @@ +# +# Copyright (C) 2012 The CyanogenMod Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + LOCAL_PATH := $(call my-dir) INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img -$(INSTALLED_BOOTIMAGE_TARGET): $(PRODUCT_OUT)/kernel $(recovery_ramdisk) $(INSTALLED_RAMDISK_TARGET) $(PRODUCT_OUT)/utilities/flash_image $(PRODUCT_OUT)/utilities/busybox - $(call pretty,"Boot image: $@") - $(hide) ./device/samsung/galaxys2/mkshbootimg.py $@ $(PRODUCT_OUT)/kernel $(INSTALLED_RAMDISK_TARGET) $(recovery_ramdisk) -$(INSTALLED_RECOVERYIMAGE_TARGET): $(INSTALLED_BOOTIMAGE_TARGET) - $(ACP) $(INSTALLED_BOOTIMAGE_TARGET) $@ +uncompressed_ramdisk := $(PRODUCT_OUT)/ramdisk.cpio +$(uncompressed_ramdisk): $(INSTALLED_RAMDISK_TARGET) + zcat $< > $@ + +TARGET_KERNEL_BINARIES: $(KERNEL_OUT) $(KERNEL_CONFIG) $(KERNEL_HEADERS_INSTALL) $(recovery_uncompressed_ramdisk) $(uncompressed_ramdisk) + $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(TARGET_ARCH) $(ARM_CROSS_COMPILE) $(TARGET_PREBUILT_INT_KERNEL_TYPE) + $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(TARGET_ARCH) $(ARM_CROSS_COMPILE) modules + $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) INSTALL_MOD_PATH=../../$(KERNEL_MODULES_INSTALL) ARCH=$(TARGET_ARCH) $(ARM_CROSS_COMPILE) modules_install + +$(INSTALLED_BOOTIMAGE_TARGET): $(INSTALLED_KERNEL_TARGET) + $(ACP) -fp $< $@ + +$(INSTALLED_RECOVERYIMAGE_TARGET): $(INSTALLED_KERNEL_TARGET) + $(ACP) -fp $< $@ |