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

相关推荐
曙曙学编程21 小时前
stm32——独立看门狗,RTC
c语言·c++·stm32·单片机·嵌入式硬件
sheepwjl21 小时前
《嵌入式硬件(四):温度传感器DS1820》
单片机·嵌入式硬件
三之又三1 天前
PowerPMAC配置EtherCAT设备
嵌入式硬件·cnc·powerpmac
朝颜_祝余1 天前
在电路浪涌测试中,TVS(瞬态电压抑制二极管)的防护效果确实会受到陪测设备中去耦网络(Decoupling Network,DN)的显著影响
单片机·嵌入式硬件
mei_you_n1 天前
JLINK 调试器单步调试单片机
单片机·嵌入式硬件
HIZYUAN1 天前
AG32 ( MCU+FPGA二合一 )是如何卷入了三相电能计量市场的
单片机·嵌入式硬件
pengfei_M1 天前
四、FVP启动linux
linux·单片机·嵌入式硬件
weixin_471525781 天前
【ARMday02】
单片机·嵌入式硬件
世微 如初1 天前
无需外部补偿的同步降压方案:AP3471在分布式供电系统中的应用
单片机·嵌入式硬件·芯片·led驱动·led电源驱动
云山工作室1 天前
基于单片机的声光控制楼道灯(论文+源码)
单片机·嵌入式硬件