smartmontools-5.43交叉编译Smartctl

嵌入式系统的sata盘经常故障,需要使用smatctl工具监控和诊断sata故障。

  1. 从网上下载开源smartmontools-5.43包。

  2. 修改makefile进行交叉编译。

由于软件包中已经包含Makefile.amMakefile.in。直接运行

automake --add-missing

生成Makefile。

  1. 修改Makefile中交叉编译工具

COMPILEPRE=/usr/local/arm/4.4.3/bin

#CC = gcc

#CCAS = gcc
CC = {COMPILEPRE}/arm-linux-gcc-4.4.3 CCAS = {COMPILEPRE}/arm-linux-gcc-4.4.3

CCASDEPMODE = depmode=gcc3

CCASFLAGS = -g -O2

CCDEPMODE = depmode=gcc3

CFLAGS = -g -O2

CPPFLAGS =

CXX = {COMPILEPRE}/arm-linux-g++ CXXCPP = {COMPILEPRE}/arm-linux-g++ -E

#CXX = g++

#CXXCPP = g++ -E

  1. make 生成

报错:

/home/grape/s3c2440/tools/smartmontools-5.43/dev_interface.cpp:271: undefined reference to `clock_gettime'

查询发现少了librt 实时库。

  1. 在交叉编译库中查找

find / -name '*librt*'

/usr/local/arm/4.4.3/arm-none-linux-gnueabi/sys-root/usr/lib/librt.so

  1. 在Makefile添加

LIBS = /usr/local/arm/4.4.3/arm-none-linux-gnueabi/sys-root/usr/lib/librt.so

  1. 重新make 成功,编译成功。并查看生成的smartctl。

file smartctl

smartctl: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 2.6.32, not stripped

  1. 上载smartctl到开发版,查询stata:

./smartctl -h

smartctl 5.43 2012-06-30 r3573 armv4tl-linux-4.15.0 (local build)

Copyright (C) 2002-12 by Bruce Allen, http://smartmontools.sourceforge.net

Usage: smartctl options device

============================================ SHOW INFORMATION OPTIONS =====

-h, --help, --usage

Display this help and exit

-V, --version, --copyright, --license

Print license, copyright, and version information and exit

相关推荐
ch3nyuyu5 小时前
单片机实验2
单片机·嵌入式硬件
达子6668 小时前
Zephyr RTOS 学习系统:第一阶段 —— 入门篇
stm32·单片机·嵌入式硬件
三易串口屏11 小时前
触摸热区控件
嵌入式硬件·触摸屏·串口屏·三易串口屏·触摸热区控件
西城微科方案开发13 小时前
智能电子跳绳方案开发
单片机·嵌入式硬件
国科安芯14 小时前
抗辐射微控制器在卫星电源管理分系统中的控制架构与可靠性研究——基于AS32S601型MCU的星载能源系统智能化管理技术分析
网络·单片机·嵌入式硬件·安全·架构·系统架构·能源
KaifuZeng15 小时前
电路面试问题汇总一
单片机·嵌入式硬件·面试·电路
Freedom_my16 小时前
STM32简单项目
stm32·单片机·嵌入式硬件
GeekArch17 小时前
第8讲:裸机单片机项目——Vibe快速迭代的最优边界
c语言·stm32·单片机·嵌入式硬件·mcu·物联网·ai编程
tianyazhichiC17 小时前
树莓派使用windows远程桌面登录,画面黑屏闪退
嵌入式硬件
Delta-delta17 小时前
M85-GCC13.3-CMSIS-接入笔记
笔记·单片机·嵌入式硬件