mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-18 22:54:00 +00:00
35 lines
759 B
Bash
Executable file
35 lines
759 B
Bash
Executable file
#!/bin/sh
|
|
|
|
# uncomment line below and set to the correct disk
|
|
#disk=/dev/sdX
|
|
|
|
if [ -z "${disk}" ] ; then
|
|
echo "You must uncomment/set the 'disk' variable"
|
|
exit -1
|
|
fi
|
|
|
|
stage1File=/boot/u-boot-spl.bin
|
|
ubootFile=/boot/u-boot.wrapped
|
|
|
|
perl <<EOF | dd of="$disk" bs=512
|
|
print "\x00" x 0x1a4;
|
|
print "\x00\x5f\x01\x00";
|
|
print "\x00\xdf\x00\x00";
|
|
print "\x00\x80\x00\x00";
|
|
print "\x00" x (0x1b0 -0x1a4 -12 );
|
|
print "\x22\x80\x00\x00";
|
|
print "\x22\x00\x00\x00";
|
|
print "\x00\x80\x00\x00";
|
|
EOF
|
|
|
|
if [ -f $stage1File ];then
|
|
echo "Writing stage 1"
|
|
dd if=$stage1File of="$disk" bs=512 seek=34
|
|
fi
|
|
|
|
if [ -f $ubootFile ];then
|
|
echo "Writing uboot"
|
|
dd if=$ubootFile of="$disk" bs=512 seek=154
|
|
fi
|
|
|
|
sync
|