2013年12月20日 星期五

IPMI simulator build step

/////////////////////////////////////////////////////////////
////////////////build linux kernel and rootfs////////////////
/////////////////////////////////////////////////////////////
Refer to:
http://www.linux-kvm.org/images/7/76/03x08-Juniper-Corey_Minyard-UsingIPMIinQEMU.ods.pdf
https://morris821028.github.io/2016/01/21/realtime-system-qemu
https://www.cnblogs.com/zzb-Dream-90Time/p/7111242.html

1.
apt install libncurses5-dev

2.check openipmi linux kernel version
https://sourceforge.net/p/openipmi/linux-ipmi/ci/master/tree/Makefile
VERSION = 4
PATCHLEVEL = 10
SUBLEVEL = 0

3.
git clone --recursive git://git.code.sf.net/p/openipmi/linux-ipmi
cd linux-ipmi
make ARCH=x86_64 defconfig
make ARCH=x86_64 menuconfig

(a.)
Device Drivers  --->
Character devices  --->
<*> IPMI top-level message handler  ---> (enable this and enter submenu)
[*]   Generate a panic event to all BMCs on a panic
[*]   Generate OEM events containing the panic string
<*>   Device interface for IPMI
<*>   IPMI System Interface handler
<*>   IPMI SMBus handler (SSIF)
<*>   IPMI Watchdog Timer
<*>   IPMI Poweroff

(b.)
File systems  --->
<*> Second extended fs support
[*] Ext2 extended attributes
[*] Ext2 POSIX Access Control Lists
[*] Ext2 Security Labels

save -> .config -> ok -> exit all page

make -j8

mkdir /opt/qemu
cp ./arch/x86/boot/bzImage /opt/qemu/bzImage-1
cp ./arch/x86/boot/bzImage /opt/qemu/bzImage-2

4.build rootfs
wget https://buildroot.uclibc.org/downloads/buildroot-2017.11.tar.bz2
tar -h -xvf ./buildroot-2017.11.tar.bz2
cd buildroot-2017.11
make ARCH=x86_64 menuconfig

(a.)
Target options  --->
Target Architecture --->
(X) x86_64

(b.)
Toolchain  --->
C library --->
(X) glibc

(c.)
Toolchain  --->
Kernel Headers --->
(X) Linux 4.10.x kernel headers

(d.)
Filesystem images  --->
[*] ext2/3/4 root filesystem
[*] tar the root filesystem

save -> .config -> ok -> exit all page

make -j8

mkdir /opt/qemu
cp ./output/images/rootfs.ext2 /opt/qemu/cge-complete-image-x86-generic-64-1.ext2
cp ./output/images/rootfs.ext2 /opt/qemu/cge-complete-image-x86-generic-64-2.ext2

/////////////////////////////////////////////////////////////
/////////////////////////////QEMU////////////////////////////
/////////////////////////////////////////////////////////////
1.(Do not use apt install qemu-system that lack of ipmi-bmc-extern model)
apt purge qemu-system qemu-kvm
git clone --recursive https://github.com/openbmc/qemu.git
cd qemu
mkdir build
cd build
../configure --prefix=/opt/qemu
make -j8 && make install

2.
gedit /etc/environment
#add
/opt/qemu/bin
reboot
which qemu-system-x86_64
/opt/qemu/bin/qemu-system-x86_64
(make sure the path)

3.test
qemu-system-x86_64 -M pc -kernel /opt/qemu/bzImage-1 -hda /opt/qemu/cge-complete-image-x86-generic-64-1.ext2 -netdev user,id=network0 -device e1000,netdev=network0 -nographic -append "root=/dev/sda console=ttyS0"
#after driver loading will see
Welcome to Buildroot
buildroot login:

/////////////////////////////////////////////////////////////
//////////////////ipmi lan server simulator//////////////////
/////////////////////////////////////////////////////////////
1. preinstall
#for python3
apt install curl wget openssl python3-dev python3-setuptools build-essential checkinstall libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev zlib1g-dev libffi-dev libgirepository1.0-dev
#for openipmi
apt install libpopt-dev ncurses-dev python-tk swig tix

2. download
git clone --recursive git://git.code.sf.net/p/openipmi/code

3.
./bootstrap
./configure --prefix=/opt/openipmi --with-python=/usr/bin/python3

4.
search all Makefile in openipmi
-O2
#change to for debug
-O0
make -j8 verbose=1 && make install

4.(If you want to debug ipmi_sim do step 4,5)
Eclipse -> new -> Makefile Project with Existing Code
Toolchain for indexer Settings -> Linux GCC

5.
eclipse -> Debug Configurations
export LD_LIBRARY_PATH=/opt/openipmi/lib
Start Debug

6.modify
gedit /opt/openipmi/etc/ipmi/lan.conf
#search all
root=/dev/sdb
#change to
root=/dev/sda

7. setting environment
gedit /etc/environment
#add
/opt/openipmi/bin
reboot
which ipmi_sim
/opt/openipmi/bin/ipmi_sim
(make sure the path)

8. run ipmi_sim
ipmi_sim
#or
/opt/openipmi/bin/ipmi_sim

9.openipmi gui
#a. read $HOME/openipmi/lanserv/README.vm
#b. read /opt/openipmi/etc/ipmi/lan.conf
#c. screen resolution > 1024x778
python3 /opt/openipmi/bin/openipmigui
#or
python3 $HOME/openipmi/swig/python/openipmigui.py  #(same work as => make rungui)

File-> Open Domain -> lan
Domain name: test
Address: localhost
Port: 9001
Username: ipmiusr
Password: test

/////////////////////////////////////////////////////////////
//////////////////////////ipmitool///////////////////////////
/////////////////////////////////////////////////////////////
Refer to:
https://github.com/ipmitool/ipmitool/wiki

1.Download
https://github.com/ipmitool/ipmitool/releases/tag/IPMITOOL_1_8_18

3.
./bootstrap
./configure --prefix=/opt/impitool --enable-intf-open --enable-intf-lanplus

4.
search all Makefile ipmitool
-O2
#change to for debug
-O0
make -j8 verbose=1 && make install

5.
Eclipse -> new -> Makefile Project with Existing Code
Toolchain for indexer Settings -> Linux GCC
Start Debug

6.
gedit /etc/environment
#add
/opt/impitool/bin
reboot
which ipmitool
/opt/impitool/bin/ipmitool
(make sure the path)

# https://www.itread01.com/content/1544587337.html
# https://computercheese.blogspot.com/2013/04/ipmi-chassis-device-commands.html
7. remote command (match with openipmi setting in /opt/openipmi/etc/ipmi/lan.conf)
a. ipmitool -I lanplus -H localhost -p 9001 -U ipmiusr -P test raw 0x00 0x01
b. ipmitool -I lanplus -H localhost -p 9001 -U ipmiusr -P test power status
c. ipmitool -I lanplus -H localhost -p 9001 -U ipmiusr -P test mc info
d. ipmitool -I lanplus -H localhost -p 9001 -U ipmiusr -P test sensor

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////Patch ////////////////////////////////////////////////////////
Eclipse Luna 64bits linux ADT + CDT + Openocd on Java8. Extract to /opt/eclipse_luna
http://www.mediafire.com/file/8fb3dsi88j5iru9/eclipse_luna_adt_cdt_openocd.tar.gz
#sudo to run eclipse

Demo pics:
http://www.mediafire.com/view/jbkhr1uwjoizlbi/full%20emu00.png
http://www.mediafire.com/view/c2m35jopd8le3oc/full%20emu01.png
http://www.mediafire.com/view/u39i82s8wxtmu92/full%20emu02.png

沒有留言:

張貼留言