mirror of
https://github.com/ventoy/Ventoy.git
synced 2024-12-27 15:45:58 -05:00
50 lines
1.4 KiB
Plaintext
50 lines
1.4 KiB
Plaintext
Build a static linked, small dmsetup tool
|
|
|
|
======== Source Code ========
|
|
use an old version of dmsetup
|
|
http://vault.centos.org/5.3/os/SRPMS/device-mapper-1.02.28-2.el5.src.rpm
|
|
https://www.fefe.de/dietlibc/dietlibc-0.34.tar.xz
|
|
|
|
======== Build Envrioment ========
|
|
build for 32bit, static linked with dietlibc
|
|
1. install centos 6.10 i386 with CentOS-6.10-i386-bin-DVD1.iso
|
|
2. yum install gcc kernel-devel package
|
|
3. install dietc libc (just make && make install)
|
|
4. export PATH=$PATH:/opt/diet/bin
|
|
|
|
======== Build Step ========
|
|
1. extract device mapper source code
|
|
2. CC="diet gcc" ./configure --disable-nls --disable-selinux --disable-shared
|
|
3. modify include/configure.h file
|
|
--- delete the line with "#define malloc rpl_malloc"
|
|
--- add 2 defines as follow:
|
|
#ifndef UINT32_MAX
|
|
#define UINT32_MAX (4294967295U)
|
|
#endif
|
|
|
|
#ifndef UINT64_C
|
|
#define UINT64_C(c) c ## ULL
|
|
#endif
|
|
|
|
4. make
|
|
5. strip dmsetup/dmsetup
|
|
6. get dmsetup/dmsetup as the dmsetup32 binary file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
======================== Build for 64bit dmsetup =========================
|
|
https://www.uclibc.org/downloads/binaries/0.9.30.1/mini-native-x86_64.tar.bz2
|
|
1. extract device mapper source code
|
|
2. extract mini-native-x86_64.tar.bz2
|
|
3. chroot to mini-native-x86_64
|
|
3. ./configure --disable-nls --disable-selinux --disable-shared --enable-static_link
|
|
4. make
|
|
5. strip dmsetup/dmsetup.static
|
|
6. get dmsetup/dmsetup.static as the dmsetup64 binary file
|
|
|
|
|
|
|