source: trunk/target/linux/x86/image/gen_image_olpc.sh @ 18279

Last change on this file since 18279 was 18279, checked in by florian, 7 years ago

[x86] merge the olpc target with the x86 target, both tested and running

  • Property svn:executable set to *
File size: 975 bytes
Line 
1#!/usr/bin/env bash
2# Copyright (C) 2006 - 2007 OpenWrt.org
3set -x
4[ $# == 5 ] || {
5    echo "SYNTAX: $0 <file> <kernel size> <kernel directory> <rootfs size> <rootfs image>"
6    exit 1
7}
8
9OUTPUT="$1"
10KERNELSIZE="$2"
11KERNELDIR="$3"
12ROOTFSSIZE="$4"
13ROOTFSIMAGE="$5"
14
15rm -f "$OUTPUT"
16
17head=16
18sect=63
19cyl=$(( ($KERNELSIZE + $ROOTFSSIZE) * 1024 * 1024 / ($head * $sect * 512)))
20
21# create partition table
22set `ptgen -o "$OUTPUT" -h $head -s $sect -p ${KERNELSIZE}m -p ${ROOTFSSIZE}m`
23
24KERNELOFFSET="$(($1 / 512))"
25KERNELSIZE="$(($2 / 512))"
26ROOTFSOFFSET="$(($3 / 512))"
27ROOTFSSIZE="$(($4 / 512))"
28
29BLOCKS="$((($KERNELSIZE / 2) - 1))"
30
31genext2fs -d "$KERNELDIR" -b "$BLOCKS" "$OUTPUT.kernel"
32dd if="$OUTPUT.kernel" of="$OUTPUT" bs=512 seek="$KERNELOFFSET" conv=notrunc
33[ -n "$PADDING" ] && dd if=/dev/zero of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc count="$ROOTFSSIZE"
34dd if="$ROOTFSIMAGE" of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc
35#rm -f "$OUTPUT.kernel"
Note: See TracBrowser for help on using the repository browser.