第一种:pogoplug pro/video/v3 (据说熊老板出的货是video版的)
基本参数如下:
架构:ARM v6l
处理器:PLX NAS-7820 700MHz 双核
内存: DDR2 128MB
FLASH: NAND 128MB
接口:USB x4 , SATA x1 , 千兆 x 1, mini PCI-e x 1
产品编号:
POGO-P01 - Pro
POGO-P21 - V3
POGO-P24 - V3
POGO-P25 - V3
POGO-B01 - Classic
POGO-B02 - Classic
POGO-B03 - Classic
POGO-B04 - Classic
————————————————————————————————————
第二种:pogoplug v2 (pink/gray)
基本参数如下:
架构:ARM v5te
处理器:Marvell Kirkwood 1.2GHz (88f6281这个大家很熟了吧)
内存:256MB
FLASH: NAND 128MB
接口:接口:USB x4 , 千兆 x 1,
产品编号:
POGO-E02
POGO-E02G
———————————————————————————————————
Marvell的这个芯片在很多产品都用了,国外也有大量相关的改机资料,
所以很多资料都是针对第二个型号写的,尽管都是基于ARM的,而且事实上编译好
的文件也绝大多数能通用,但还是有区别的。所以大家在引用资料的时候,最好
先区分一下。
pogoplug pro/video/v3内核为ARM11 MPCore
编译-march=armv6k -mtune=mpcore -mfloat-abi=softfp
或者-mcpu=mpcore -mfloat-abi=softfp
参考http://blog.qnology.com/2015/04/hacking-pogoplug-v3oxnas-proclassic.html?showComment=1464198116974#c7190902143829429000
https://forum.doozan.com/read.php?3,16017
Use Putty or your favorite SSH client to connect to your Pogoplug前提是Pogoplug上有linux系统
Verify Pogoplug is expected version (Oxnas)
# cat /proc/cpuinfo | grep Hardware
Hardware : PLXTECH NAS782X SoC (Flattened Device Tree)
#Stop here if not expected output.
#Expected output
#Hardware : PLXTECH NAS782X
#stop my.pogoplug.com service
killall hbwd
#download firmware utilities
cd /tmp
wget http://download.qnology.com/pogoplug/v4/nanddump
wget http://download.qnology.com/pogoplug/v4/nandwrite
wget http://download.qnology.com/pogoplug/v4/flash_erase
wget http://download.qnology.com/pogoplug/v4/fw_printenv
wget http://download.qnology.com/pogoplug/v4/fw_setenv
#make executable
chmod +x flash_erase fw_printenv fw_setenv nanddump nandwrite
或者也可以用apt-get install systemd u-boot-tools mtd-util安装相关工具
#remount '/' as read/write
#by default the Pogoplug OS (internal flash) is read only
mount -o remount,rw /
#setup fw_env.config for oxnas
echo "/dev/mtd0 0x00100000 0x20000 0x20000">/etc/fw_env.config
#save original envs
/usr/local/cloudengines/bin/blparam > /blparam.txt
#Download and flash new uBoot
wget http://download.qnology.com/pogoplug/oxnas/uboot.2013.10-tld-4.ox820.bodhi.tar
wget http://download.qnology.com/pogoplug/oxnas/uboot.2013.10-tld-4.ox820.bodhi.tar.md5
#check md5sum
md5sum -c uboot.2013.10-tld-4.ox820.bodhi.tar.md5
我下的版本是uboot.2015.10-tld-2.ox820.bodhi.tar
#extract uBoot files
tar -xf uboot.2013.10-tld-4.ox820.bodhi.tar
建议先# cat /proc/mtd查看分区
# dmesg | grep -i 'bad'查看坏块
#BE EXTRA CAREFUL WITH THE THESE COMMANDS.
#NO TYPOS! CUT AND PASTE.
#Erase and flash uboot on mtd0
#Flash encoded spl stage1 to 0x0
/tmp/flash_erase /dev/mtd0 0x0 6
/tmp/nandwrite /dev/mtd0 uboot.spl.2013.10.ox820.850mhz.mtd0.img
#Flash uboot to 0x40000
/tmp/nandwrite -s 262144 /dev/mtd0 uboot.2013.10-tld-4.ox820.mtd0.img
#Flash uboot environment
#Erase 1 block starting 0x00100000
/tmp/flash_erase /dev/mtd0 0x00100000 1
/tmp/nandwrite -s 1048576 /dev/mtd0 pogopro_uboot_env.img
#default to pogoplug pro dtb
/tmp/fw_setenv fdt_file '/boot/dts/ox820-pogoplug-pro.dtb'
/tmp/fw_setenv dt_load_dtb 'ext2load usb 0:1 $dtb_addr $fdt_file'
#Set MAC Address
/tmp/fw_setenv ethaddr "$(cat /sys/class/net/eth0/address)"
这条我自己改的如下
root@PogoPlug-Pro:/tmp# fw_printenv ethaddr '00:30:e0:00:00:01'
root@PogoPlug-Pro:/tmp# fw_setenv cesvcid '10944208800246860E20UM11A01'
#Update IP Addresses as appropriate
#ipaddr = Pogoplug IP
/tmp/fw_setenv preboot 'run preboot_nc'
/tmp/fw_setenv ipaddr '172.31.0.128'
/tmp/fw_setenv serverip '172.31.0.100'
#print out all uboot environment parameters
#make sure there are no errors
/tmp/fw_printenv > /fw_printenv.txt
/tmp/fw_printenv
目前已经把最新的u-boot刷入板载flash以及设置好了环境变量,可以从U盘启动或者硬盘启动
确定需制作的硬盘所在/dev/sdX
清空32M扇区,这一步会导致硬盘分区表丢失dd if=/dev/zero of=/dev/sdb bs=1M count=32
格式化U盘&硬盘
fdisk -c=dos /dev/sdX
t/1/c
创建第一个启动分区内建boot文件夹放uImage、uInitrd、dtb
n/p/1/+100M
a貌似这个在u-boot引导下启动标志没用,具体不清楚
创建第二个主分区放系统文件rootfs
n/p/2/+40G
创建第三个主分区swap
n/p/3/+2G
t/3/82
创建第四个主分区放其他内容
n/p/4
使用默认参数,回车2次
写进分区表(注意检查设置是否正确)
w
#Format USB Flash Drive
cd /tmp
wget http://archlinuxarm.org/os/pogoplug/mke2fs
chmod 755 mke2fs
或者也可以用apt-get install systemd u-boot-tools mtd-util安装相关工具
#format as ext3 and label partition as 'rootfs'
mke2fs -t ext3 -O ^has_journal /dev/sda2(大容量U盘只能用这个命令格)
tune2fs -L "rootfs" /dev/sda2
mount
mkdir /tmp/usb
mount /dev/sda2 /tmp/usb
cd /tmp/usb
#Download Debian rootfs
wget http://download.qnology.com/pogoplug/oxnas/Debian-3.17.0-oxnas-tld-1-rootfs-bodhi.tar.bz2
wget http://download.qnology.com/pogoplug/oxnas/Debian-3.17.0-oxnas-tld-1-rootfs-bodhi.tar.bz2.md5
#check md5sum
md5sum -c Debian-3.17.0-oxnas-tld-1-rootfs-bodhi.tar.bz2.md5
我下的版本是Debian-4.4.54-oxnas-tld-1-rootfs-bodhi.tar.bz2
#extract
tar -xvjf Debian-3.17.0-oxnas-tld-1-rootfs-bodhi.tar.bz2
#cleanup
rm Debian-3.17.0-oxnas-tld-1-rootfs-bodhi.tar.bz2*
#Set etc/fstab
LABEL=rootfs / ext3 noatime,errors=remount-ro 0 1
/dev/sda3 swap swap defaults 0 0
#Sync and reboot, cross your fingers
sync
cd ..
umount /tmp/usb
reboot
注意如果是硬盘此时重启后可能u-boot无法加载uImage和uInirtd需要在重启前
mke2fs -t ext3 -O ^has_journal /dev/sda1
mkdir /tmp/sata
mount /dev/sda1 /tmp/sata
mount /dev/sda2 /tmp/usb
将rootfs内boot文件夹复制到sda1分区内,boot文件夹内只保留uImage和uInirtd和dts
#Change password
passwd
#Generate New OpenSSH Keys
rm /etc/ssh/ssh_host*
ssh-keygen -A
#Initial update
apt-get update
apt-get upgrade
#Set hostname to DebianPlug or whatever you like
echo DebianPlug>/etc/hostname
#Set Time Zone
tzselect
reboot
#backup original kernel files
cd /boot
mkdir backup
mv *3.17* backup
mv uImage backup/uImage3.17
mv uInitrd backup/uInitrd3.17
#download from bodhi's dropbox
wget --no-check-certificate https://www.dropbox.com/s/o9fp0xg8b6aajg6/linux-3.18.5-oxnas-tld-1.bodhi.tar.bz2
#check md5
echo "df386f09cf7323472d40432d3da382d5 linux-3.18.5-oxnas-tld-1.bodhi.tar.bz2" |md5sum -c
我下的版本是linux-4.4.133-oxnas-tld-1.bodhi.tar.bz2
#extract
tar -xvjf linux-3.18.5-oxnas-tld-1.bodhi.tar.bz2
#install kernel and headers
dpkg -i linux-image-3.18.5-oxnas-tld-1_1_armel.deb
dpkg -i linux-headers-3.18.5-oxnas-tld-1_1_armel.deb
#Create uImage and uInitrd manually
(前担是已有vmlinuz-3.18.5-oxnas-tld-1和initrd.img-3.18.5-oxnas-tld-1)
mkimage -A arm -O linux -T kernel -C none -a 0x60008000 -e 0x60008000 -n Linux-3.18.5-oxnas-tld-1 -d /boot/vmlinuz-3.18.5-oxnas-tld-1 /boot/uImage
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x60000000 -e 0x60000000 -n initramfs-3.18.5-oxnas-tld-1 -d /boot/initrd.img-3.18.5-oxnas-tld-1 /boot/uInitrd
#clean up
rm linux-3.18.5-oxnas-tld-1.bodhi.tar.bz2
rm *.dtb
#reboot and verify
reboot
uname -a
另一种是自己编译kernel和initrd.img(后面讲)
编译出来的结果通过tftpboot来加载测试正确性
tftpboot 60500000 /boot/uImage
tftpboot 60e00000 /boot/uInitrd
tftpboot 62c00000 /boot/dts/ox820-pogoplug-pro.dtb
bootm 60500000 60e00000 62c00000
参考https://archlinuxarm.org/forum/viewtopic.php?f=55&t=2146&sid=f4dc4863e3a93822a4f9e925b3cbda45
https://forum.doozan.com/read.php?2,16044
因刷到硬盘启动扇区上的u-boot为2013.10之前旧版只能用内核3.18.5或更早版本
工具在oxnas_sata_boot.tgz(oxnasboottarball.zip中)或者u-boot-hdd.tar中,下载地址在我网盘
第一步是编辑`disk_create`脚本中/ dev / sdX,以确保它将stage(MBR)/u-boot/kernel写入我们想要的磁盘
注意此步骤会破坏分区表
第二步修改链接stage1.wrapped,u-boot.wrapped和uImage使用需要及匹配的,如850Mhz超频stage1,Pogoplug Pro有PCI总线用uImage.pci
注意可以编辑`disk_create`脚本只刷stage1.wrapped,u-boot.wrapped,内核uImage放到主分区内,没测试过
第三步硬盘分区创建“rootfs”(参考制作启动硬盘/U盘)
最后安装内核
将重新运行disk_create脚本,将内核放入/ dev / sdz1(最好是拷贝到启动分区的/boot/文件夹下)
确保能上网,设置/etc/network/interface
# mkswap /dev/sda3
# swapon /dev/sda3
# free -m
更新源nano /etc/apt/sources.list
deb http://mirrors.ustc.edu.cn/debian stretch main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian stretch main contrib non-free
deb http://mirrors.ustc.edu.cn/debian stretch-backports main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian stretch-backports main contrib non-free
deb http://mirrors.ustc.edu.cn/debian stretch-proposed-updates main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian stretch-proposed-updates main contrib non-free
deb http://mirrors.ustc.edu.cn/debian stretch-updates main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian stretch-updates main contrib non-free
deb http://mirrors.ustc.edu.cn/debian-security/ stretch/updates main non-free contrib
deb-src http://mirrors.ustc.edu.cn/debian-security/ stretch/updates main non-free contrib
apt-get update
2.安装必备软件
apt-get install screen kernel-package libncurses5-dev fakeroot build-essential bc libssl-dev
从windows的字体目录中找到simsun.ttc文件,通过WinSCP工具连接上debian系统,把该文件传送到该系统中的/usr/share/fonts/truetype目录下
或者apt-get install ttf-wqy-microhei
对终端乱码配置 Local
apt install locales
dpkg-reconfigure locales
en_US.UTF-8 UTF-8
zh_CN.GBK GBK
zh_CN.GB2312
zh_CN.UTF-8 UTF-8
默认语言选择 en_US.UTF-8
编辑 locale 文件
nano /etc/default/locale
检查 lang 是否设置为 en_US.UTF-8 没有则修改
或者apt install zhcon
联网更新
service ntpd stop
ntpdate ntp.api.bz
查看系统时间
date
取消开机启动
chkconfig ntpd off
或者
# apt install sysv-rc-conf
# sysv-rc-conf
sysv-rc-conf 会读取 /etc/init.d 里的文件以及 rcx.d (x为运行级别)下的软连接等信息
系统运行级别:
*0:关机级别
*1:单用户运行级别,运行rc.sysinit和rc1.d目录下的脚本
*2:多用户,但系统不会启动NFS,字符模式,在有些linux系统中,级别2为默认模式,具有网络功能,如ubuntu.debian
*3:多用户,字符模式,系统启动具有网络功能,redhat常用运行级别
*4:用户自定义级别
*5:图形界面模式,redhat常用运行级别
*6:重启级别
*S:单用户运行级别,只运行rc.sysinit文件
或者
update-rc.d -f ntpd remove
时区设置
dpkg-reconfigure tzdata
Screen -S kernel
cd /usr/src/
(1)下载对应版本的源码
wget https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/linux-4.4.133.tar.gz
(2)对应板子的补丁放到源码目录
patch -p1 < ./linux-4.4.133-oxnas-tld-1.patch
打完补丁后会arch/arm目录下会有板子的源码了
(3)执行编译准备
make oxnas_v6_defconfig 生成.config
更简点cp /boot/config-4.4.133-oxnas-tld-1 .config然后按需
make menuconfig
勾选isofs模块
勾选VFP模块
勾选F2FS模块
勾选cramfs模块
make oldconfig 备份.config
make-kpkg clean
(sudo)fakeroot make-kpkg --initrd --append-to-version=-oxnas kernel-image kernel-headers
编译好的内核在上一层目录。包括linux-headers-...deb和linux-image-...deb两个文件
(讲讲make-kpkg与fakeroot这两个软件包,前者是能够自己主动替换make dep;make clean;make bzImage;make modules命令序列的脚本,而--append-to-version就是让我们来指定一个额外的内核版本号不能使用“_”。内核模块位于/lib/modules子文件夹下,创建新内核时会在/lib/modules文件夹下创建一个新的子文件夹来保存它自己的模块。)
内核将ramdisk即initrd.img当作根文件来安装,然后再利用这个根文件系统上的驱动来真正安装根文件系统,使用vi编辑/boot/config-4.4.133-oxnas文件。将代码CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"__这句话凝视掉(在句首用#),否则不会成功,接下来运行
mkinitramfs -o /boot/initrd.img-4.4.133-oxnas 4.4.133-oxnas
将kernel和initrd压缩为可u-boot引导启动
mkimage -A arm -O linux -T kernel -C none -a 0x60008000 -e 0x60008000 -n Linux-4.4.133-oxnas -d /boot/vmlinuz-4.4.133-oxnas /boot/uImage
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x60000000 -e 0x60000000 -n initramfs-4.4.133-oxnas -d /boot/initrd.img-4.4.133-oxnas /boot/uInitrd
# wget https://nodejs.org/dist/latest-v0.12.x/node-v0.12.18.tar.gz --no-check-certificate
参考https://raspberrypi.stackexchange.com/questions/24059/node-js-v0-11-14-exits-with-illegal-instruction
# V8 3.18 no longer supports VFP2.
All I could find on the topic, is that V8 3.17 is that last version to support "no-VFPv2", which makes VFPv2 the minimum requirement for V8 3.18+.
Solution
Run make uninstall
Run make clean
Edit the line in deps/v8/src/base/cpu.cc, from
char* processor = cpu_info.ExtractField("Processor");
to
char* processor = cpu_info.ExtractField("model name");
An even better solution would probably be to add a whole new check for model name, instead of replacing the Processor check.
Edit the Node configure script, from
if is_arch_armv7():
o['variables']['arm_version'] = '7'
elif is_arch_armv6():
o['variables']['arm_version'] = '6'
else:
o['variables']['arm_version'] = 'default'
o['variables']['arm_fpu'] = 'vfpv3' # V8 3.18 no longer supports VFP2.
o['variables']['arm_neon'] = int(is_arm_neon())
o['variables']['arm_thumb'] = 0 # -marm
o['variables']['arm_float_abi'] = arm_float_abi
to
if is_arch_armv7():
o['variables']['arm_fpu'] = 'vfpv3'
o['variables']['arm_neon'] = int(is_arm_neon())
o['variables']['arm_version'] = '7'
else:
o['variables']['arm_fpu'] = 'vfpv2'
o['variables']['arm_neon'] = 0
o['variables']['arm_version'] = '6' if is_arch_armv6() else 'default'
o['variables']['arm_thumb'] = 0 # -marm
o['variables']['arm_float_abi'] = arm_float_abi
Run ./configure --without-snapshot
Run make
Run make install
Verify that node --v8-options has ARMv7=0
Run make test to verify that the Node tests succeed.
安装checkinstall将编译的nodejs(在X86_64的宿主机编译)制成二进制的deb包
建个build.sh文件方便自动运行(怎样制作x-tools交叉编译器后面讲)
BuildNodeJSArmv6()
{
export PATH=$PATH:/home/firebirds/x-tools/arm-pogoplug-linux-gnueabi/bin
export CC=arm-pogoplug-linux-gnueabi-gcc
export CXX=arm-pogoplug-linux-gnueabi-g++
export LD=arm-pogoplug-linux-gnueabi-ld
export RAINLIB=arm-pogoplug-linux-gnueabi-rainlib
export AR=arm-pogoplug-linux-gnueabi-ar
export CCFLAGS='-march=armv6k -mtune=mpcore'
export CXXFLAGS='-march=armv6k -mtune=mpcore'
PREFIX_DIR="/usr/local/node"
# ./configure --without-snapshot --with-arm-float-abi=softfp --fully-static --dest-cpu=arm --dest-os=linux --prefix="${PREFIX_DIR}"
# make -j 2
# make install
checkinstall -D --install=no
}
BuildNodeJSArmv6
拓展内容将已安装软件手动制作成deb安装包
建立work目录
#mkdir work
#cd work
安装软件包的时候默认是将文件释放到根目录可以设定好它的路径
#mkdir -p usr/local
#cp -a /usr/local/go usr/local
#mkdir DEBIAN
#cat > DEBIAN/control
Package:golang #包名
Version:20181225 #版本号
Section:utils #gnome
Priority:optional #extra 优先级
Maintainer:root@debian #维护者
Homepage:http://firebirds.frp.app #主页地址
Architecture:armel #架构
Depends: #依赖的库
目录树
- 文件根/
- usr
-local/
-lib/
- DEBIAN/
control
#dpkg -b 文件根路径 目标路径(在work目录内执行)
.../work#dpkg -b . /opt/go_20181225_armel.deb
以上操作在pogoplug上均未正常运行,编译运行不成功
只能从源安装,通过在https://packages.debian.org/上搜索armel架构下的npm安装包
# nano /etc/apt/sources.list
deb http://ftp.br.debian.org/debian jessie main contrib non-free
deb-src http://ftp.br.debian.org/debian jessie main contrib non-free
deb http://ftp.br.debian.org/debian jessie-proposed-updates main contrib non-free
deb-src http://ftp.br.debian.org/debian jessie-proposed-updates main contrib non-free
deb http://ftp.br.debian.org/debian jessie-updates main contrib non-free
deb-src http://ftp.br.debian.org/debian jessie-updates main contrib non-free
deb http://ftp.br.debian.org/debian jessie-backports-sloppy main contrib non-free
deb-src http://ftp.br.debian.org/debian jessie-backports-sloppy main contrib non-free
deb http://ftp.br.debian.org/debian-security/ jessie/updates main non-free contrib
deb-src http://ftp.br.debian.org/debian-security/ jessie/updates main non-free contrib
deb http://ftp.br.debian.org/debian experimental main contrib non-free
deb-src http://ftp.br.debian.org/debian experimental main contrib non-free
只有在jessie哩才有能匹配的npm,nodejs
apt install npm
# npm -v
1.4.21
# nodejs -v
v0.10.29
版本的问题,只能装低版的cloudcmd,可以先在/tmp下测试,不行删除npm remove cloudcmd
/usr/share/npm# npm install [email protected]
# nodejs /usr/share/npm/node_modules/.bin/cloudcmd
[2018.11.11 17:18:27] url: http://localhost:8000
wget https://codeload.github.com/fatedier/frp/zip/v0.16.1 --no-check-certificate
mv v0.16.1 v0.16.1.zip
apt install unzip software-properties-common
添加源add-apt-repository ppa:gophers/archive
删除源add-apt-repository -r ppa:gophers/archive
ftp由go语言编译的所以先安装golang,但源里的版本低了需要go1.10版,因此编译golang
安装go1.6以上版本会提示 Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4.
Go1.10的构建首先从源头构建Go1.4然后用Go1.4二进制文件从源代码构建Go1.6以上版本
https://github.com/golang/go 下1.4及1.10的源码,直接下zip格式的git clone久
cd /opt/go1.4/src
./make.bash
cp -rf /opt/go1.4 ~/go1.4
cd /opt/go1.10/src
./make.bash
cp -rf /opt/go1.10 /usr/local/go
现在可以删除~主目录下的go1.4了,环境变量GOPATH的设置常导到代码无法编译,GOPATH放置第三方代码和自己的工程,参考https://gorgias.me/2017/05/03/frp使用笔记/
nano /etc/profile
# Golang Env
export PATH=/usr/local/go/bin:$PATH
export GOPATH=/root/go
$GOPATH/src/github.com/fatedier/frp
source /etc/profile
GO语言装好后再来编译frp
# git clone -b v0.16.1 https://github.com/fatedier/frp.git $GOPATH/src/github.com/fatedier/frp
# cd $GOPATH/src/github.com/fatedier/frp
# make
编译完成,配置服务器frps或者客户端frpc
我的frpc配置
[common]
# 服务器端口和地址
server_addr = frps.lu8.win
server_port = 7100
# 日志路径,客户端访问这个要root权限,后面加sudo运行吧。
log_file = /var/log/frpc.log
log_level = warn
log_max_days = 3
# 服务指定给用户的token
auth_token = frp888
# 加密通信,暂时不需要
#use_encryption = false
# 不是http的情况下,gzip压缩也不要
#use_gzip = false
[Pogoplug_pre_rev]
# 预配置
privilege_mode = true
type = tcp
local_ip = 192.168.43.2
local_port = 6000
# 远程端口
remote_port = 55555
[Pogoplug_web]
type = http
local_ip = 127.0.0.1
local_port = 80
use_gzip = true
pool_count = 20
# 可以设定访问控制
# http_user = admin
# http_pwd = admin
# 子域名,最后就是firebirds.frp.app
custom_domains = firebirds.frp.app
host_header_rewrite = www.firebirds.cn
#host_header_rewrite = blog.firebirds.cn
#[Pogoplug_cmd]
#type = http
#local_ip = 127.0.0.1
#local_port = 8000
#use_gzip = true
#pool_count = 20
## 可以设定访问控制
## http_user = admin
## http_pwd = admin
## 子域名,最后就是firebirds.frp.app
#custom_domains = firebirds.frp.app
##host_header_rewrite = www.firebirds.cn
[Pogoplug_aria]
# 预配置
privilege_mode = true
type = tcp
local_ip = aria.firebirds.cn
local_port = 6800
# 远程端口
remote_port = 55556
[Pogoplug]
# 预配置
privilege_mode = true
type = tcp
local_ip = 0.0.0.0
local_port = 22
# 远程端口
remote_port = 55557
[Pogoplug_smb]
# 预配置
privilege_mode = true
type = tcp
local_ip = 0.0.0.0
local_port = 445
# 远程端口
remote_port = 55559
sudo apt-key adv --keyserver pgp.mit.edu --recv-keys ED444FF07D8D0BF6
sudo echo "deb http://http.kali.org/kali kali-rolling main contrib non-free" >> /etc/apt/sources.list
sudo echo "deb http://repo.kali.org/kali kali-bleeding-edge main" >> /etc/apt/sources.list
sudo apt-get update
apt-get install wireless-tools iw wpasupplicant aircrack-ng reaver pciutils bully mdk3
iwconfig
ifconfig wlp0s0 up
如果启动不了就要安装驱动比如Tenda的USB网卡型号为W311U+
lsusb
Bus 001 Device 003: ID 148f:3070 Ralink Technology, Corp. RT2870/RT3070 Wireless Adapter
知道其硬件芯片型号为RT2870/RT3070然后(需要在内核中编译支持才能看得到)
apt-get install apt-file
apt-file search rt3070.bin
firmware-misc-nonfree: /lib/firmware/rt3070.bin
firmware-ralink: /lib/firmware/rt3070.bin
firmware-ralink is for use with jessie. firmware-misc-nonfree is only in unstable.
apt-get install firmware-misc-nonfree
安装驱动后看命令行/boot/initrd.img有改变因此重新mkimage制作一下uInitrd
iw dev wlp0s0 scan |grep SSID
通过以下命令生成需要的配置文件
wpa_passphrase "ESSID" "PASSWORD" > /etc/wpa_supplicant/wpa_supplicant.conf
编辑/etc/network/interfaces文件
allow-hotplug wlp0s0
auto wlp0s0
iface wlp0s0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
执行下面的命令启动无线连接:
sudo ifdown wlp0s0
sudo ifup wlp0s0
或者wpa_supplicant -i wlp0s0 -c /etc/wpa_supplicant/wpa_supplicant.conf
临时修改网关
route del default gw 192.168.10.1
route add default gw 192.168.43.1
# apt install samba nfs-common nfs-kernel-server minidlna netatalk avahi-daemon
CIFS(SAMBA)配置
#nano /etc/samba/smb.conf
在最后添加
[share]
path = /mnt
available = yes
browseable = yes
public = yes
writable = yes
#chown -R nobody. /mnt
#/etc/init.d/samba restart
NFS配置
# nano /etc/exports
/mnt *(rw,sync,no_root_squash,insecure)
# /etc/init.d/nfs-kernel-server restart
DLNA配置
nano /etc/minidlna.conf
media_dir=/mnt
# /etc/init.d/minidlna restart
Mac备份服务器配置
nano /etc/netatalk/AppleVolumes.default
注释掉# ~/ "Home Directory"
/mnt "options:tm"
创建nano /etc/avahi/services/afpd.service
%h
_afpovertcp._tcp
548
_device-info._tcp
0
model=Xserve
# /etc/init.d/netatalk restart
# /etc/init.d/avahi-daemon restart
配置FTP
apt-get install vsftpd
# cat /etc/passwd |grep ftp
ftp:x:112:115:ftp daemon,,,:/srv/ftp:/bin/false
cd /srv/ftp
mkdir pub
chown ftp:ftp pub
chmod -R 777 pub
#nano /etc/vsftpd.conf
anonymous_enable=YES
write_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
# /etc/init.d/vsftpd restart
为FTP增加穿墙支持
#nano /etc/vsftpd.conf
pasv_enable=YES
pasv_promiscuous=YES
pasv_min_port=55561
pasv_max_port=55564
# nano /etc/frpc.ini
[Pogoplug_ftp]
# 预配置
privilege_mode = true
type = tcp
local_ip = 0.0.0.0
local_port = 21
# 远程端口
remote_port = 55500
[Pogoplug_ftp1]
# 预配置
privilege_mode = true
type = tcp
local_ip = 0.0.0.0
local_port = 55561
# 远程端口
remote_port = 55561
[Pogoplug_ftp2]
# 预配置
privilege_mode = true
type = tcp
local_ip = 0.0.0.0
local_port = 55562
# 远程端口
remote_port = 55562
[Pogoplug_ftp3]
# 预配置
privilege_mode = true
type = tcp
local_ip = 0.0.0.0
local_port = 55563
# 远程端口
remote_port = 55563
[Pogoplug_ftp4]
# 预配置
privilege_mode = true
type = tcp
local_ip = 0.0.0.0
local_port = 55564
# 远程端口
remote_port = 55564
配置LNMP(一键包参考https://github.com/licess/lnmp/tree/v1.5和https://lnmp.org/faq/download-url.html)
让Apache和Nginx支持php-fpm模块(最先安装apache2)
apt-get install apache2
apt-get install nginx
/etc/init.d/nginx start
apt-get install php7.0-fpm php7.0-sqlite3 sqlite sqlite3
apt install php7.0-curl php7.0-gd php7.0-intl php-imagick php7.0-imap php7.0-mcrypt php-memcache php7.0-pspell php7.0-pspell php7.0-recode php7.0-snmp php7.0-tidy php7.0-xmlrpc php7.0-xsl php7.0-apcu
apt install php7.0-cgi spawn-fcgi
CGI是公共网关接口
Fast-cgi是常驻内存的CGI进程
spawn-fcgi 是通用的fast-cgi的进程管理器
php-cgi是Fast-cgi进程管理器的一种
php-fpm是Fast-cgi的进程管理器的另一种
# nano /etc/php/7.0/fpm/php.ini 去掉cgi.fix-pathinfo=1 的注释
# nano /etc/apache2/sites-available/000-default.conf将
添加多个端口用于二级域名
DocumentRoot /var/www/pan
# nano /etc/apache2/ports.conf修改成Listen 8080 多个端口里增加Listen 6060
以下参考https://www.cnblogs.com/yanghaiyan/p/7097393.html
及http://tieba.baidu.com/p/3729122779及https://blog.csdn.net/lijing198997/article/details/79409029
# nano /etc/nginx/sites-available/default
# Default server configuration
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name www.firebirds.cn;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
# Virtual Host configuration for example.com
server {
listen 80;
server_name firebirds.frp.app;
root /var/www/html;
location /{
index index.html index.htm index.php;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
error_page 404 /var/www/html/404.html;
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
放入探针测试一下,index.php放入/var/www
phpinfo();
?>
查看无线网卡是否支持
查看几块网卡及无线网卡名
ifconfig -a
PCI网卡
lspci
00:00.0 Network controller: Qualcomm Atheros AR928X Wireless Network Adapter (PCI-Express) (rev 01)
USB网卡
lsusb
Bus 001 Device 003: ID 0b95:772a ASIX Electronics Corp. AX88772A Fast Ethernet
查看网卡是否支持AP模式(网卡暂为wlan0)
root@debian:~# iwconfig wlan0 mode master
Error for wireless request "Set Mode" (8B06) :
SET failed on device wlan0 ; Invalid argument.
root@debian:/boot# iw list |grep AP
Device supports AP-side u-APSD.
* AP
* AP/VLAN
查看网卡驱动信息
root@debian:~# ethtool -i wlan0
driver: ath9k
root@debian:/boot# apt install hostapd dnsmasq
Failed to reload daemon: Refusing to reload, not enough space available on /run/
systemd. Currently, 10.6M are free, but a safety buffer of 16.0M is enforced.
df -h一下发现这个目录确实空间不多
tmpfs 12M 880K 11M 8% /run
到/etc/fstab增加一行就行了
vim /etc/fstab
tmpfs /run tmpfs nosuid,noexec,size=64M,nr_inodes=4096 0 0
配置hostapd
root@debian:~# nano /etc/hostapd/hostapd.conf
ssid=ARMBIAN
interface=wlan0
channel=5
#bridge=br0
driver=nl80211
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2
wmm_enabled=1
preamble=1
wpa=2
wpa_passphrase=12345678
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
auth_algs=1
max_num_sta=255
macaddr_acl=0
#accept_mac_file=/etc/hostapd/hostapd.accept
#deny_mac_file=/etc/hostapd/hostapd.deny
hw_mode=g
ieee80211n=1
# controlling enabled
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
root@debian:~# nano /etc/init.d/hostapd
DAEMON_CONF=/etc/hostapd/hostapd.conf
可以将配置全部放入/etc/dnsmasq.d目录,配置dnsmasq.conf或WiFiAP.conf
root@debian:~# nano /etc/dnsmasq.conf
root@debian:~# nano /etc/dnsmasq.d/WiFiAP.conf
interface=wlan0
dhcp-range=192.168.2.10,192.168.2.200,12h
dhcp-option=3,192.168.2.1
no-hosts
no-resolv
conf-file=/etc/dnsmasq.d/fq.conf
cache-size=10000
all-servers
server=127.0.0.1
server=218.30.118.6
server=8.8.4.4
server=119.29.29.29
server=4.2.2.2
server=114.114.114.114
server=1.2.4.8
server=223.5.5.5
server=114.114.114.119
注释掉这句dhcp-option=6,8.8.8.8
配置(防DNS污染)
参考http://www.right.com.cn/forum/forum.php?mod=viewthread&tid=217335
创建自定义域名
下载sy618扶墙规则
wget --no-check-certificate -q -O /tmp/sy618 https://raw.githubusercontent.com/sy618/hosts/master/dnsmasq/dnsfq
下载racaljk规则
wget --no-check-certificate -q -O /tmp/racaljk https://raw.githubusercontent.com/racaljk/hosts/master/dnsmasq.conf
对规则进行一些调整
# 删除dnsmasq缓存注释
root@debian:/tmp# sed -i '/#/d' /tmp/sy618
root@debian:/tmp# sed -i '/#/d' /tmp/racaljk
# 扶墙网站指定到#443端口访问
root@debian:/tmp# sed -i 's/$/ƻ/' /tmp/sy618
root@debian:/tmp# sed -i 's/$/ƻ/' /tmp/racaljk
# 将几个文件合并
cat /tmp/racaljk /tmp/sy618 > /tmp/fq
对fq进行此调整个,增加自定义规则,删除重复规则
sort /tmp/fq | uniq >> /etc/dnsmasq.d/fq.conf
echo "# Modified DNS end" >> /etc/dnsmasq.d/fq.conf
开启AP的准备工作
单链路路由配置
# nano /usr/bin/AccessPoint
#!/bin/sh
start() {
bash -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i wlp0s0 -o eth0 -s 192.168.10.0/24 -m state --state NEW -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
#nmcli nm wifi off
ifconfig wlp0s0 192.168.43.2 netmask 255.255.255.0 up
rfkill unblock all
sleep 6s
/etc/init.d/hostapd start
/etc/init.d/dnsmasq start
}
stop() {
/etc/init.d/hostapd stop
/etc/init.d/dnsmasq stop
bash -c "echo 0 > /proc/sys/net/ipv4/ip_forward"
ifconfig wlp0s0 down
}
case "$1" in
'start')
start
;;
'stop')
stop
;;
'restart')
stop
start
;;
*)
echo "usage $0 start|stop|restart"
Esac
多链路策略路由配置
# nano etc/iproute2/rt_tables
100 ChinaNet
102 ChinaCnc
103 ChinaEdu
# nano /usr/bin/AccessPoint
#!/bin/sh -xv
balance(){
#静态IP地址
ip addr flush dev eth0
ip addr add 192.168.10.5/24 dev eth0 scope global
ip link set dev eth0 up
ip addr flush dev wlan0
ip addr add 192.168.2.1/24 dev wlan0 scope global
ip link set dev wlan0 up
ip addr flush dev wlan1
ip addr add 192.168.1.5/24 dev wlan1 scope global
ip link set dev wlan1 up
ip addr flush dev wlan2
ip addr add 192.168.43.5/24 dev wlan2 scope global
ip link set dev wlan2 up
#网络参数
IF0=wlan0
P0_NET=192.168.0.0/16
P0=192.168.2.1
IP0=`ifconfig wlan0 | grep "inet " | awk '{print $2}'`
IF1=wlan1
P1_NET=192.168.1.0/24
P1=192.168.1.1
IP1=`ifconfig wlan1 | grep "inet " | awk '{print $2}'`
IF2=wlan2
P2_NET=192.168.43.0/24
P2=192.168.43.2
IP2=`ifconfig wlan2 | grep "inet " | awk '{print $2}'`
IF3=eth0
P3_NET=192.168.10.0/24
P3=192.168.10.1
IP3=`ifconfig eth0 | grep "inet " | awk '{print $2}'`
#三张路由表规则
if [ ! $IP1 ]; then
echo "$IF1无IP地址"
else
ip route flush table ChinaNet
ip route add default via $P1 dev $IF1 src $IP1 table ChinaNet
ip route add $P1_NET dev $IF1 table ChinaNet
ip route add $P0_NET dev $IF0 table ChinaNet
ip route add 127.0.0.0/8 dev lo table ChinaNet
ip rule add from $IP1 table ChinaNet
ip rule add to 111.6.100.0/24 table ChinaNet
ip rule add to 111.6.169.0/24 table ChinaNet
ip rule add to 111.13.100.0/24 table ChinaNet
ip rule add to 111.62.0.0/24 table ChinaNet
ip rule add to 118.84.0.0/24 table ChinaNet
ip rule add to 118.84.1.0/24 table ChinaNet
ip rule add to 118.84.2.0/24 table ChinaNet
ip rule add to 202.97.0.0/24 table ChinaNet
ip rule add to 202.97.16.0/24 table ChinaNet
ip rule add to 202.97.17.0/24 table ChinaNet
ip rule add to 202.97.18.0/24 table ChinaNet
ip rule add to 202.97.19.0/24 table ChinaNet
ip rule add to 202.97.20.0/24 table ChinaNet
ip rule add to 202.97.21.0/24 table ChinaNet
ip rule add to 202.97.22.0/24 table ChinaNet
ip rule add to 202.97.23.0/24 table ChinaNet
ip rule add to 202.97.24.0/24 table ChinaNet
ip rule add to 202.97.25.0/24 table ChinaNet
ip rule add to 202.97.26.0/24 table ChinaNet
ip rule add to 202.97.29.0/24 table ChinaNet
ip rule add to 202.97.33.0/24 table ChinaNet
ip rule add to 202.97.37.0/24 table ChinaNet
ip rule add to 202.97.38.0/24 table ChinaNet
ip rule add to 202.97.39.0/24 table ChinaNet
ip rule add to 202.97.40.0/24 table ChinaNet
ip rule add to 202.97.41.0/24 table ChinaNet
ip rule add to 202.97.42.0/24 table ChinaNet
ip rule add to 202.97.43.0/24 table ChinaNet
ip rule add to 202.97.44.0/24 table ChinaNet
ip rule add to 202.97.46.0/24 table ChinaNet
ip rule add to 202.97.49.0/24 table ChinaNet
ip rule add to 202.97.50.0/24 table ChinaNet
ip rule add to 202.97.51.0/24 table ChinaNet
ip rule add to 202.97.52.0/24 table ChinaNet
ip rule add to 202.97.53.0/24 table ChinaNet
ip rule add to 202.97.54.0/24 table ChinaNet
ip rule add to 202.97.56.0/24 table ChinaNet
ip rule add to 202.97.57.0/24 table ChinaNet
ip rule add to 202.97.58.7/24 table ChinaNet
ip rule add to 202.97.60.0/24 table ChinaNet
ip rule add to 202.97.65.0/24 table ChinaNet
ip rule add to 202.97.66.0/24 table ChinaNet
ip rule add to 202.97.67.0/24 table ChinaNet
ip rule add to 202.97.68.0/24 table ChinaNet
ip rule add to 202.97.69.0/24 table ChinaNet
ip rule add to 202.97.70.0/24 table ChinaNet
ip rule add to 202.97.71.0/24 table ChinaNet
ip rule add to 219.148.209.0/24 table ChinaNet
fi
if [ ! $IP2 ]; then
echo "$IF2无IP地址"
else
ip route flush table ChinaCnc
ip route add default via $P2 dev $IF2 src $IP2 table ChinaCnc
ip route add $P2_NET dev $IF2 table ChinaCnc
ip route add $P0_NET dev $IF0 table ChinaCnc
ip route add 127.0.0.0/8 dev lo table ChinaCnc
ip rule add from $IP2 table ChinaCnc
ip rule add to 61.179.255.0/24 table ChinaCnc
ip rule add to 218.61.254.0/24 table ChinaCnc
ip rule add to 219.158.0.0/24 table ChinaCnc
ip rule add to 219.158.32.0/24 table ChinaCnc
ip rule add to 219.158.33.0/24 table ChinaCnc
fi
if [ ! $IP3 ]; then
echo "$IF3无IP地址"
else
ip route flush table ChinaEdu
ip route add default via $P3 dev $IF3 src $IP3 table ChinaEdu
ip route add $P3_NET dev $IF3 table ChinaEdu
ip route add $P0_NET dev $IF0 table ChinaEdu
ip route add 127.0.0.0/8 dev lo table ChinaEdu
ip rule add from $IP3 table ChinaEdu
ip rule add to 203.207.64.0/24 table ChinaEdu
ip rule add to 203.207.68.0/24 table ChinaEdu
ip rule add to 180.97.33.0/24 table ChinaEdu
fi
#负载均衡(main表路由规则)
ip route add $P0_NET dev $IF0 src $IP0
ip route add 127.0.0.0/8 dev lo
if [ ! $IP1 ] && [ ! $IP2 ]; then
ip route replace default scope global nexthop via $P3 dev $IF3
elif [ ! $IP1 ] && [ ! $IP3 ];then
ip route replace default scope global nexthop via $P2 dev $IF2
elif [ ! $IP2 ] && [ ! $IP3 ];then
ip route replace default scope global nexthop via $P1 dev $IF1
elif [ ! $IP1 ]; then
ip route replace default scope global nexthop via $P2 dev $IF2 weight 1 nexthop via $P3 dev $IF3 weight 1
elif [ ! $IP2 ]; then
ip route replace default scope global nexthop via $P1 dev $IF1 weight 1 nexthop via $P3 dev $IF3 weight 1
elif [ ! $IP3 ]; then
ip route replace default scope global nexthop via $P1 dev $IF1 weight 1 nexthop via $P2 dev $IF2 weight 1
else
ip route replace default scope global nexthop via $P1 dev $IF1 weight 1 nexthop via $P2 dev $IF2 weight 1 nexthop via $P3 dev $IF3 weight 1
fi
}
start() {
bash -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
balance
#路由地址转换
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
iptables -t nat -A POSTROUTING -o wlan2 -j MASQUERADE
iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sleep 6s
/etc/init.d/hostapd start
/etc/init.d/dnsmasq start
}
stop() {
/etc/init.d/hostapd stop
/etc/init.d/dnsmasq stop
bash -c "echo 0 > /proc/sys/net/ipv4/ip_forward"
ifconfig wlan0 down
}
case "$1" in
'start')
start
;;
'stop')
stop
;;
'restart')
stop
start
;;
*)
echo "usage $0 start|stop|restart"
esac
如果hostapd启动不了,测试hostapd -B /etc/hostapd/hostapd.conf
出现nl80211: deinit ifname=wlp0s0 disabled的情况把
nano /etc/network/interfaces内的wlp0s0配置注释掉就OK了
配置PXE(安装TFTP服务)
apt install tftpd-hpa
nano /etc/default/tftpd-hpa
TFTP_OPTIONS="--secure --create"
安装这一版本s-rm
python /usr/local/s-rm/s/local.py -c /usr/local/s-rm/s/sr.json
配置sr.json
{
"method": "aes-256-cfb",
"obfs": "tls1.2_ticket_auth",
"obfsparam": "",
"password": "XXXXXX",
"protocol": "auth_sha1_v2",
"remarks": "美国线路1",
"server": "us01.fk360.bid",
"local_address": "192.168.43.2",
"local_port": 1080,
"server_port": 28896
}
主要参考https://www.jianshu.com/p/a513590de6b8
http://wiki.ubuntu.org.cn/Crosstool-ng制作交叉编译工具链
/opt/$ wget http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.23.0.tar.bz2
/opt/$ tar jxvf crosstool-ng-1.23.0.tar.bz2
/opt/$ cd crosstool-ng-1.23.0/
安装编译依赖包
sudo apt-get install sed bash dpkg-dev bison flex patch texinfo automake m4 libtool cvs tar gzip bzip2 lzma libncurses5-dev bison flex texinfo automake libtool patch cvs cvsd gperf help2man gawk
./configure --prefix=/usr/local/crosstool-ng
make
sudo make install
配置环境变量
echo "PATH=$PATH:/usr/local/crosstool-ng/bin" >> ~/.bashrc
source ~/.bashrc
配置交叉编译工具链(用户主目录内)
~$ mkdir crosstool-build src x-tools
~/crosstool-build/$ cp /opt/crosstool-ng/lib/crosstool-ng-1.23.0/samples/arm-unknown-linux-gnueabi/crosstool.config .config
~/crosstool-build/$ct-ng menuconfig
设定源码包路径和交叉编译工具链的安装路径
Paths and misc options--->
(${HOME}/arm-linux-tools/src) Local tarballs directory
(${HOME}/crosstool-ng/x-tools) Prefix directory
修改交叉编译工具针对的架构(PLX NAS-7820)
Target options--->
Target architecture(arm)
Endianness(Little endian)
Bitness(32-bit)
(armv6k) Architecture level
(mpcore) Emit assembly for CPU
Floating point(hardware FPU)
修改成你自己的个性化名称
Toolchain options --->
(pogoplug) Tuple's vendor string
执行ct-ng build编译
编译过程中会出现有些源码包下载不了的情况通过其他途径下载后放入~/src目录内(可以是不同版本但名称改成一致方可)还会出现C编译器源码编译不过的情况根据提示修改相应代码如C++不认识’’要改成””方可
编译完成后工具链在用户主目录x-tool内
echo "PATH=$PATH:$HOME/x-tools/arm-pogoplug-linux-gnueabi/bin" >> ~/.bashrc
source ~/.bashrc
标准化交叉编译链(即改名)
/x-tools/arm-pogoplug-linux-gnueabi/bin/$ sudo nano link.sh
内容为
PREFIX=arm-pogoplug-linux-gnueabi-
AFTFIX=arm-linux-
ln -s ${PREFIX}gcc ${AFTFIX}gcc
ln -s ${PREFIX}addr2line ${AFTFIX}addr2line
ln -s ${PREFIX}ar ${AFTFIX}ar
ln -s ${PREFIX}as ${AFTFIX}as
ln -s ${PREFIX}c++ ${AFTFIX}c++
ln -s ${PREFIX}c++filt ${AFTFIX}c++filt
ln -s ${PREFIX}cpp ${AFTFIX}cpp
ln -s ${PREFIX}g++ ${AFTFIX}g++
ln -s ${PREFIX}gcov ${AFTFIX}gcov
ln -s ${PREFIX}gdb ${AFTFIX}gdb
ln -s ${PREFIX}gprof ${AFTFIX}gprof
ln -s ${PREFIX}ld ${AFTFIX}ld
ln -s ${PREFIX}ldd ${AFTFIX}ldd
ln -s ${PREFIX}nm ${AFTFIX}nm
ln -s ${PREFIX}objcopy ${AFTFIX}objcopy
ln -s ${PREFIX}objdump ${AFTFIX}objdump
ln -s ${PREFIX}populate ${AFTFIX}populate
ln -s ${PREFIX}ranlib ${AFTFIX}ranlib
ln -s ${PREFIX}readelf ${AFTFIX}readelf
ln -s ${PREFIX}size ${AFTFIX}size
ln -s ${PREFIX}strings ${AFTFIX}strings
ln -s ${PREFIX}strip ${AFTFIX}strip
ln -s ${PREFIX}cc ${AFTFIX}cc
ln -s ${PREFIX}dwp ${AFTFIX}dwp
ln -s ${PREFIX}elfedit ${AFTFIX}elfedit
ln -s ${PREFIX}gcc-6.3.0 ${AFTFIX}gcc-6.3.0
ln -s ${PREFIX}gcc-ar ${AFTFIX}gcc-ar
ln -s ${PREFIX}gcc-nm ${AFTFIX}gcc-nm
ln -s ${PREFIX}gcc-ranlib ${AFTFIX}gcc-ranlib
ln -s ${PREFIX}gcov-tool ${AFTFIX}gcov-tool
ln -s ${PREFIX}ld.bfd ${AFTFIX}ld.bfd
ln -s ${PREFIX}ld.gold ${AFTFIX}ld.gold
执行sudo sh link.sh
编译时如果出现arm-linux-gcc: Command not found 问题
先打开一个超级用户权限的shell:
sudo –s
在当前shell下,设置arm环境变量:
export PATH=$PATH:$HOME/x-tools/arm-pogoplug-linux-gnueabi/bin
再进入到kernel目录,make zImage,就可以找到arm-linux-gcc了
11.Debian回滚方法
1.查看安装历史/var/log/apt/history.log
Start-Date: 2018-11-23 16:24:53
Commandline: apt-get install ffmpeg
Install: libswscale2:amd64 (0.8.17-0ubuntu0.12.04.2, automatic), libavutil51:amd64 (0.8.17-0ubuntu0.12.04.2, automatic), libavfilter2:amd64 (0.8.17-0$
End-Date: 2018-11-23 16:25:22
Start-Date: 2018-11-23 17:27:37
Commandline: apt-get install -y --force-yes gcc-arm-linux-gnueabi g++-arm-linux-gnueabi
Install: libgcc1-armel-cross:amd64 (4.6.3-1ubuntu5cross1.82, automatic), libc6-armel-cross:amd64 (2.15-0ubuntu9cross1.82, automatic), gcc-4.6-arm-lin$
End-Date: 2018-11-23 17:27:55
2.清洗并导出安装软件
firebirds@kickseed:~$ grep -A 2 'Start-Date: 2018-11-23 16:51:09' /var/log/apt/history.log |tail -1 > /tmp/packages.txt
firebirds@kickseed:~$ grep -A 2 'Start-Date: 2018-11-23 17:27:37' /var/log/apt/history.log |tail -1 >> /tmp/packages.txt
firebirds@kickseed:~$ sed -i 's/Install://' /tmp/packages.txt firebirds@kickseed:~$ tr ',' '\n' < /tmp/packages.txt |sed '/automatic)/d'|awk '{print $1}' >/tmp/final.packages.txt
firebirds@kickseed:~$ wc -l /tmp/final.packages.txt
最后一条是查看有多少个软件
3.新建个批处理文件huigun.sh
p="$(
apt-get remove $p --purge
apt-get clean
apt-get autoremove
df -H
12.其他软件安装
查看磁盘空间使用情况
# lsblk
# df -h
如果空间不够使用图形分区工具Gparted调整
安装mate桌面
# apt-get install mate-desktop-environment lightdm
安装中文输入法
sudo apt-get install ttf-wqy-microhei fcitx-table-wbpy fcitx-frontend-gtk2 fcitx-fronted-gtk3
进入控制中心在fcitx配置界面Input Method时打开应用便能添加需要的输入法
安装Windows远程桌面
sudo apt-get install xrdp
安装VNC远程控制并配置
先安装tightvncserver
sudo apt-get install tightvncserver
再设置密码
vncpasswd
设置开机自启动
sudo nano /etc/init.d/tightvncserver
#!/bin/sh
### BEGIN INIT INFO
# Provides: tightvncserver
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop tightvncserver
### END INIT INFO
# More details see:
# http://www.penguintutor.com/linux/tightvnc
### Customize this entry
# Set the USER variable to the name of the user to start tightvncserver under
#根据实际情况修改用户名
export USER='pi'
### End customization required
eval cd ~$USER
case "$1" in
start)
# 启动命令行。此处自定义分辨率、控制台号码或其它参数。
su $USER -c '/usr/bin/tightvncserver -depth 16 -geometry 960x600 :1'
echo "Starting TightVNC server for $USER "
;;
stop)
# 终止命令行。此处控制台号码与启动一致。
su $USER -c '/usr/bin/tightvncserver -kill :1'
echo "Tightvncserver stopped"
;;
*)
echo "Usage: /etc/init.d/tightvncserver {start|stop}"
exit 1
;;
esac
exit 0
设置文件权限,更新开机自启动列表
sudo chmod 777 /etc/init.d/tightvncserver
sudo update-rc.d tightvncserver defaults
在Windows或Android VNC客户端连接:192.168.1.102:5901即可
若出现联接不了查/root/.vnc下的log文件一般是字体未安装
运行apt-cache search libXfont
运行apt-get install libxfont-dev libxfont1 libxfont1-dbg
要是还不行
运行apt-get install xfonts-base
Aria2+AriaNg+h5ai实现离线下载与在线播放
安装Aria2
#apt-get install aria2
用户目录下创建配置文件夹
#mkdir .aria2
进入.aria2目录创建配置文件
wget --no-check-certificate -N "https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/other/Aria2/aria2.conf"
根据实际情况修改下载目录等
创建服务器节点文件
wget --no-check-certificate -N "https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/other/Aria2/dht.dat"
创建一个aria2.session文件
echo '' > /root/aria2.session
创建服务文件
如果是CentOS系统wget --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/service/aria2_centos -O /etc/init.d/aria2
如果是Debian系统wget --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/service/aria2_debian -O /etc/init.d/aria2
设置文件权限,更新开机自启动列表
chmod +x /etc/init.d/aria2
update-rc.d -f aria2 defaults
如果有防火墙放行aria2_RPC_port默认是6800
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport ${aria2_RPC_port} -j ACCEPT
iptables -I INPUT -m state --state NEW -m udp -p udp --dport ${aria2_RPC_port} -j ACCEPT
使用AriaNg管理下载
直接使用AllInOne发行版
https://github.com/mayswind/AriaNg/releases/download/1.0.0/AriaNg-1.0.0-AllInOne.zip
解压后将index.php直接丢进lnmp的目录中即可(lnmp可以使用组合包参考https://github.com/licess/lnmp/tree/v1.5和https://lnmp.org/faq/download-url.html)
BT种子下不动请加BT Tracker服务器地址参考https://github.com/ngosang/trackerslist
h5ai在线文件和视频播放
从h5ai官网下载最新安装包:https://larsjung.de/h5ai/
解压后文件夹丢进lnmp的目录中
#设置首页
nano /usr/local/nginx/conf/vhost/域名.conf
index.html index.htm index.php /_h5ai/public/index.php;
#删除不必要的函数
nano /usr/local/php/etc/php.ini
将scandir exec passthru三个函数删除
重启Nginx和PHP
service nginx reload
service php-fpm restart
安装ffmpeg(可选)
#添加四个软件源
deb http://www.deb-multimedia.org jessie main non-free
deb ftp://ftp.deb-multimedia.org jessie main non-free
deb http://www.deb-multimedia.org stable main non-free
deb ftp://ftp.deb-multimedia.org stable main non-free
#更新系统
apt-get -y update
#安装ffmpeg
apt-get install ffmpeg
把h5ai程序_h5ai中private和public两个文件夹中的cache目录权限设置为777
建立软链接到需要分享的目录
h5ai的高级扩展可以通过修改/_h5ai/private/conf/options.json配置文件开启
#系统备份安装rsync
备份的命令sudo rsync -Pa / /media/backup_20141216 --exclude=/media/* --exclude=/sys/* --exclude=/proc/* --exclude=/mnt/* --exclude=/tmp/*
还原的命令sudo rsync -Pa /media/backup_20141216 /