pad all the files

r41129
suites/ascii
Martin Michlmayr 19 years ago
parent 44028829c8
commit b74a1c970a
  1. 17
      build/config/arm/ixp4xx/netboot.cfg
  2. 20
      build/util/arm/nslu2/pad

@ -9,13 +9,20 @@ MANIFEST-INITRD = "netboot initrd"
MANIFEST-KERNEL = "kernel image to netboot"
# byteswap boot loader, initrd and kernel for NSLU2
nslu2_initrd: $(INITRD) $(KERNEL)
devio "<<"/boot/apex.flash > $(TEMP)/apex.flash.swapped \
nslu2_swap: $(INITRD) $(KERNEL)
cp /boot/apex.flash $(TEMP)/apex.flash
util/arm/nslu2/pad $(TEMP)/apex.flash 131072 # 1 block
devio "<<"$(TEMP)/apex.flash > $(TEMP)/apex.flash.swapped \
'xp $$,4'
util/arm/nslu2/pad-initrd $(TEMP)
devio "<<"$(TEMP)/initrd.gz > $(TEMP)/initrd.gz.swapped
cp $(TEMP)/initrd.gz $(TEMP)/initrd.gz.nslu2
util/arm/nslu2/pad $(TEMP)/initrd.gz.nslu2 4194304 # 4 MB, taken randomly
devio "<<"$(TEMP)/initrd.gz.nslu2 > $(TEMP)/initrd.gz.swapped.nslu2
'xp $$,4'
devio "<<"$(TEMP)/$(KERNELNAME) > $(TEMP)/$(KERNELNAME).swapped \
cp $(TEMP)/$(KERNELNAME) $(TEMP)/$(KERNELNAME).nslu2
# Let's pad the kernel to 131072 * 10 + 1 so it will be rounded up
# by slugimage to 131072 * 11, i.e. 11 blocks.
util/arm/nslu2/pad $(TEMP)/$(KERNELNAME).nslu2 1310724
devio "<<"$(TEMP)/$(KERNELNAME).nslu2 > $(TEMP)/$(KERNELNAME).nslu2.swapped \
'xp $$,4'
# Generate an image for Linksys NSLU2 which can be flashed

@ -1,22 +1,16 @@
#!/bin/sh
TEMP=$1
FILE=$1
SIZE=$2
if [ -z "$TEMP" ]; then
echo "Usage: "pad-initrd PATH""
if [ -z "$FILE" ]; then
echo "Usage: "pad-initrd FILE SIZE""
exit 1
fi
if [ ! -e $TEMP/initrd.gz ]; then
echo "initrd.gz does not exist at $TEMP"
exit 1
fi
size=$(wc -c $TEMP/initrd.gz | cut -d " " -f 1)
mod=$(($size % 4))
pad=$((4 - $mod))
fsize=$(wc -c $FILE | cut -d " " -f 1)
pad=$(expr $SIZE - $fsize)
if [ $pad -gt 0 ]; then
tmp=$TEMP/initrd.padding
dd if=/dev/zero of=$tmp bs=1 count=$pad
cat $tmp >> $TEMP/initrd.gz
dd if=/dev/zero bs=1 count=$pad 2>/dev/null >> $FILE
fi

Loading…
Cancel
Save