Skip to contentSkip to conversation

synchronize initab files and enable swap on startup

PATCH New Carlos Santos 2 participants 13 messages Jun 11, 2018 – Jun 17, 2018

lore
Share & tools
lore
#0 lore raw

cover synchronize initab files and enable swap on startup

* Apply to sysvinit a modification made for busybox in commit e9db8122fb (reduce number of mkdir calls in inittab).

* Activate swap on system startup. This still requires a swap entry in /etc/inittab, which must be provided by the user.

* Synchronize the custom inittab used on Synopsis boards with the one in the busybox package.

Carlos Santos (4):
sysvinit: reduce number of mkdir calls in inittab
sysvinit: add an inittab entry to activate swap
busybox: add an inittab entry to activate swap board/synopsys: synchronize custom inittab with BusyBox' one

 board/synopsys/axs10x/fs-overlay/etc/inittab | 16 ++++++++++------
 package/busybox/inittab                      |  1 +
 package/sysvinit/inittab                     |  6 +++---
 3 files changed, 14 insertions(+), 9 deletions(-)
Signature · 1 line
2.17.0
#1 lore raw

PATCH 1/4 sysvinit: reduce number of mkdir calls in inittab

The default sysvinit inittab does two separate mkdir calls to create /dev/pts and /dev/shm. Reduce this to call mkdir only once for both directories.

This removes id "si3" but keeps ids "si4".."si9" intact rather than renumbering them. This would just increase the turmoil without any practical effect.

Based on commit e9db8122fb, by Florian La Roche <[email protected]>.

---
 package/sysvinit/inittab | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
package/sysvinit/inittab +1 -2
index 7eaef59d9e..2ca253ad6c 100644
@@ -6,8 +6,7 @@ id:3:initdefault:
 
 si0::sysinit:/bin/mount -t proc proc /proc
 si1::sysinit:/bin/mount -o remount,rw /
-si2::sysinit:/bin/mkdir -p /dev/pts
-si3::sysinit:/bin/mkdir -p /dev/shm
+si2::sysinit:/bin/mkdir -p /dev/pts /dev/shm
 si4::sysinit:/bin/mount -a
 si5::sysinit:/bin/ln -sf /proc/self/fd /dev/fd 2>/dev/null
 si6::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin 2>/dev/null
Signature · 1 line
2.17.0
#4 lore raw

PATCH 2/4 sysvinit: add an inittab entry to activate swap

In reply to Carlos Santos

There is a call to swapoff in the shutdown sequence, so call "swapon -a" on startup. As stated in the swapon man page,

All devices marked as "swap" in /etc/fstab are made available, except for those with the "noauto" option. Devices that are already being used as swap are silently skipped.

So even if the system has some init script to start/stop swap (e.g. from a rootfs ovelay) calling swapon/swapoff would be harmless.

---
 package/sysvinit/inittab | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
package/sysvinit/inittab +2 -1
index 2ca253ad6c..a31471031f 100644
@@ -7,7 +7,8 @@ id:3:initdefault:
 si0::sysinit:/bin/mount -t proc proc /proc
 si1::sysinit:/bin/mount -o remount,rw /
 si2::sysinit:/bin/mkdir -p /dev/pts /dev/shm
-si4::sysinit:/bin/mount -a
+si3::sysinit:/bin/mount -a
+si4::sysinit:/sbin/swapon -a
 si5::sysinit:/bin/ln -sf /proc/self/fd /dev/fd 2>/dev/null
 si6::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin 2>/dev/null
 si7::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout 2>/dev/null
Signature · 1 line
2.17.0
#7 lore raw

PATCH 3/4 busybox: add an inittab entry to activate swap

In reply to Carlos Santos

There is a call to swapoff in the shutdown sequence, so call "swapon -a" on startup. As stated in the swapon man page,

All devices marked as "swap" in /etc/fstab are made available, except for those with the "noauto" option. Devices that are already being used as swap are silently skipped.

So even if the system has some init script to start/stop swap (e.g. from a rootfs ovelay) calling swapon/swapoff would be harmless.

---
 package/busybox/inittab | 1 +
 1 file changed, 1 insertion(+)
package/busybox/inittab +1 -0
index 7cd203de0b..ff1725c775 100644
@@ -18,6 +18,7 @@
 ::sysinit:/bin/mount -o remount,rw /
 ::sysinit:/bin/mkdir -p /dev/pts /dev/shm
 ::sysinit:/bin/mount -a
+::sysinit:/sbin/swapon -a
 null::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
 null::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
 null::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout
Signature · 1 line
2.17.0
#10 lore raw

PATCH 4/4 board/synopsys: synchronize custom inittab with BusyBox' one

In reply to Carlos Santos

Apply modifications made in recent commits:

- 456ea9871e busybox: add /dev/std{in, out, err} symlinks to inittab
- 13dbe73782 busybox: reduce number of mkdir calls in inittab
- 8a89d290d4 busybox: add an inittab entry to activate swap

---
This change was tested on a VM, only. I don't have a Synopsys board.

---
 board/synopsys/axs10x/fs-overlay/etc/inittab | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
board/synopsys/axs10x/fs-overlay/etc/inittab +10 -6
index 43bacc6580..7412a27366 100644
@@ -14,12 +14,16 @@
 # process   == program to run
 
 # Startup the system
-null::sysinit:/bin/mount -t proc proc /proc
-null::sysinit:/bin/mount -o remount,rw /
-null::sysinit:/bin/mkdir -p /dev/pts
-null::sysinit:/bin/mkdir -p /dev/shm
-null::sysinit:/bin/mount -a
-null::sysinit:/bin/hostname -F /etc/hostname
+::sysinit:/bin/mount -t proc proc /proc
+::sysinit:/bin/mount -o remount,rw /
+::sysinit:/bin/mkdir -p /dev/pts /dev/shm
+::sysinit:/bin/mount -a
+::sysinit:/sbin/swapon -a
+null::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
+null::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
+null::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout
+null::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr
+::sysinit:/bin/hostname -F /etc/hostname
 # now run any rc scripts
 ::sysinit:/etc/init.d/rcS
 
Signature · 1 line
2.17.0
#2 lore raw

PATCH 1/4 sysvinit: reduce number of mkdir calls in inittab

In reply to Carlos Santos
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Carlos" == Carlos Santos <[email protected]> writes:

The default sysvinit inittab does two separate mkdir calls to create /dev/pts and /dev/shm. Reduce this to call mkdir only once for both directories.

Quoted 7 lines

This removes id "si3" but keeps ids "si4".."si9" intact rather than renumbering them. This would just increase the turmoil without any practical effect.

Based on commit e9db8122fb, by Florian La Roche <[email protected]>.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH 2/4 sysvinit: add an inittab entry to activate swap

In reply to Carlos Santos
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Carlos" == Carlos Santos <[email protected]> writes:

There is a call to swapoff in the shutdown sequence, so call "swapon -a" on startup. As stated in the swapon man page,

Quoted 8 lines

All devices marked as "swap" in /etc/fstab are made available, except for those with the "noauto" option. Devices that are already being used as swap are silently skipped.

So even if the system has some init script to start/stop swap (e.g. from a rootfs ovelay) calling swapon/swapoff would be harmless.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#8 lore raw

PATCH 3/4 busybox: add an inittab entry to activate swap

In reply to Carlos Santos
Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Carlos" == Carlos Santos <[email protected]> writes:

There is a call to swapoff in the shutdown sequence, so call "swapon -a" on startup. As stated in the swapon man page,

All devices marked as "swap" in /etc/fstab are made available, except for those with the "noauto" option. Devices that are already being used as swap are silently skipped.

So even if the system has some init script to start/stop swap (e.g. from a rootfs ovelay) calling swapon/swapoff would be harmless.

I guess an explicit swapon <device> after swapon -a (with an entry for <device> in /etc/fstab) will fail with an error message, but OK - That is easy to fix if that happens.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#11 lore raw

PATCH 4/4 board/synopsys: synchronize custom inittab with BusyBox' one

In reply to Carlos Santos
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Carlos" == Carlos Santos <[email protected]> writes:

Apply modifications made in recent commits:
- 456ea9871e busybox: add /dev/std{in, out, err} symlinks to inittab
- 13dbe73782 busybox: reduce number of mkdir calls in inittab
- 8a89d290d4 busybox: add an inittab entry to activate swap

---
This change was tested on a VM, only. I don't have a Synopsys board.

Committed, thanks.

Me neither. It would be nicer if this synopsys board would just add the missing lines to the standard inittab in a post-build script, similar to how we do it for the raspberry pi instead of having a local copy - But OK.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 1/4 sysvinit: reduce number of mkdir calls in inittab

In reply to Carlos Santos
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Carlos" == Carlos Santos <[email protected]> writes:

The default sysvinit inittab does two separate mkdir calls to create /dev/pts and /dev/shm. Reduce this to call mkdir only once for both directories.

Quoted 7 lines

This removes id "si3" but keeps ids "si4".."si9" intact rather than renumbering them. This would just increase the turmoil without any practical effect.

Based on commit e9db8122fb, by Florian La Roche <[email protected]>.

Committed to 2018.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#9 lore raw

PATCH 3/4 busybox: add an inittab entry to activate swap

In reply to Carlos Santos
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Carlos" == Carlos Santos <[email protected]> writes:

There is a call to swapoff in the shutdown sequence, so call "swapon -a" on startup. As stated in the swapon man page,

Quoted 8 lines

All devices marked as "swap" in /etc/fstab are made available, except for those with the "noauto" option. Devices that are already being used as swap are silently skipped.

So even if the system has some init script to start/stop swap (e.g. from a rootfs ovelay) calling swapon/swapoff would be harmless.

Committed to 2018.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#6 lore raw

PATCH 2/4 sysvinit: add an inittab entry to activate swap

In reply to Carlos Santos
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Carlos" == Carlos Santos <[email protected]> writes:

There is a call to swapoff in the shutdown sequence, so call "swapon -a" on startup. As stated in the swapon man page,

Quoted 8 lines

All devices marked as "swap" in /etc/fstab are made available, except for those with the "noauto" option. Devices that are already being used as swap are silently skipped.

So even if the system has some init script to start/stop swap (e.g. from a rootfs ovelay) calling swapon/swapoff would be harmless.

Committed to 2018.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#12 lore raw

PATCH 4/4 board/synopsys: synchronize custom inittab with BusyBox' one

In reply to Carlos Santos
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Carlos" == Carlos Santos <[email protected]> writes:

Apply modifications made in recent commits:
- 456ea9871e busybox: add /dev/std{in, out, err} symlinks to inittab
- 13dbe73782 busybox: reduce number of mkdir calls in inittab
- 8a89d290d4 busybox: add an inittab entry to activate swap

---
This change was tested on a VM, only. I don't have a Synopsys board.

Committed to 2018.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard