linux如何缩短开机时间

linux如何缩短开机时间,第1张

1.verifying the kernel image验证内核镜像。

如果我们的内核是好的,为什么我们需要每次重启内核做重新验证呢?所以我们可以去掉内核验证来提高系统启动时间

uboot #setenv verify none

上面这条命令在我们启动内核时去掉了对内核的验证工作,从而提高了内核启动时间

2.再花费了将近2秒钟的时间来得到网络的物理链接包括获得DHCP ip地址

uboot #setenv ip_method none

依赖于网路速度这个过程可能会增长启动时间。事实上,在没有DHCP服务器的情况下会为超时花费好几分钟。

通过内核网络配置,设置ip=off在启动参数将会仍然允许你在用户空间配置网络。所以关掉ip_method会减少启动时间。

Linux内核切换线程时间在微秒级别,几十微秒。

1. 查看需要更新的内核命令:

apt-cache search linux

#该命令将会显示所有可以获取的内核

2. 安装内核,假设要安装的内核为2.6.39-0,则使用下面的命令

sudo apt-get install linux-headers-2.6.39-0-generic linux-image-2.6.39-0-generic

#安装后,reboot即可,重启后,既是以新内核启动。

你那printf了uptime是什么意思...uptime是fread的返回值,是读出了多少个sizeof(long int)的数字

打印buffer不就好了吗....

printf("\nthe time is %8s \n",buffer)

man fread

size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream)

fread() and fwrite() return the number of items successfully read or

written (i.e., not the number of characters). If an error occurs, or

the end-of-file is reached, the return value is a short item count (or

zero)


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/8894177.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-22
下一篇2023-04-22

发表评论

登录后才能评论

评论列表(0条)

    保存