New SD card layout. WiFi support.

This commit is contained in:
Sorgelig
2018-01-15 12:12:51 +08:00
parent d17698761b
commit 2efdb96b0f
11 changed files with 73 additions and 138 deletions

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
/.addon
linux.img

BIN
addon.tar

Binary file not shown.

72
create_img.sh Executable file
View File

@@ -0,0 +1,72 @@
#!/bin/bash
echo ""
if [[ $EUID -ne 0 ]]; then
sudo $0
exit 0
fi
DIR=$PWD
SRCDIR=${DIR}
DSTDIR=/media/rootfs
dd if=/dev/zero of=linux.img bs=64k count=3000
echo "Formatting Linux partition..."
mkfs.ext4 -L rootfs linux.img || exit 0
echo ""
echo "Mounting Linux partition..."
if [ ! -d ${DSTDIR} ]; then
mkdir -p ${DSTDIR} || exit 0
fi
mount linux.img ${DSTDIR} || exit 0
echo "Copying main rootfs files..."
tar xfp ${SRCDIR}/rootfs.tar.gz --warning=no-timestamp -C ${DSTDIR} || exit 0
echo "Copying kernel modules rootfs files..."
tar xfp ${SRCDIR}/modules.tar.gz --strip-components=2 --warning=no-timestamp -C ${DSTDIR}/lib || exit 0
echo "Copying devices firmwares..."
mkdir -p ${DSTDIR}/lib/firmware || exit 0
tar xfp ${SRCDIR}/firmware.tar.gz --warning=no-timestamp -C ${DSTDIR}/lib/firmware || exit 0
echo "Copying additional modifications..."
if [ -d ${SRCDIR}/.addon ]; then
[ -f ${SRCDIR}/addon.tar ] && rm -f ${SRCDIR}/addon.tar
tar cvf ${SRCDIR}/addon.tar -C ${SRCDIR}/.addon .
fi
tar xfp ${SRCDIR}/addon.tar --warning=no-timestamp -C ${DSTDIR} || exit 0
mkdir -p ${DSTDIR}/media/fat || exit 0
#echo "/dev/mmcblk0p1 /media/fat auto defaults,sync,nofail 0 0" >>${DSTDIR}/etc/fstab
sed 's/getty/agetty/g' -i ${DSTDIR}/etc/inittab
sed 's/115200//g' -i ${DSTDIR}/etc/inittab
sed '/::sysinit:\/bin\/mount \-a/a ::sysinit:\/etc\/resync\ \&' -i ${DSTDIR}/etc/inittab
sed '/::sysinit:\/bin\/mount \-a/a ::sysinit:\/media\/fat\/MiSTer\ \&' -i ${DSTDIR}/etc/inittab
sed '/::sysinit:\/bin\/mount \-t proc proc \/proc/a ::sysinit:\/etc\/irqoncpu0' -i ${DSTDIR}/etc/inittab
mv ${DSTDIR}/etc/init.d/S40network ${DSTDIR}/etc/init.d/S90network
rm ${DSTDIR}/sbin/udhcpc
sed '/PATH/ s/$/:\/media\/fat\/linux:\./' -i ${DSTDIR}/etc/profile
mkdir -p ${DSTDIR}/media/rootfs || exit 0
cat >> ${DSTDIR}/etc/profile <<- __EOF__
export LC_ALL=en_US.UTF-8
resize >/dev/null
mount -o remount,rw /
__EOF__
echo "Fixing permissions..."
chown -R root:root ${DSTDIR} || exit 0
sync
sleep 3
echo "Unmounting Linux partition..."
umount ${DSTDIR} || exit 0
echo "Done!"
echo ""

View File

@@ -1,138 +0,0 @@
#!/bin/bash
echo ""
if [[ $EUID -ne 0 ]]; then
echo "This script requires root rights. Quiting..."
echo ""
exit 0
fi
if [ -z $1 ]; then
echo "No SD device specified"
exit 0
fi
if [ ! -e "$1" ]; then
echo "Couldn't find SD card"
exit 0
fi
read -p "Do you wish to partition this SD card? " yn
case $yn in
[Yy]* )
echo ""
echo "Unmounting some partitions (errors are ok here)..."
umount ${1}
umount ${1}1
umount ${1}2
umount ${1}3
echo ""
echo "Erasing of first 64MB of card..."
dd if=/dev/zero of=$1 bs=1M count=64 || exit 0
echo "Partitioning..."
(sfdisk $1 <<-__END__
502M,+,0xB
2M,500M,0x83
1M,1M,0xA2
__END__
) || exit 0
sleep 3
DIR=$PWD
SRCDIR=${DIR}
DSTDIR=/media/rootfs
if [[ $EUID -ne 0 ]]; then
echo "This script requires root rights. Quiting..."
echo ""
exit 0
fi
if [ -z $1 ]; then
echo "No SD device specified"
exit 0
fi
if [ ! -e $1 ] || [ ! -e ${1}3 ] || [ ! -e ${1}2 ] || [ ! -e ${1}1 ] ; then
echo "Specified device doesn't look like correct SD card"
exit 0
fi
echo ""
echo "Unmounting some partitions (errors are ok here)..."
umount ${DSTDIR}
echo "Formatting Linux partition..."
mkfs.ext4 -L rootfs ${1}2 || exit 0
echo ""
echo "Copying U-Boot loader..."
dd if=${SRCDIR}/u-boot-with-spl.sfp of=${1}3
echo "Mounting Linux partition..."
if [ ! -d ${DSTDIR} ]; then
mkdir -p ${DSTDIR} || exit 0
fi
mount ${1}2 ${DSTDIR} || exit 0
echo "Copying main rootfs files..."
tar xfp ${SRCDIR}/rootfs.tar.gz --warning=no-timestamp -C ${DSTDIR} || exit 0
echo "Copying kernel modules rootfs files..."
tar xfp ${SRCDIR}/modules.tar.gz --strip-components=2 --warning=no-timestamp -C ${DSTDIR}/lib || exit 0
echo "Copying devices firmwares..."
mkdir -p ${DSTDIR}/lib/firmware || exit 0
tar xfp ${SRCDIR}/firmware.tar.gz --warning=no-timestamp -C ${DSTDIR}/lib/firmware || exit 0
echo "Copying additional modifications..."
if [ -d ${SRCDIR}/.addon ]; then
[ -f ${SRCDIR}/addon.tar ] && rm -f ${SRCDIR}/addon.tar
tar cvf ${SRCDIR}/addon.tar -C ${SRCDIR}/.addon .
fi
tar xfp ${SRCDIR}/addon.tar --warning=no-timestamp -C ${DSTDIR} || exit 0
mkdir -p ${DSTDIR}/media/fat || exit 0
echo "/dev/mmcblk0p1 /media/fat auto defaults,sync,nofail 0 0" >>${DSTDIR}/etc/fstab
sed 's/getty/agetty/g' -i ${DSTDIR}/etc/inittab
sed 's/115200//g' -i ${DSTDIR}/etc/inittab
sed '/::sysinit:\/bin\/mount \-a/a ::sysinit:\/etc\/resync\ \&' -i ${DSTDIR}/etc/inittab
sed '/::sysinit:\/bin\/mount \-a/a ::sysinit:\/media\/fat\/MiSTer\ \&' -i ${DSTDIR}/etc/inittab
sed '/::sysinit:\/bin\/mount \-t proc proc \/proc/a ::sysinit:\/etc\/irqoncpu0' -i ${DSTDIR}/etc/inittab
sed '/PATH/ s/$/:\/media\/fat/' -i ${DSTDIR}/etc/profile
cat >> ${DSTDIR}/etc/profile <<- __EOF__
export LC_ALL=en_US.UTF-8
resize >/dev/null
mount -o remount,rw /
__EOF__
echo "Copying kernel..."
mkdir -p ${DSTDIR}/boot || exit 0
cp -f -r ${SRCDIR}/zImage ${DSTDIR}/boot/zImage || exit 0
cp -f -r ${SRCDIR}/socfpga.dtb ${DSTDIR}/boot/socfpga.dtb || exit 0
echo "Copying this installer..."
mkdir -p ${DSTDIR}/media/rootfs || exit 0
mkdir -p ${DSTDIR}/make_sd || exit 0
cp -f ${SRCDIR}/* ${DSTDIR}/make_sd || exit 0
echo "Fixing permissions..."
chown -R root:root ${DSTDIR} || exit 0
sync
sleep 3
echo "Unmounting Linux partition..."
umount ${DSTDIR} || exit 0
echo "Done!"
echo ""
;;
* ) ;;
esac

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
zImage

Binary file not shown.

BIN
zImage_dtb Normal file

Binary file not shown.