OpenWrt The system starts, run the/etc/preinit script first
to Newifi y1s for example, and then swipe in the Pandorabox firmware
#!/bin/sh # Copyright (c) 2006 Openwrt.org # Copyright (c) Vertical Communications [-z] $P Reinit "] && exec/sbin/init export path=/bin:/sbin:/usr/bin:/usr/sbin pi_ifname= pi_ip=192.168.1.1 Pi_broadcas t=192.168.1.255 pi_netmask=255.255.255.0 fs_failsafe_ifname= fs_failsafe_ip=192.168.1.1 fs_failsafe_broadcast= 192.168.1.255 fs_failsafe_netmask=255.255.255.0 fs_failsafe_wait_timeout=2 pi_suppress_stderr= "y" pi_init_suppress _stderr= "y" pi_init_path= "/bin:/sbin:/usr/bin:/usr/sbin" pi_init_cmd= "/sbin/init". /lib/functions.sh. /lib/functions/preinit.sh. /lib/functions/system.sh boot_hook_init preinit_essential boot_hook_init preinit_main boot_hook_init failsafe boot_ Hook_init Initramfs boot_hook_init preinit_mount_root for Pi_source_file in/lib/preinit/*; Do. $pi _source_file done Boot_run_hook preinit_essential pi_mount_skip_next=false pi_jffs2_mount_success=false pi_ Failsafe_net_message=false Boot_run_hook Preinit_main
As you can see from the script,
/lib/functions.sh
/lib/functions/preinit.sh
/lib/functions/system.sh
These three scripts provide function functions for preinit call execution.
The PreInit script executes the initialization of a series of shell scripts
Directory under the/lib/preinit/directory
[Root@pandorabox:/lib/preinit] #ls
01_reset_esw_port.sh 40_run_failsafe_hook
02_default_set_state 50_indicate_regular_preinit
03_preinit_do_ralink.sh 70_initramfs_test
10_indicate_failsafe 80_mount_root
10_indicate_preinit 99_10_failsafe_login
10_sysinfo 99_10_run_init
30_failsafe_wait
[root@pandorabox:/lib/preinit]#
These scripts can be modified as required
OpenWrt These scripts into five types of hooks:
Preinit_essential
Preinit_main
Failsafe
Initramfs
Preinit_mount_root
Execute these scripts by name