пятница, 21 сентября 2012 г.
вторник, 7 февраля 2012 г.
devctl
Dynamic attach/detach of hinted devices.
Interesting, somebody want to see that feature in FreeBSD, at least for embedded purpose?
Maybe yes, maybe no. But will copy that info here also.
WARNING: FOLLOWING DEVCTL PATCH MAY EASILY PANIC YOUR SYSTEM, PLEASE
DO NOT TRY IT ON PRODUCTION SERVERS AND TRY IT WITH FILESYSTEMS MOUNTED
AS READONLY :)))))
So I introduce two patches first one [1] used to migrate from
static_hints or hints in the static_kenv to dynamic hints.
sysctl kern.hintmode=2 will copy hints from static hints or from static
kenv and put it into dynamic kenv. Those will allow to manipulate hints
values and attach hinted devices with devctl tool.
Second [2] allow attach/detach devices with userland tool devctl.
devctl tool allow add and initialize new devices which is not able to
be autoenumerating, such a hinted devices.
Both designed to have ability update EEPROM items in runtime, since
some device can't work in mode when it accessible like a EEPROM chip.
Example:
# sysctl kern.hintmode=2
# kenv hint.mx25l.0.at="spibus0"
# kenv hint.mx25l.0.cs=0
# kenv hint.mx25l.0.chipname="at25128"
# devctl hinted spibus 0 mx25l 0
mx25l0:
mx25l0: at25128, sector 64 bytes, 256 sectors
GEOM: new disk flash/spi0
Someone may found it also useful for testing device attach/detach code
(memory leaks, resource allocation, etc).
So, say me please your opinion.
1. http://my.ddteam.net/files/2012-01-31.to_dynamic_hints.patch
2. http://my.ddteam.net/files/2012-01-31.devctl2.patch
четверг, 22 сентября 2011 г.
How incorrectly cross build FreeBSD ports
Q: Why incorrectly?
A: Because configure script will thought what software will be built for host system, not for target. (for i386 instead of armeb)
Since we still can't cross compile FreeBSD ports, everyone use own workaround for that. So I decide to write my own notes to help some folks who don't yet have own workaround for that.
1. Toolchain
At first we need cross toolchain for building, there is many ways to do it, but I use this:
TARGET=arm
TARGET_ARCH=armeb
SRC_TREE=/usr/src
cd ${SRC_TREE}
make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} TARGET_CPUARCH=${TARGET} toolchain
When toolchain build done you will have toolchain binary (cc,cpp,gcc etc.) in directory:
/usr/obj/${TARGET}.${TARGET_ARCH}/${SRC_TREE}/tmp/usr/bin
2. Port dependency
Change dir to desire port, and get two lists of dependencies:
> cd /usr/ports/security/openvpn
> make run-depends-list
/usr/ports/archivers/lzo2
> make build-depends-list
/usr/ports/archivers/lzo2
/usr/ports/archivers/xz
Remove ports that exist in run-depends-list from build-depends-list, and you will get:
Install ports from build-depends-list. Then for every ports in run-depends-list run:
lzo2 which is dependency for openvpn have test target in port Makefile, so we need to comment out that requirement, because we can't run those binary's (you remember, we do compilation for system with different CPU). To do so we need remove target post-build from Makefile:
That for example only, because last commit add checking of variable WITHOUT_CHECKS. So we need only define WITHOUT_CHECKS to avoid those tests.
A: Because configure script will thought what software will be built for host system, not for target. (for i386 instead of armeb)
Since we still can't cross compile FreeBSD ports, everyone use own workaround for that. So I decide to write my own notes to help some folks who don't yet have own workaround for that.
1. Toolchain
At first we need cross toolchain for building, there is many ways to do it, but I use this:
TARGET=arm
TARGET_ARCH=armeb
SRC_TREE=/usr/src
cd ${SRC_TREE}
make TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} TARGET_CPUARCH=${TARGET} toolchain
When toolchain build done you will have toolchain binary (cc,cpp,gcc etc.) in directory:
/usr/obj/${TARGET}.${TARGET_ARCH}/${SRC_TREE}/tmp/usr/bin
2. Port dependency
Change dir to desire port, and get two lists of dependencies:
> cd /usr/ports/security/openvpn
> make run-depends-list
/usr/ports/archivers/lzo2
> make build-depends-list
/usr/ports/archivers/lzo2
/usr/ports/archivers/xz
Remove ports that exist in run-depends-list from build-depends-list, and you will get:
- run-depends-list - list of ports that must be also cross-compiled.
- build-depends-list - list of ports that must be installed on build host to be able to build your desired port.
Install ports from build-depends-list. Then for every ports in run-depends-list run:
- make configure
- PATH=/usr/obj/${TARGET}.${TARGET_ARCH}/${SRC_TREE}/tmp/usr/bin:${PATH} make DESTDIR=${PATH_TO_TARGET_DEVICE_ROOTFS} install
lzo2 which is dependency for openvpn have test target in port Makefile, so we need to comment out that requirement, because we can't run those binary's (you remember, we do compilation for system with different CPU). To do so we need remove target post-build from Makefile:
post-build:
@${ECHO_MSG} "===> Running self-tests for ${PKGNAME} (can take a few minutes)"
@#: override MALLOC_OPTIONS, else tests take excessively long
cd ${WRKSRC} && ${SETENV} MALLOC_OPTIONS=jz ${MAKE} check test SHELL="${SH} -x"
That for example only, because last commit add checking of variable WITHOUT_CHECKS. So we need only define WITHOUT_CHECKS to avoid those tests.
- make configure
- PATH=/usr/obj/${TARGET}.${TARGET_ARCH}/${SRC_TREE}/tmp/usr/bin:${PATH} make WITHOUT_CHECKS=yes DESTDIR=${PATH_TO_TARGET_DEVICE_ROOTFS} install
понедельник, 19 сентября 2011 г.
вторник, 29 сентября 2009 г.
swap на файловой системе
Если по какой-то причине вы не сделали SWAP раздел, но вам нужно "немного" больше памяти, то можно воспользоваться mdconfig-ом:
# dd if=/dev/zero of=/swap.file bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 47.179320 secs (22758739 bytes/sec)
# mdconfig -a -t vnode -f /swap.file
md0
# swapon /dev/md0
# dd if=/dev/zero of=/swap.file bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes transferred in 47.179320 secs (22758739 bytes/sec)
# mdconfig -a -t vnode -f /swap.file
md0
# swapon /dev/md0
Подписаться на:
Сообщения (Atom)