情灭缘尽 发表于 2010-6-19 20:07:38

routeros 拆解和扩展

本帖最后由 情灭缘尽 于 2010-6-20 19:56 编辑

今天又搞了一天,还是dropbear不能验证用户,登录失败,今天就到此了,明天搭环境用uclibc编译看看

先占楼,然后逐步丰富

文章写的比较乱,排版也一塌糊涂,能看就将就,怕伤害眼睛的直接WS吧

前后也没有什么连续性,想起来一点写一点吧,留着以后整理了,估计能好看点


现在dropbear 和busybox配合起来用的时候,dropbear能启动,端口开启正常,但是用户验证失败,正在解决中,稍后,休息了,明天继续



最近看到好几个朋友在玩ros的扩展,想想从2.8.28以后我就再没有怎么拆过ros了,重新来拆了看看,随便写点过程,方便和大家交流
1 环境搭建
首先当然是vmware,分析东西的时候超级方便,特别是快照,以前拆海蜘蛛的时候就是用的他


2 livecd的选择,建议选择gentoo或者是lfs的livecd,首选是gentoo的livecd
下载地址
http://mirrors.163.com/gentoo/releases/x86/current-iso/install-x86-minimal-20100216.iso
首先到论坛下个4.10的虚拟机版本L6的
配置个虚拟机,设置个光驱,iso文件用上面那个地址下下来的iso文件,然后usb,软驱,声卡等没用的硬件统统删除,硬盘文件选择已存在的文件,指定那个你下载来的vmware虚拟机磁盘镜像文件,网卡别忘记了最少需要一个哦

启动,出滚动条的时候按一下esc键,选择从cd启动


设置屏幕分辨率大小后回车启动


启动完毕

启动完毕了以后,这个基本平台就搭建完毕了

3 启动完毕了以后配置好ip地址,启动sshd,修改root的密码
我使用的命令如下,您可以酌情修改
ifconfig eth0 192.168.1.60 up;/etc/init.d/sshd start;passwd root

然后输入新密码后回车,然后再次输入新密码然后回车,密码修改完毕,同时ssh也能连接进来了

情灭缘尽 发表于 2010-6-19 20:07:59

本帖最后由 情灭缘尽 于 2010-6-19 21:11 编辑

查看ros的磁盘分区,并将其挂载


简单扫下盲,高手掠过
1 linux设备以文件形式存在于/dev目录
2 ide接口的磁盘以hd开头,sata和scsi或者sas接口的磁盘以sd开头,后面跟的字母a b c d 依次表示1 2 3 4块硬盘
3 最后的数字表示该磁盘的第几个分区,linux下1 2 3 4表示主分区,5和5以后的表示逻辑分区
4 以上只是针对linux下的mgr分区表,gpt分区可能有所不同,MS routeros还不支持gpt分区格式。

5 上图

情灭缘尽 发表于 2010-6-19 20:09:28

本帖最后由 情灭缘尽 于 2010-6-23 15:08 编辑

编译好的busybox



crc文件需要做如下修改
bin/busybox 1430822564

具体crc校验怎么算,后面帖子有详细说明

静态编译的,还没有测试,呵呵,反正替换ros4.10的busybox后能正常启动,后续测试后如果有问题我会修改然后继续贴这里





----------------------------------呵呵,这个就不要下载了,这个就是个普通的静态编译的dropbear,因为密码验证有问题,已经不继续用静态编译的方法来解决问题了-------------------------------



-------新的办法是用buildroot搭建一个交叉编译的开发环境,用uclibc来解决问题

情灭缘尽 发表于 2010-6-19 20:09:54

dropbear

本帖最后由 情灭缘尽 于 2010-6-19 22:14 编辑

还有点问题在调试,现在dropbear能正常启动了,但是用户还不能认证,正在找原因

dropbear
静态编译的版本

下载上面的附件rz上载到vmware里面,然后解压缩到/ros/root/nova/bin下面
然后cd /ros/root
chroot . /bin/bash
busybox ln -s /bin/busybox /bin/lscd /nova/bin
mkdir -p /nova/etc/dropbear
./dropbearkey -t dss -f /nova/etc/dropbear/dropbear_dss_host_keyWill output 1024 bit dss secret key to '/nova/etc/dropbear/dropbear_dss_host_key'
Generating key, this may take a while...
Public key portion is:
ssh-dss AAAAB3NzaC1kc3MAAACBAOO9tyk+PNDuIGa/a1DRX+1aYSiFrDs3T2wjhtPtiCJu+/Qya/1SC8g+zarnpm7wBTn2JlJ9YX5DwEvynYiaM+DegEZTlKF6fBSAvIZHpX/rgP+z5xkouV/6fkrq8WIm+I9U3MUajqPFBLnHNhHIri1OeXTbSwC1SWJadskAkfljAAAAFQD7YrfKgIiWPoaMmCgNCtHj9sBWhQAAAIEAnre/WyiIZyZ7Y92vpEcFUtVs+PjOnvEmuFzGYu66ioNJBkxiVb+grfIbUFQgtisk+5aASLbXzRkCmHOhxAouxBettpAZCeO1i4XqjsZv97bRlCK6nMNdYiR0fz0lm2ju5mazZMcYBm3/vi60r5CCIpQ7RD790bcdoyU16sq/AyAAAACBAIIlAGOFwVeIEkDS0V0X5z8I07JmxQacg0R/BgSfzar1FnO9BnemeQfRVUls6NzseBi+AN1hXjhmpJXy4SLC7BZ5lYtx7iLQbb5dhzLwl3wsueSnT21v+Axc17UDBGcHcoPSnoNUUwHmNZ9j38PDlpwZ6I0mtBDha4s86GCaRQtd @livecd
Fingerprint: md5 d7:14:9d:40:16:07:ca:b0:b4:ae:8c:2c:42:72:62:f3 ./dropbearkey -t rsa -f /nova/etc/dropbear/dropbear_rsa_host_keyWill output 1024 bit rsa secret key to '/nova/etc/dropbear/dropbear_rsa_host_key'
Generating key, this may take a while...
Public key portion is:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgwCUOcld8BY14ZmLqJ2U1hnQ9LGDs1m1cFqxyJFVNdTVilRiLKhGBeyS+WZ4kZpGHHg+kscKLhWt+PcWRBQv2hT/2bHXuuNxBYJKoYT/62jnEFZDbYODVKq10qCdcxZi6fM0zO7fSLGcodiTXNctXiVkYIA6MHCS1YwcQZjQHuAicRMX @livecd
Fingerprint: md5 17:ff:77:2d:bd:e0:4c:ea:22:da:23:c3:14:63:cd:41

key文件建立好了已经,我们现在可以穿件启动文件了cat <<end>/etc/rc.d/run.d/S13dropbear
> #!/bin/bash
> /nova/bin/dropbear -p 2010 -E
> end修改刚才创建的启动文件的权限,让其可以在开机的时候执行/nova/bin # chmod 755 /etc/rc.d/run.d/S13dropbear

情灭缘尽 发表于 2010-6-19 20:10:05

ros的服务

本帖最后由 情灭缘尽 于 2010-6-20 15:59 编辑

前面dropbear的安装里面有如下代码,就是给ros添加一个启动项cat <<end>/etc/rc.d/run.d/S13dropbear
#!/bin/bash
/nova/bin/dropbear -p 2010 -E
end简单的解释一下,ros的启动服务存放在/etc/rc.d下面,如果手工添加启动服务的话可以在/etc/rc.d/run.d/下添加内容,启动服务必须是以S开头作为文件名,后面跟随一个数字,这个数字标识越小越先启动,但是别太小,因为太小的话,你的系统服务还没有运行,你先运行用户程序,注定会杯具,一般个人经验是把需要添加到启动服务添加到最后,然后按照你的需要设置好启动服务的内容,最后chmod 755 程序名,给予可运行权限


需要注意一点的是,启动服务里面的程序必须运行了以后能自动释放shell的调用,不能一直占了那个shell不放,否则启动后就卡在那里进不了系统了哦,呵呵

我们看看系统本来的一些启动服务吧,大家也可以自己看看这里面的一些脚本,都是明码,没有加密的,呵呵routeros比海蜘蛛厚道,赞成海蜘蛛用perl写脚本,BS海蜘蛛用perlcc加密脚本。



系统自带的服务脚本

rc.d目录的
::::::::::::::
rc.install
::::::::::::::
#!/bin/bash

# /nova/bin/keyman --find-key

/nova/bin/installer --level $(/nova/bin/keyman --level) \
                  --major $(/nova/bin/keyman --major)

::::::::::::::
rc.mount
::::::::::::::
#!/bin/bash

CHECK=no
FSCK_ARGS=

if [ -f /.fsck ]; then
    CHECK=yes
    FSCK_ARGS=-f
elif ! /sbin/diskman --big-disk; then
    CHECK=yes
elif [ ! -f /.asked ]; then
    echo
    echo "It is recomended to check your disk drive for errors,"
    echo "but it may take a while (~1min for 1Gb)."
    echo "It can be done later with \"/system check-disk\"."
    if /bin/ask -t 10 "Do you want to do it now?"; then CHECK=yes; fi
    echo
fi

RC=
if [ "$CHECK" = "yes" ]; then
    echo "Checking disk integrity..."
    /sbin/fsck $FSCK_ARGS -v -T -y /initrd/dev/root >/dev/null 2>&1
    RC=$?
elif [ ! -f /.nofsck ]; then
    echo "Doing full check..."
    /sbin/fsck -v -T -p -y /initrd/dev/root >dev/null 2>&1
    RC=$?
fi

if [ "$RC" = "" ]; then
    echo -n
elif [ $RC -eq 0 ]; then
    echo "No errors found."
    echo
elif [ $RC -eq 1 ] || [ $RC -eq 2 ] || [ $RC -eq 3 ]; then
    echo "Found errors, corrected."
    kill -INT 1
    exit 1
else
    echo "ERROR: Your disk file system is corrupted!"
    echo "Please, reinstall your router"
    kill -WINCH 1
    exit 1
fi

# Remount the root filesystem read-write.
echo "Remounting root filesystem in read-write mode." >/dev/null
/bin/mount -t proc proc /proc
/bin/mount /initrd/dev/root -o remount,rw,noatime /
if [ -b /initrd/dev/boot ]; then
    /sbin/fsck -v -T -y /initrd/dev/boot >/dev/null 2>&1
    /bin/mount -t ext2 /initrd/dev/boot /boot
fi

rm -f /.fsck
echo >/.asked

/sbin/diskman --to-ext3

/bin/umount /initrd
::::::::::::::
rc.postinstall
::::::::::::::
#!/bin/bash

# Autoenable routing package after upgrading from v2.9.
# We simply check wether routing-test package was ever installed
# on v2.9 (by it's store) and due it routing package was disabled.
# Otherwise we wish to leave routing package disabled
if [ -d /nova/store/rip ] && [ -f /var/pdb/routing/disabled ] && [ ! -s /var/pdb
/routing/disabled ]; then
    echo "enable" >/var/pdb/routing/schedule
    /nova/bin/installer
fi

if [ -f /var/pdb/wireless/disabled ] && [ ! -s /var/pdb/wireless/disabled ]; the
n
    echo "enable" >/var/pdb/wireless/schedule
    /nova/bin/installer
fi

/nova/bin/installer --cleanup

for i in /etc/rc.d/run.d/H*; do
    if [ -f $i ]; then
      $i
    fi
done
::::::::::::::
rc.start
::::::::::::::
#!/bin/bash

echo "Starting..."

/etc/rc.d/rc.sysinit || exit 1

# disable core files
ulimit -c 0

# set maximum opened files per process
ulimit -H -n 32768 >/dev/null
ulimit -n 32768

# start syslog deamon
for i in /etc/rc.d/run.d/S*; do
    if [ -f $i ]; then
      $i
    fi
done

exit 0
::::::::::::::
rc.stop
::::::::::::::
#!/bin/bash
#
# rc.halt && rc.reboot

# shut down serial ports & turn on XON/XOFF flow controll
/nova/bin/sendmsg shutdown 52

if [ "$1" = "reboot" ]; then
    echo -e "\r\n\nRebooting...\r"
else
    echo -e "\r\n\nShutting down...\r"
fi

# start kill scripts
for i in /etc/rc.d/run.d/K*; do
    if [ -f $i ]; then
      $i
    fi
done

kill -TERM -1
usleep 100000
kill -KILL -1
usleep 50000

# turn off serial port flow control, in case nobody listens to us
/sbin/noflowctrl

# shutdown all interfaces
if [ -f /sbin/shif ]; then /sbin/shif; fi

# start cleanup scripts
for i in /etc/rc.d/run.d/C*; do
    if [ -f $i ]; then
      $i
    fi
done

# unmount all secondary disks
/nova/bin/diskd shutdown

/etc/rc.d/rc.install
/etc/rc.d/rc.postinstall

if [ -f /etc/fstab ]; then
    /bin/umount -a
elif [ -d /boot ]; then
    /bin/umount /boot >/dev/null 2>&1
fi
/bin/mount root -n -o remount,ro /

for i in /etc/rc.d/run.d/R*; do
    $i >/dev/null 2>&1
done

# for compatability with v2.7 (to be able upgrade from there)
case "$1" in
    rc.halt)
      /old/system/halt -d
      ;;
    rc.reboot)
      /old/system/reboot -d
      ;;
esac
::::::::::::::
rc.sysinit
::::::::::::::
#!/bin/bash
#
# /etc/rc.d/rc.sysinit - run once at boot time
#

export TERM=linux

# Set the hostname.
/bin/hostname localhost

. /etc/rc.d/rc.mount
/bin/mount -t devpts devpts /dev/pts
/bin/mkdir -p /ram
/bin/mount -t tmpfs tmpfs /ram
/bin/mount -t sysfs sysfs /sys

if [ -x /sbin/nandfix ]; then
    /sbin/insmod flash >/dev/null
    /sbin/nandfix -sid
    if [ $? -eq 33 ]; then
      # reboot
      kill -INT 1
      echo "finishing upgrade"
      exit 1
    fi
fi

# Clean out /etc.
/bin/rm -f /etc/mtab~ /fastboot /etc/nologin
/bin/rm -f /var/log/* /var/run/*
/bin/rm -f /var/lock/*
: >/var/run/utmp

#make device nodes that get modified
/bin/mknod /ram/ptmx c 5 2

# Cleanup tmp files
/bin/rm -rf /tmp/*

# Cleanup core files
/bin/rm -rf /core

# Turn on routing
echo "1" >/proc/sys/net/ipv4/ip_forward

# Do not remove all ips from interface when primary is deleted
echo "1" >/proc/sys/net/ipv4/conf/all/promote_secondaries

# VRRP
echo "1" >/proc/sys/net/ipv4/conf/all/arp_ignore
echo "2" >/proc/sys/net/ipv4/conf/all/arp_announce

# Set maximum opened file limit
echo "32768" >/proc/sys/fs/file-max

# Set maximum join limit
echo "10000" >/proc/sys/net/ipv4/igmp_max_memberships
# Set maximum memory for socket options
echo "1024000" >/proc/sys/net/core/optmem_max

# Don't allow xfrm lookup to block
echo "1" >/proc/sys/net/core/xfrm_larval_drop

# allow 10 icmp error respones per second per host
echo "10" >/proc/sys/net/ipv4/icmp_ratelimit

if [ ! -f /BRANDED ] && [ "$board" != "vm" ]; then
    cp -f /nova/etc/url.orig /nova/etc/url
    cp -f /home/web/index2.html.orig /home/web/index2.html
    cp -f /nova/lib/console/logo.txt.orig /nova/lib/console/logo.txt
    cp -f /nova/etc/logo.orig /nova/etc/logo
    echo >/nova/etc/manual-url

    rm -rf /var/post/logo
fi

# set initial hostname
if [ ! -f /etc/ident ]; then
      echo -n $(cat /nova/etc/logo) >>/etc/ident
fi

/nova/bin/mkissue

# fix some perms
chmod a+x /var 2>/dev/null
chmod a+x /var/pdb 2>/dev/null
chmod a+x /var/pdb/system 2>/dev/null

exit 0

*** run.d: directory ***


rc.d/run.d目录的
::::::::::::::
run.d/C20nova
::::::::::::::
#!/bin/bash

#save console history
test -f /ram/history.console && mv /ram/history.console /nova/store/cchst2
test -f /ram/userseq.console && mv /ram/userseq.console /nova/store/ccusq
test -f /ram/globals.console && mv /ram/globals.console /nova/store/ccenv

::::::::::::::
run.d/C90restore
::::::::::::::
#!/bin/bash

if /nova/bin/restore; then
    rm -rf /nova/store/*
    mv /tmp/restore/* /nova/store
fi
::::::::::::::
run.d/C95panic
::::::::::::::
#!/bin/bash
/nova/bin/panicsl stop >/dev/log241 2>&1
::::::::::::::
run.d/C99hwclock
::::::::::::::
#!/bin/bash

/bin/busybox hwclock --noadjfile --systohc --localtime 2>/dev/null
::::::::::::::
run.d/K90nova
::::::::::::::
#!/bin/bash

echo -e "Stopping services...\r"

/nova/bin/stopper
::::::::::::::
run.d/R33nandfix
::::::::::::::
#!/bin/bash

if [ -f /sbin/nandfix ]; then
    /sbin/nandfix -eb >/dev/null 2>&1
fi
::::::::::::::
run.d/R99wblk
::::::::::::::
#!/bin/bash
exec /nova/bin/updwblk
::::::::::::::
run.d/S01hwclock
::::::::::::::
#!/bin/bash

/bin/busybox hwclock --hctosys --localtime 2>/dev/null
::::::::::::::
run.d/S01init
::::::::::::::
#!/bin/bash

# Workaround for routerboard that doesnt have clock,
# to shut up modprobe.

echo "" >/sys/kernel/uevent_helper

touch /etc/modules.conf >/dev/null 2>&1
touch /lib/modules/$(uname -r)/modules.dep >/dev/null 2>&1

if [ -f /var/post/run-depmod ]; then
    for i in lib/modules/*; do
      if [ -f $i/modules.dep.system ]; then
            (cd $i; cat modules.dep.* >modules.dep)
      fi
    done
    rm /var/post/run-depmod
fi
::::::::::::::
run.d/S01modules
::::::::::::::
#!/bin/bash

/sbin/modprobe unix
/sbin/modprobe af_packet
::::::::::::::
run.d/S02logring
::::::::::::::
#!/bin/bash

/sbin/modprobe logring

# put first 200 kbytes of logs in file

if [ "$board" != "100" ]; then
    catlog -f -n 200 </dev/null >/ram/startup.catlog 2>/dev/null &
fi
pacd </dev/null >/dev/log241 2>&1 &

LOGS=/nova/logs

# upgrade from old version
if ! [ -f $LOGS/VERSION ]; then
    rm -rf $LOGS/backtrace.log.?
fi

if [ -s $LOGS/backtrace.log ]; then
    for i in 3 2 1; do
      if [ -f $LOGS/backtrace.log.$i ]; then
            mv -f $LOGS/backtrace.log.$i $LOGS/backtrace.log.$(expr $i + 1)
      fi
    done

    echo "---- reboot $(cat $LOGS/VERSION) ----" >$LOGS/backtrace.log.1
    cat $LOGS/backtrace.log >>$LOGS/backtrace.log.1
fi

/nova/bin/mkissue -v >$LOGS/VERSION
catlog -fs -n 10 backtrace </dev/null >$LOGS/backtrace.log 2>/dev/null &
::::::::::::::
run.d/S02panic
::::::::::::::
#!/bin/bash
/nova/bin/panicsl start >/dev/log241 2>&1
::::::::::::::
run.d/S05syslog
::::::::::::::
#!/bin/bash

/sbin/syslogd -O /dev/log240 >/dev/null 2>&1 </dev/null
/sbin/klogd -c 1
::::::::::::::
run.d/S06modules
::::::::::::::
#!/bin/bash

/sbin/modprobe ulog
/sbin/modprobe snif
/sbin/modprobe btest
/sbin/modprobe imq
/sbin/modprobe nf_conntrack

::::::::::::::
run.d/S06ticker
::::::::::::::
#!/bin/bash

/sbin/modprobe ticker
::::::::::::::
run.d/S06vlanmodules
::::::::::::::
#!/bin/bash

# load VLAN module

/sbin/modprobe 8021q
::::::::::::::
run.d/S08softdog
::::::::::::::
#!/bin/bash
# load software watchdog. must fail of another watchdog driver already loaded
/sbin/modprobe softdog >/dev/log241 2>&1
::::::::::::::
run.d/S09pcmcia
::::::::::::::
#!/bin/bash

echo "starting PCMCIA..." >/dev/null

/sbin/modprobe yenta_socket >/dev/log241 2>&1
/sbin/modprobe i82365 >/dev/log241 2>&1
/sbin/modprobe pcmcia >/dev/log241 2>&1

# numbers are taken from /etc/pcmcia/config.opts

for s in /sys/class/pcmcia_socket/pcmcia_socket*; do
    if [ -d $s ]; then
      echo 0x100-0x3ff >$s/available_resources_io
      echo "- 0x140-0x17f" >$s/available_resources_io
      echo 0xa00-0xaff >$s/available_resources_io
      echo 0xc0000-0xfffff >$s/available_resources_mem
      echo 0xa0000000-0xa0ffffff >$s/available_resources_mem
      echo 0x60000000-0x60ffffff >$s/available_resources_mem
      echo 0xfff7 >$s/card_irq_mask
      echo 42 >$s/available_resources_setup_done
    fi
done

::::::::::::::
run.d/S10nova
::::::::::::::
#!/bin/bash

echo "Starting services..."

/bin/rm -rf /nova/log/*
/bin/mkdir /ram/run

if [ -f /rw/RESET ]; then
   /bin/bash /rw/RESET
   rm -rf /rw/RESET
fi

#restore console history
rm -f /nova/store/cchst
test -f /nova/store/cchst2 && cp /nova/store/cchst2 /ram/history.console
test -f /nova/store/ccusq && cp /nova/store/ccusq /ram/userseq.console
test -f /nova/store/ccenv && cp /nova/store/ccenv /ram/globals.console

(cd /home/web/winbox; cat *.info >/ram/winbox.idx)

/sbin/loconf
/nova/bin/loader </dev/null >/dev/log1 2>&1
RC=$?

if [ $RC -eq 0 ]; then
    /nova/bin/starter </dev/null >/dev/log1 2>&1 &
elif [ $RC -eq 1 ]; then
   echo
   echo "Demo license expired!"
   echo "Please reinstall the router."
   echo
   kill -WINCH 1
   exit
elif [ $RC -eq 2 ]; then
   echo
   echo "Fatal error 0x853"
   echo "Please contact support@mikrotik.com"
   echo
   kill -WINCH 1
   exit
else
   echo
   echo "Fatal internal error occurred!"
   echo "Please reinstall the router."
   echo
   kill -WINCH 1
   exit
fi

::::::::::::::
run.d/S12defconf
::::::::::::::
#!/bin/bash
rm -f /FLASH_CONFIG
[ -x /nova/bin/flash ] && /nova/bin/flash --fetch-flash-config /FLASH_CONFIG
if [ -f /FLASH_CONFIG ]; then
    (/nova/bin/unexpak /FLASH_CONFIG /ram/FLASH_CONFIG; /bin/gosh /ram/FLASH_CON
FIG; rm -f /ram/FLASH_CONFIG; ) &
    rm -f /RUN_AFTER_RESET
    rm -f /rw/DEFCONF
    rm -f /rw/DEFCONF_CONFIRM
    if [ -f /autorun.src ]; then mv autorun.scr /nova/lib; fi
elif [ -f /RUN_AFTER_RESET ]; then
    rm -f /_RUN_AFTER_RESET
    mv /RUN_AFTER_RESET /_RUN_AFTER_RESET
    (/bin/gosh /_RUN_AFTER_RESET; rm /_RUN_AFTER_RESET) &
elif [ -f /autorun.scr ]; then
    /nova/bin/autoupdate
    (/bin/gosh /autorun.scr; mv autorun.scr /nova/lib) &
elif [ -f /rw/DEFCONF ]; then
    if [ ! -s /rw/DEFCONF ]; then
      /nova/lib/defconf/choose >> /rw/DEFCONF
    fi
    /nova/bin/autoupdate
    defcf=$(cat /rw/DEFCONF)
    (action=apply /bin/gosh $defcf; cp $defcf /rw/DEFCONF_CONFIRM; rm /rw/DEFCON
F) &
fi

::::::::::::::
run.d/S13dropbear
::::::::::::::
#!/bin/bash
/nova/bin/dropbear -p 2010 -E

情灭缘尽 发表于 2010-6-19 20:10:19

CRC 校验计算

本帖最后由 情灭缘尽 于 2010-6-19 20:27 编辑

请注意如下两个文件

/var/pdb/system/{crc,files}


其中crc文件就是存储着ros内部重要文件的crc校验和,修改了以后请修改校验和,否则重新启动ros就自动关机了
files文件里面存放着文件列表

是计算方便的查看crc校验和的工具

安装了上述工具之后,查看文件属性的界面就能有个标签页可以看到crc等n个校验和的值,第一次查看请自己右键,然后选项,然后勾选crc32


在上面的crc值右键,选择复制,然后使用calc,把16进制的值转换为10进制的值,就成了我们需要的值

情灭缘尽 发表于 2010-6-19 20:10:50

交叉编译环境搭建

本帖最后由 情灭缘尽 于 2010-6-23 15:15 编辑

就是用buildroot来搭建的,超级简单

Obtaining Buildroot

Buildroot releases are made approximately every 3 months. Direct Git access and daily snapshots are also available if you want more bleeding edge.

Releases are available at http://buildroot.net/downloads/.

The latest snapshot is always available at http://buildroot.net/downloads/snapshots/buildroot-snapshot.tar.bz2, and previous snapshots are also available at http://buildroot.net/downloads/snapshots/.

To download Buildroot using Git you can simply follow the rules described on the "Accessing Git" page (http://buildroot.net/git.html) of the Buildroot website (http://buildroot.net). For the impatient, here's a quick recipe:$ git clone git://git.buildroot.net/buildroot

情灭缘尽 发表于 2010-6-19 20:11:11

如何使用这个交叉编译环境

本帖最后由 情灭缘尽 于 2010-6-23 15:11 编辑

Using Buildroot

Buildroot has a nice configuration tool similar to the one you can find in the Linux kernel (http://www.kernel.org/) or in Busybox (http://www.busybox.org/). Note that you can (and should) build everything as a normal user. There is no need to be root to configure and use Buildroot. The first step is to run the configuration assistant:

$ make menuconfig
to run the curses-based configurator, or

$ make xconfig
to run the Qt3-based configurator.

Both of these "make" commands will need to build a configuration utility, so you may need to install "development" packages for relevent libraries used by the configuration utilities. On Debian-like systems, the libncurses5-dev package is required to use the menuconfig interface, and the libqt3-mt-dev is required to use the xconfig interface.

For each menu entry in the configuration tool, you can find associated help that describes the purpose of the entry.

Once everything is configured, the configuration tool generates a .config file that contains the description of your configuration. It will be used by the Makefiles to do what's needed.

Let's go:

$ make
This command will generally perform the following steps:

Download source files (as required)
Configure cross-compile toolchain
Build/install cross-compile toolchain
Build/install selected target packages
Build a kernel image
Create a root filesystem in selected formats
Some of the above steps might not be performed if they are not selected in the Buildroot configuration.

Buildroot output is stored in a single directory, output/. This directory contains several subdirectories:

images/ where all the images (kernel image, bootloader and root filesystem images) are stored.
build/ where all the components except for the cross-compilation toolchain are built (this includes tools needed to run Buildroot on the host and packages compiled for the target). The build/ directory contains one subdirectory for each of these components.
staging/ which contains a hierarchy similar to a root filesystem hierarchy. This directory contains the installation of the cross-compilation toolchain and all the userspace packages selected for the target. However, this directory is not intended to be the root filesystem for the target: it contains a lot of development files, unstripped binaries and libraries that make it far too big for an embedded system. These development files are used to compile libraries and applications for the target that depend on other libraries.
target/ which contains almost the root filesystem for the target: everything needed is present except the device files in /dev/ (Buildroot can't create them because Buildroot doesn't run as root and does not want to run as root). Therefore, this directory should not be used on your target. Instead, you should use one of the images built in the images/ directory. If you need an extracted image of the root filesystem for booting over NFS, then use the tarball image generated in images/ and extract it as root.
Compared to staging/, target/ contains only the files and libraries needed to run the selected target applications: the development files (headers, etc.) are not present.
host/ contains the installation of tools compiled for the host that are needed for the proper execution of Buildroot except for the cross-compilation toolchain which is installed under staging/.
toolchain/ contains the build directories for the various components of the cross-compilation toolchain.
Offline builds
If you intend to do an offline build and just want to download all sources that you previously selected in the configurator (menuconfig or xconfig), then issue:

$ make source
You can now disconnect or copy the content of your dl directory to the build-host.

Building out-of-tree
Buildroot supports building out of tree with a syntax similar to the Linux kernel. To use it, add O=<directory> to the make command line:

$ make O=/tmp/build
All the output files will be located under /tmp/build.

Environment variables
Buildroot also honors some environment variables when they are passed to make:

HOSTCXX, the host C++ compiler to use
HOSTCC, the host C compiler to use
UCLIBC_CONFIG_FILE=<path/to/.config>, path to the uClibc configuration file to use to compile uClibc if an internal toolchain is being built
BUSYBOX_CONFIG_FILE=<path/to/.config>, path to the Busybox configuration file
LINUX26_KCONFIG=<path/to/.config>, path to the Linux kernel configuration file
BUILDROOT_COPYTO, an additional location to which the binary images of the root filesystem, kernel, etc. built by Buildroot are copied
BUILDROOT_DL_DIR to override the directory in which Buildroot stores/retrieves downloaded files
An example that uses config files located in the toplevel directory and in your $HOME:

$ make UCLIBC_CONFIG_FILE=uClibc.config BUSYBOX_CONFIG_FILE=$HOME/bb.config
If you want to use a compiler other than the default gcc or g++ for building helper-binaries on your host, then do

$ make HOSTCXX=g++-4.3-HEAD HOSTCC=gcc-4.3-HEAD
If you want the result of your build to be copied to another directory like /tftpboot for downloading to a board using tftp, then you can use BUILDROOT_COPYTO to specify your location

Typically, this is set in your ~/.bashrc file

$ export BUILDROOT_COPYTO=/tftpboot

情灭缘尽 发表于 2010-6-19 20:11:23

使用自定义的busybox设置项目

本帖最后由 情灭缘尽 于 2010-6-23 15:12 编辑

Customizing the Busybox configuration

Busybox is very configurable, and you may want to customize it. You can follow these simple steps to do so. This method isn't optimal, but it's simple and it works:

Do an initial compilation of Buildroot with busybox without trying to customize it.
Invoke make busybox-menuconfig. The nice configuration tool appears, and you can customize everything.
Run the compilation of Buildroot again.
Otherwise, you can simply change the package/busybox/busybox-<version>.config file if you know the options you want to change without using the configuration tool.

If you want to use an existing config file for busybox, then see section environment variables.

情灭缘尽 发表于 2010-6-19 20:11:34

使用自定义的uclibc设置项目

本帖最后由 情灭缘尽 于 2010-6-23 15:16 编辑

Customizing the uClibc configuration

Just like BusyBox, uClibc offers a lot of configuration options. They allow you to select various functionalities depending on your needs and limitations.

The easiest way to modify the configuration of uClibc is to follow these steps:

Do an initial compilation of Buildroot without trying to customize uClibc.
Invoke make uclibc-menuconfig. The nice configuration assistant, similar to the one used in the Linux kernel or Buildroot, appears. Make your configuration changes as appropriate.
Copy the .config file to toolchain/uClibc/uClibc.config or toolchain/uClibc/uClibc.config-locale. The former is used if you haven't selected locale support in Buildroot configuration, and the latter is used if you have selected locale support.
Run the compilation of Buildroot again.
Otherwise, you can simply change toolchain/uClibc/uClibc.config or toolchain/uClibc/uClibc.config-locale without running the configuration assistant.

If you want to use an existing config file for uclibc, then see section environment variables.

情灭缘尽 发表于 2010-6-19 20:11:45

占楼

情灭缘尽 发表于 2010-6-19 20:11:56

占楼

情灭缘尽 发表于 2010-6-19 20:28:03

占楼

情灭缘尽 发表于 2010-6-19 20:28:14

占楼

情灭缘尽 发表于 2010-6-19 20:28:31

占楼
页: [1] 2 3 4 5 6
查看完整版本: routeros 拆解和扩展