Skip to content

Commit 53f8b67

Browse files
committed
Use squashfs and overlayfs with remote update function in mind
1 parent 65e6f8a commit 53f8b67

File tree

12 files changed

+97
-50
lines changed

12 files changed

+97
-50
lines changed

board/olimex/imx233_olinuxino_wordclock/device_table.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
# dynamic configurations (where devtmpfs, mdev or udev are used).
77
#
88
# <name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count>
9+
/sbin/boot f 755 0 0 - - - - -
910
/usr/sbin/wpa_action f 755 0 0 - - - - -
1011
/etc/autossh/id_rsa f 600 0 0 - - - - -
1112
/etc/init.d/S60autossh f 755 0 0 - - - - -
13+
/etc/init.d/S99firstboot f 755 0 0 - - - - -
1214
/etc/network/if-pre-up.d/setmac f 755 0 0 - - - - -
1315
/etc/wpa_supplicant/action_wpa.sh f 755 0 0 - - - - -
1416
/etc/wpa_supplicant/functions.sh f 755 0 0 - - - - -
13.1 KB
Binary file not shown.
Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,11 @@
11
#!/bin/sh
22
set -e
33

4-
if [ -e $1/sd-card.img ]; then
5-
rm $1/sd-card.img
6-
fi
7-
8-
9-
fssize=$(stat --printf="%s" $1/rootfs.ext2)
10-
imgsize=$(expr $fssize / 512 + 4096)
11-
12-
dd if=/dev/zero of=$1/sd-card.img bs=512 count=$imgsize
13-
14-
# echo "n
15-
# p
16-
# 1
17-
#
18-
# +1M
19-
# t
20-
# 53
21-
# n
22-
# p
23-
# 2
24-
#
25-
#
26-
# w
27-
# " | fdisk -b 512 -H 62 -S 62 $1/sd-card.img
28-
29-
dd if=board/olimex/imx233_olinuxino_wordclock/mbr.bin of=$1/sd-card.img bs=512
30-
dd if=$1/uboot-env.bin of=$1/sd-card.img bs=512 seek=512
31-
dd if=$1/u-boot.sd of=$1/sd-card.img bs=512 seek=2048
32-
dd if=$1/rootfs.ext2 of=$1/sd-card.img bs=512 seek=4096
4+
# copy partition table
5+
gzip -d -c board/olimex/imx233_olinuxino_wordclock/sd-card.img.gz > $1/sd-card.img
6+
7+
# copy partitions
8+
dd if=$1/uboot-env.bin of=$1/sd-card.img bs=512 seek=512 conv=notrunc
9+
dd if=$1/u-boot.sd of=$1/sd-card.img bs=512 seek=2048 conv=notrunc
10+
dd if=$1/uImage of=$1/sd-card.img bs=512 seek=6144 conv=notrunc
11+
dd if=$1/rootfs.squashfs of=$1/sd-card.img bs=512 seek=26624 conv=notrunc
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Configuration file for fw_(printenv/setenv) utility.
2+
# Up to two entries are valid, in this case the redundant
3+
# environment sector is assumed present.
4+
# MTD device name Device offset Env. size Flash sector size
5+
/dev/mmcblk0 0x40000 0x4000 0x4000
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
#
3+
# Set firstboot uboot environment variable
4+
#
5+
set -e
6+
7+
case "$1" in
8+
start)
9+
if fw_printenv firstboot | grep -q 2; then
10+
echo "First boot after system upgrade";
11+
fw_setenv firstboot 0;
12+
fi;
13+
;;
14+
esac
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# /etc/inittab
2+
#
3+
# Copyright (C) 2001 Erik Andersen <[email protected]>
4+
#
5+
# Note: BusyBox init doesn't support runlevels. The runlevels field is
6+
# completely ignored by BusyBox init. If you want runlevels, use
7+
# sysvinit.
8+
#
9+
# Format for each entry: <id>:<runlevels>:<action>:<process>
10+
#
11+
# id == tty to run on, or empty for /dev/console
12+
# runlevels == ignored
13+
# action == one of sysinit, respawn, askfirst, wait, and once
14+
# process == program to run
15+
16+
# Startup the system
17+
::sysinit:/sbin/boot
18+
19+
::sysinit:/bin/mkdir -p /dev/pts
20+
::sysinit:/bin/mkdir -p /dev/shm
21+
::sysinit:/bin/mount -a
22+
::sysinit:/bin/hostname -F /etc/hostname
23+
# now run any rc scripts
24+
::sysinit:/etc/init.d/rcS
25+
26+
# Put a getty on the serial port
27+
console::respawn:/sbin/getty -L console 0 vt100 # GENERIC_SERIAL
28+
29+
# Stuff to do for the 3-finger salute
30+
::ctrlaltdel:/sbin/reboot
31+
32+
# Stuff to do before rebooting
33+
::shutdown:/etc/init.d/rcK
34+
::shutdown:/sbin/swapoff -a
35+
::shutdown:/bin/umount -a -r

board/olimex/imx233_olinuxino_wordclock/skeleton/mnt/root-ro/.empty

Whitespace-only changes.

board/olimex/imx233_olinuxino_wordclock/skeleton/mnt/root-rw/.empty

Whitespace-only changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
set -e
3+
4+
if mount -t ext4 -o noatime /dev/mmcblk0p4 /mnt/root-rw; then
5+
echo "Mounted ext4 filesystem";
6+
else
7+
echo "Creating ext4 filesystem";
8+
mkfs.ext4 /dev/mmcblk0p4;
9+
mount -t ext4 -o noatime /dev/mmcblk0p4 /mnt/root-rw;
10+
fi;
11+
12+
mkdir -p /mnt/root-rw/upper
13+
mkdir -p /mnt/root-rw/work
14+
mount -t overlay overlay -olowerdir=/,upperdir=/mnt/root-rw/upper,workdir=/mnt/root-rw/work /mnt/root-ro
15+
pivot_root /mnt/root-ro /mnt/root-ro/mnt/root-ro
16+
mount -o move /mnt/root-ro/dev /dev
17+
mount -o move /mnt/root-ro/mnt/root-rw /mnt/root-rw
Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
baudrate=115200
2-
boot_fdt=try
3-
bootcmd=mmc dev ${mmcdev}; if mmc rescan; then if gpio input 994; then echo Button not pressed; else echo Button pressed; run copypart; fi; if test ${firstboot} = 1; then run copypart; fi; if run loadbootscript; then run bootscript; else if run loaduimage; then run mmcboot; else echo uImage error; fi; fi; else echo mmc error; fi
2+
bootcmd=mmc dev ${mmcdev}; if mmc rescan; then if gpio input 986; then echo Button 2 not pressed; run checkfail; else echo Button 2 pressed; run switch_system; fi; if gpio input 994; then echo Button 1 not pressed; else echo Button 1 pressed; echo Erase ext4 partition; mw 0x41000000 0x00000000 0x800000; mmc write 0x41000000 0x26800 0x10000; fi; run set_system; if run loaduimage; then run mmcargs; bootm ${loadaddr}; else echo uImage error; fi; else echo mmc error; fi
43
bootdelay=1
5-
bootscript=echo Running bootscript from mmc ...; source
64
console=ttyAMA0
7-
fdt_addr=0x41000000
8-
fdt_file=/boot/imx23-olinuxino.dtb
5+
kernelpart=0x1800
96
loadaddr=0x42000000
10-
loadbootscript=ext2load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};
11-
loadfdt=ext2load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}
12-
loaduimage=ext2load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}
7+
loaduimage=mmc read ${loadaddr} ${kernelpart} 0x2000
138
mmcargs=setenv bootargs console=${console},${baudrate} root=${mmcroot}
14-
mmcboot=echo Booting from mmc ...; run mmcargs; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootm ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootm; else echo WARN: Cannot load the DT; fi; fi; else bootm; fi;
159
mmcdev=0
16-
mmcpart=3
17-
mmcroot=/dev/mmcblk0p3 rw rootwait
18-
script=boot.scr
10+
mmcroot=/dev/mmcblk0p7 ro rootwait
11+
script=/boot.scr
1912
stderr=serial
2013
stdin=serial
2114
stdout=serial
22-
uimage=/boot/uImage
23-
firstboot=1
24-
copypart=echo Copy system partition...; mmc read 0x41000000 0x1000 0xC800; mmc write 0x41000000 0x33000 0xC800; echo 25; mmc read 0x41000000 0xD800 0xC800; mmc write 0x41000000 0x3F800 0xC800; echo 50; mmc read 0x41000000 0x1A000 0xC800; mmc write 0x41000000 0x4C000 0xC800; echo 75; mmc read 0x41000000 0x26800 0xC800; mmc write 0x41000000 0x58800 0xC800; echo 100; setenv firstboot 0; saveenv;
15+
set_system=if test ${system} = 1; then echo Run system 2; setenv kernelpart 0x4000; setenv mmcroot /dev/mmcblk0p3 ro rootwait; else echo Run system 1; fi;
16+
switch_system=setenv firstboot 0; if test ${system} = 1; then setenv system 0; else setenv system 1; fi; saveenv;
17+
system=0
18+
firstboot=0
19+
checkfail=if test ${firstboot} = 2; then run switch_system; fi; if test ${firstboot} = 1; then setenv firstboot 2; saveenv; fi;

0 commit comments

Comments
 (0)