mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
Disable networking at runtime with lkmc_nonet cli instead of build
This is necessary because qemu and gem5 now use the same build folder. Separate ./run -e and -f for kernel options before and after the ' - '. This was already the better thing to do when -E was introduced, but lkmc_nonet prompted me to do it nicer now. Use the common script to find the out_dir on every toplevel script. Include usage man pages on README.
This commit is contained in:
44
rootfs_overlay/etc/init.d/S40network
Executable file
44
rootfs_overlay/etc/init.d/S40network
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copied from: package/ifupdown-scripts/S40network at
|
||||
# 8ce27bb9fee80a406a4199657ef90e3c315e7457
|
||||
#
|
||||
# We then just added this line to turn it off at runtime.
|
||||
#
|
||||
# We also considered copying the file at build to / and then
|
||||
# sourcing it from S98 to be a bit DRYer, but it wouldn't work
|
||||
# very well if some S50 requires networking to work.
|
||||
#
|
||||
# This became necessary nitially when aarch64 qemu and gem5
|
||||
# started using the same Buildroot output directory.
|
||||
[ -n "$lkmc_nonet" ] && exit 0
|
||||
|
||||
#
|
||||
# Start the network....
|
||||
#
|
||||
|
||||
# Debian ifupdown needs the /run/network lock directory
|
||||
mkdir -p /run/network
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
printf "Starting network: "
|
||||
/sbin/ifup -a
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
;;
|
||||
stop)
|
||||
printf "Stopping network: "
|
||||
/sbin/ifdown -a
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
;;
|
||||
restart|reload)
|
||||
"$0" stop
|
||||
"$0" start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
|
||||
Reference in New Issue
Block a user