mirror of
https://github.com/linuxkit/linuxkit.git
synced 2026-01-15 15:33:03 +00:00
This saves a lot of duplicated nasty Makefile code, means and generally cleans things up. Signed-off-by: Justin Cormack <justin.cormack@docker.com>
27 lines
404 B
Bash
Executable File
27 lines
404 B
Bash
Executable File
#!/bin/sh
|
|
|
|
cd /tmp
|
|
|
|
cat > initrd.img
|
|
|
|
SIZE=$(stat -c "%s" initrd.img)
|
|
SIZE4=$(( $SIZE / 4 \* 4 ))
|
|
DIFF=$(( $SIZE - $SIZE4 ))
|
|
[ $DIFF -ne 0 ] && DIFF=$(( 4 - $DIFF ))
|
|
|
|
dd if=/dev/zero bs=1 count=$DIFF of=zeropad
|
|
|
|
cat zeropad >> initrd.img
|
|
|
|
SIZE=$(stat -c "%s" initrd.img)
|
|
SIZE4=$(( $SIZE / 4 \* 4 ))
|
|
DIFF=$(( $SIZE - $SIZE4 ))
|
|
|
|
if [ $DIFF -ne 0 ]
|
|
then
|
|
echo "Bad alignment" >2
|
|
exit 1
|
|
fi
|
|
|
|
cat initrd.img
|