Optimizing Boot Time: How to Shorten Startup Duration on T536 (Linux 5.10.198)
In embedded systems and Linux development, boot time is a critical performance metric, especially when devices need to respond and operate quickly. The boot time directly impacts user experience and the market competitiveness of the device. Below are methods to reduce boot time on the Linux 5.10.198-based T536 platform:
Before:
Platform: T536, system: Linux 5.10.198, the original boot time is 14.50 seconds.
Specific Modification Methods:
1. Adjust Log Level
During system booting, a large amount of debug information is output by default. While this information is helpful for debugging, it prolongs the boot time. By setting the log level to 0, most unnecessary log outputs can be disabled, thereby speeding up the boot process.
2. Disable U-Boot Menu Wait
By default, U-Boot waits for user input to select the boot menu. By setting bootdelay to 0, this waiting time can be eliminated, allowing the system to boot directly.
diff --git a/device/config/chips/t536/configs/OKT536-C/buildroot/env.cfg b/device/config/chips/t536/configs/OKT536-C/buildroot/env.cfg index fa2b7d37..db902cc4 100755 --- a/device/config/chips/t536/configs/OKT536-C/buildroot/env.cfg +++ b/device/config/chips/t536/configs/OKT536-C/buildroot/env.cfg @@ -8,7 +8,7 @@ mmc_root=/dev/mmcblk0p4 nor_root=/dev/mtdblock1 init=/init rdinit=/rdinit -loglevel=8 +loglevel=0 coherent_pool=16K #reserve_list=30M@64M,78M@128M,200M@512M mac= @@ -34,7 +34,7 @@ boot_recovery=sunxi_flash read 0x4007f800 recovery;bootm 0x4007f800 boot_fastboot=fastboot #uboot system env config -bootdelay=1 +bootdelay=0 #default bootcmd, will change at runtime according to key press #default nand boot #bootcmd=run setargs_nand boot_normal diff --git a/device/config/chips/t536/configs/OKT536-C/sys_config.fex b/device/config/chips/t536/configs/OKT536-C/sys_config.fex index 892bdaf7..c8e36d5c 100644 --- a/device/config/chips/t536/configs/OKT536-C/sys_config.fex +++ b/device/config/chips/t536/configs/OKT536-C/sys_config.fex @@ -4,7 +4,7 @@ ; Description of GPIO format: Port: [Port number] + [Sequence number within the group] ;----------------------------------------------------------------------------------------- [platform] -debug_mode = 1 +debug_mode = 0 ;---------------------------------------------------------------------------------- ;[target] system bootup configuration
3. Kernel Fast Boot Optimization
Adjustments were made to the configuration of kernel boot parameters, with modifications implemented in the random.c file. Optimizing RNG initialization logic decreases boot wait time without sacrificing security. Modifications:
diff --git a/linux-5.10-origin/drivers/char/random.c b/linux-5.10-origin/d
rivers/char/random.c
index b54481e66..df2b49008 100644
--- a/linux-5.10-origin/drivers/char/random.c
+++ b/linux-5.10-origin/drivers/char/random.c
@@ -79,7 +79,8 @@ static enum {
CRNG_EARLY = 1, /* At least POOL_EARLY_BITS collected */
CRNG_READY = 2 /* Fully initialized with POOL_READY_BITS collecte
d */
} crng_init __read_mostly = CRNG_EMPTY;
-#define crng_ready() (likely(crng_init >= CRNG_READY))
+//#define crng_ready() (likely(crng_init >= CRNG_READY))
+#define crng_ready() (likely(crng_init > 0))
/* Various types of waiters for crng_init->CRNG_READY transition. */
static DECLARE_WAIT_QUEUE_HEAD(crng_init_wait);
static struct fasync_struct *fasync;
4. System Service Boot Sequence Adjustment
Adjusting the service startup sequence can prevent non-critical services from delaying boot. The optimized system boot process enables more efficient initialization of critical services while minimizing the waiting time for non-critical ones. By this method, the boot time can be further reduced.
Effect After Modification
Optimizations in kernel configuration, boot parameters, log levels, and U-Boot settings reduced the T536 platform's boot time from 14.50 seconds to 7 seconds, improving both boot efficiency and user experience. Such improvements not only enhance the boot efficiency of the device but also significantly improve the user experience.


