Changeset 33511


Ignore:
Timestamp:
2012-09-22T22:10:35+02:00 (5 years ago)
Author:
nbd
Message:

x86: split generic image building into a separate script

Location:
trunk/target/linux/x86/image
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/x86/image/gen_image_generic.sh

    r33510 r33511  
    11#!/usr/bin/env bash 
    2 # Copyright (C) 2006-2010 OpenWrt.org 
    3 set -x  
    4 [ $# == 5 ] || { 
    5     echo "SYNTAX: $0 <file> <kernel size> <kernel directory> <rootfs size> <rootfs image>" 
     2# Copyright (C) 2006-2012 OpenWrt.org 
     3set -x 
     4[ $# == 5 -o $# == 6 ] || { 
     5    echo "SYNTAX: $0 <file> <kernel size> <kernel directory> <rootfs size> <rootfs image> [<align>]" 
    66    exit 1 
    77} 
     
    1212ROOTFSSIZE="$4" 
    1313ROOTFSIMAGE="$5" 
     14ALIGN="$6" 
    1415 
    1516rm -f "$OUTPUT" 
     
    2021 
    2122# create partition table 
    22 set `ptgen -o "$OUTPUT" -h $head -s $sect -p ${KERNELSIZE}m -p ${ROOTFSSIZE}m` 
     23set `ptgen -o "$OUTPUT" -h $head -s $sect -p ${KERNELSIZE}m -p ${ROOTFSSIZE}m ${ALIGN:+-l $ALIGN}` 
    2324 
    2425KERNELOFFSET="$(($1 / 512))" 
     
    2930BLOCKS="$((($KERNELSIZE / 2) - 1))" 
    3031 
     32[ -n "$PADDING" ] && dd if=/dev/zero of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc count="$ROOTFSSIZE" 
     33dd if="$ROOTFSIMAGE" of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc 
     34 
     35[ -n "$NOGRUB" ] && exit 0 
     36 
    3137genext2fs -d "$KERNELDIR" -b "$BLOCKS" "$OUTPUT.kernel" 
    3238dd 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" 
    34 dd if="$ROOTFSIMAGE" of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc 
    3539rm -f "$OUTPUT.kernel" 
  • trunk/target/linux/x86/image/gen_image_grub.sh

    r33510 r33511  
    11#!/usr/bin/env bash 
    22# Copyright (C) 2006-2010 OpenWrt.org 
    3 set -x  
    4 [ $# == 5 ] || { 
    5     echo "SYNTAX: $0 <file> <kernel size> <kernel directory> <rootfs size> <rootfs image>" 
    6     exit 1 
    7 } 
    8  
    9 OUTPUT="$1" 
    10 KERNELSIZE="$2" 
    11 KERNELDIR="$3" 
    12 ROOTFSSIZE="$4" 
    13 ROOTFSIMAGE="$5" 
    14  
    15 rm -f "$OUTPUT" 
    16  
    17 head=16 
    18 sect=63 
    19 cyl=$(( ($KERNELSIZE + $ROOTFSSIZE) * 1024 * 1024 / ($head * $sect * 512))) 
    20  
    21 # create partition table 
    22 set `ptgen -o "$OUTPUT" -h $head -s $sect -p ${KERNELSIZE}m -p ${ROOTFSSIZE}m` 
    23  
    24 KERNELOFFSET="$(($1 / 512))" 
    25 KERNELSIZE="$(($2 / 512))" 
    26 ROOTFSOFFSET="$(($3 / 512))" 
    27 ROOTFSSIZE="$(($4 / 512))" 
    28  
    29 BLOCKS="$((($KERNELSIZE / 2) - 1))" 
    30  
    31 [ -n "$PADDING" ] && dd if=/dev/zero of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc count="$ROOTFSSIZE" 
    32 dd if="$ROOTFSIMAGE" of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc 
    33  
    34 [ -n "$NOGRUB" ] && exit 0 
    35  
    36 genext2fs -d "$KERNELDIR" -b "$BLOCKS" "$OUTPUT.kernel" 
    37 dd if="$OUTPUT.kernel" of="$OUTPUT" bs=512 seek="$KERNELOFFSET" conv=notrunc 
    38 rm -f "$OUTPUT.kernel" 
     3. ./gen_image_generic.sh 
    394 
    405which chpax >/dev/null && chpax -zp $(which grub) 
Note: See TracChangeset for help on using the changeset viewer.