我好像解决部分猫盘刷群晖后掉IP的问题了

我好像解决部分猫盘刷群晖后掉IP的问题了
 
我好像解决部分猫盘刷群晖后掉IP的问题了
 
先说我的情况,xianyu上的,到手发现刷群晖后第一次没挂硬盘时可见ip,关机,上硬盘,再开机就一直见不到ip了,没敢一直重启,心疼硬盘。
然后刷个X3P用了一段时间,还是想用群晖。上了块固态,试了多次后,应该解决掉IP的问题了,现在挂的是500G普通盘,一直正常。
 
跳过刷机说重点,每次重刷完群晖都是可以连上的,但重启后就不行了,所以应该不是所谓的虚焊问题,应该是某个设置没有达到,网卡没有工作。
 
然后发现的情况是,如果进到env环境(我也不知道叫什么,反正就是在xshell下一直按回车的环境),网卡是工作的,只是再进到群晖启动时没有工作。
 
先看了下有什么可用的命令:
 
Marvell>> help
?       - alias for 'help'
base    - print or set address offset
bdinfo  - print Board Info structure
blkcache- block cache diagnostics and control
boot    - boot default, i.e., run 'bootcmd'
bootd   - boot default, i.e., run 'bootcmd'
bootefi - Boots an EFI payload from memory
bootelf - Boot from an ELF image in memory
booti   - boot arm64 Linux Image image from memory
bootm   - boot application image from memory
============================================================
bootp   - boot image via network using BOOTP/TFTP protocol
============================================================
bootvx  - Boot vxWorks from an ELF image
bubt    - Burn a u-boot image to flash
cmp     - memory compare
coninfo - print console devices and information
cp      - memory copy
crc32   - checksum calculation
dcache  - enable or disable data cache
-------------------------------------------------------------
dhcp    - boot image via network using DHCP/TFTP protocol
-------------------------------------------------------------
dm      - Driver model low level access
echo    - echo args to console
editenv - edit environment variable
env     - environment handling commands
exit    - exit script
ext2load- load binary file from a Ext2 filesystem
ext2ls  - list files in a directory (default /)
ext4load- load binary file from a Ext4 filesystem
ext4ls  - list files in a directory (default /)
ext4size- determine a file's size
ext4write- create a file in the root directory
false   - do nothing, unsuccessfully
fatinfo - print information about filesystem
fatload - load binary file from a dos filesystem
fatls   - list files in a directory (default /)
fatsize - determine a file's size
fdt     - flattened device tree utility commands
fstype  - Look up a filesystem type
go      - start application at address 'addr'
gpio    - query and control gpio pins
help    - print command description/usage
i2c     - I2C sub-system
icache  - enable or disable instruction cache
iminfo  - print header information for application image
ir      - ir    - Reading and changing internal register values.
 
 
itest   - return true/false on integer compare
load    - load binary file from a filesystem
loadb   - load binary file over serial line (kermit mode)
loads   - load S-Record file over serial line
loadx   - load binary file over serial line (xmodem mode)
loady   - load binary file over serial line (ymodem mode)
loop    - infinite loop on address range
ls      - list files in a directory (default /)
lzmadec - lzma uncompress a memory region
md      - memory display
mdio    - MDIO utility commands
mii     - MII utility commands
mm      - memory modify (auto-incrementing address)
mmc     - MMC sub system
mmcinfo - display MMC info
mw      - memory write (fill)
nfs     - boot image via network using NFS protocol
nm      - memory modify (constant address)
part    - disk partition related commands
ping    - send ICMP ECHO_REQUEST to network host
printenv- print environment variables
pxe     - commands to get and boot from pxe files
regulator- uclass operations
reset   - Perform RESET of the CPU
run     - run commands in an environment variable
save    - save file to a filesystem
saveenv - save environment variables to persistent storage
scsi    - SCSI sub-system
scsiboot- boot from SCSI device
setenv  - set environment variables
sf      - SPI flash sub-system
showvar - print local hushshell variables
size    - determine a file's size
sleep   - delay execution for some time
source  - run script from memory
sspi    - SPI utility command
sysboot - command to get and boot from syslinux files
test    - minimal test like /bin/sh
tftpboot- boot image via network using TFTP protocol
time    - run commands and summarize execution time
true    - do nothing, successfully
usb     - USB sub-system
usbboot - boot from USB device
version - print monitor, compiler and linker version
 
发现了gpio
 
arvell>> gpio
gpio - query and control gpio pins
 
 
Usage:
gpio
    - input/set/clear/toggle the specified pin
gpio status [-a] [ | ]  - show [all/claimed] GPIOs
 
 
Marvell>> gpio status
Bank GPIO2:
GPIO20: output: 1 [x] sata_pwr
GPIO221: output: 1 [x] phy_reset
 
可见的io脚
 
Marvell>> gpio status -a
Bank GPIO1:
GPIO10: input: 0 [ ]
GPIO11: input: 0 [ ]
GPIO12: input: 1 [ ]
GPIO13: input: 1 [ ]
GPIO14: input: 1 [ ]
GPIO15: input: 1 [ ]
GPIO16: input: 0 [ ]
GPIO17: input: 0 [ ]
GPIO18: input: 0 [ ]
GPIO19: input: 0 [ ]
GPIO110: input: 1 [ ]
GPIO111: input: 0 [ ]
GPIO112: input: 0 [ ]
GPIO113: input: 0 [ ]
GPIO114: input: 0 [ ]
GPIO115: input: 1 [ ]
GPIO116: input: 1 [ ]
GPIO117: input: 1 [ ]
GPIO118: input: 1 [ ]
GPIO119: input: 1 [ ]
GPIO120: input: 0 [ ]
GPIO121: input: 0 [ ]
GPIO122: input: 0 [ ]
GPIO123: input: 0 [ ]
GPIO124: input: 0 [ ]
GPIO125: input: 0 [ ]
GPIO126: input: 0 [ ]
GPIO127: input: 0 [ ]
GPIO128: input: 0 [ ]
GPIO129: input: 0 [ ]
GPIO130: input: 0 [ ]
GPIO131: input: 0 [ ]
GPIO132: input: 0 [ ]
GPIO133: input: 0 [ ]
GPIO134: input: 0 [ ]
GPIO135: input: 0 [ ]
 
 
Bank GPIO2:
GPIO20: output: 1 [x] sata_pwr
GPIO21: input: 0 [ ]
GPIO22: input: 1 [ ]
GPIO23: input: 1 [ ]
GPIO24: input: 1 [ ]
GPIO25: input: 1 [ ]
GPIO26: input: 0 [ ]
GPIO27: input: 1 [ ]
GPIO28: input: 1 [ ]
GPIO29: input: 1 [ ]
GPIO210: input: 1 [ ]
GPIO211: input: 1 [ ]
GPIO212: input: 0 [ ]
GPIO213: input: 0 [ ]
GPIO214: input: 1 [ ]
GPIO215: input: 1 [ ]
GPIO216: input: 1 [ ]
GPIO217: input: 1 [ ]
GPIO218: input: 1 [ ]
GPIO219: input: 1 [ ]
GPIO220: input: 0 [ ]
GPIO221: output: 1 [x] phy_reset
GPIO222: input: 1 [ ]
GPIO223: input: 1 [ ]
GPIO224: input: 1 [ ]
GPIO225: input: 1 [ ]
GPIO226: input: 1 [ ]
GPIO227: input: 0 [ ]
GPIO228: input: 0 [ ]
GPIO229: input: 0 [ ]
 
别的看不懂,只看到一个是硬盘的供电,一个是phy_reset,不知道干什么的。
 
Marvell>> gpio
gpio - query and control gpio pins
 
 
Usage:
gpio
    - input/set/clear/toggle the specified pin
gpio status [-a] [ | ]  - show [all/claimed] GPIOs
 
set是置1,clear是置0,toggle八成就是翻转(初中级英语,没办法,全靠猜)
 
然后看到env有地方是参数设置,类似dos的环境变量吧
 
Marvell>> env print
arch=arm
baudrate=115200
board=mvebu_armada-37xx
board_name=mvebu_armada-37xx
boot_mmc0p1= setenv bootdev mmc 0:1; ext4load ${bootdev} ${scriptaddr} /boot/boot.scr && source ${scriptaddr};
boot_mmc0p2= setenv bootdev mmc 0:2; ext4load ${bootdev} ${scriptaddr} /boot/boot.scr && source ${scriptaddr};
boot_sata=scsi scan; setenv bootdev scsi 0:1; ext4load ${bootdev} ${scriptaddr} /boot/boot.scr && source ${scriptaddr};
boot_targets=usb mmc0p1 mmc0p2 sata
boot_usb=usb start; setenv bootdev usb 0:1; ext4load ${bootdev} ${scriptaddr} /boot/boot.scr && source ${scriptaddr};
bootcmd=gpio input GPIO23; if test $? = 0 ;then echo "Enter button mode";run bootcmd_button;else echo "Enter nomal Mode";run bootcmd_normal;fi
bootcmd_button=for target in ${boot_targets};do run boot_${target}; done;
bootcmd_normal=run bootcmd_syno;
bootcmd_syno=run syno_bootargs;sf probe;sf read $loadaddr 0x0D5000 0x306000;echo "syno: start decompressing kernel... ";lzmadec $loadaddr $kernel_addr;sf read $initrd_addr 0x3DB000 0x410000;sf read $fdt_addr 0xd2000 0x3000;booti $kernel_addr $initrd_addr $fdt_addr;
bootdelay=1
bootdev=scsi 0:1
console=console=ttyMV0,115200 earlycon=ar3700_uart,0xd0012000
cpu=armv8
ethact=neta@30000
ethaddr=00:11:32:11:22:00
ethprime=eth0
fdt_addr=0x6000000
fdt_high=0xffffffffffffffff
fdtcontroladdr=1f6437d0
gatewayip=192.168.1.254
hostname=catdrive
image_name=/vmlinuz
initrd_addr=0x1100000
initrd_size=0x2000000
ipaddr=192.168.1.119
kernel_addr=0x7000000
loadaddr=0x8000000
netdev=eth0
netmask=255.255.255.0
rootpath=/srv/nfs/
scriptaddr=0x6d00000
serverip=192.168.1.254
soc=mvebu
stderr=serial@12000
stdin=serial@12000
stdout=serial@12000
syno_bootargs=setenv bootargs console=ttyS0,115200 ip=off root=/dev/sda1 rw swiotlb=2048 syno_hw_version=DS119j syno_fw_version=M.246 syno_hdd_powerup_seq=1 ihd_num=1 netif_num=1 syno_hdd_enable=40 syno_hdd_act_led=10 flash_size=8 vendor=Marvell
vendor=Marvell
 
 
Environment size: 2001/8188 bytes
Marvell>>
 
看到有一个GPIO23,试了下,原来是reset按钮检测,没什么用。但它有两个启动项,主要是bootcmd_normal,而这又指向bootcmd_syno.
bootcmd_syno=run syno_bootargs;sf probe;sf read $loadaddr 0x0D5000 0x306000;echo "syno: start decompressing kernel... ";lzmadec $loadaddr $kernel_addr;sf read $initrd_addr 0x3DB000 0x410000;sf read $fdt_addr 0xd2000 0x3000;booti $kernel_addr $initrd_addr $fdt_addr;
 
这里好像是群晖引导,一条一条的命令,我又不会改linux的启动呀内核呀,只能在这儿动手了
bootdelay=10 ,启动等待时间,1秒,太少,我都来不及按,改成10秒
 
bootcmd_syno=gpio clear GPIO221;sleep 10;gpio clear GPIO20;sleep 10;gpio set GPIO221;sleep 10;gpio set GPIO20;sleep 10;run syno_bootargs;sf probe;sf read $loadaddr 0x0D5000 0x306000;echo "syno: start decompressing kernel... ";lzmadec $loadaddr $kernel_addr;sf read $initrd_addr 0x3DB000 0x410000;sf read $fdt_addr 0xd2000 0x3000;booti $kernel_addr $initrd_addr $fdt_addr;
 
注意我划掉的那部分,是先给硬盘断电,一会儿再通电,在固态硬盘可用,可能因为固态硬盘启动电流小,冲击小,当用普通盘时,有一定几率会死机,所以用普通盘时,我去掉了。
思路是:
启动前先把phy那个=0,等10秒,关硬盘,等10秒,phy那个置1,开硬盘。之后正常启动。
 
这样有时能得到IP,但还是会有一定几率不行,所以又加上了网上流行的ping 60秒不通时重启
 
控制面板,任务计划-新增-触发的任务-用户定义脚本,开机启动,开机60秒得不到ip 重启
#!/bin/bash
dt=`date '+%d/%m/%Y %H:%M:%S'`
echo "$dt"
sleep 60
num=`ping -c20 114.114.114.114 | tail -2 | head -1 | cut -f 3 -d"," | cut -f 1 -d"%" | cut -f 2 -d" "`
echo $num
echo $?
if [ $? -eq 0 -a $num -eq 0 ]; then
    echo "$dt ok" >> /result.txt
else
    echo "$dt noip loss $num reboot" >> /result.txt
    reboot
fi
 
第五行,ping后边的IP自己改,我用了一个外网的IP。
 
总是思路就是,第一次刷完群晖会有ip,挂着硬盘,装系统,设置60秒脚本,重启,如果找不到IP,改bootcmd_syno,再重启等着进系统。
 
我反正试了几天,刚上电,等一会儿根本没有IP,60秒后,会重启,这次绝对有IP。但总要用ttl+shell盯着测试太麻烦,所以又加了一个正常启动后闪led灯的脚本,从网上抄的,忘记上谁发的了,侵权见谅。
 
还是上边60秒的地方,再加一条
 
 
2cset -y -f 0 0x45 0x00 0x55
i2cset -y -f 0 0x45 0x01 0x01
i2cset -y -f 0 0x45 0x30 0x07
i2cset -y -f 0 0x45 0x31 0x72
i2cset -y -f 0 0x45 0x32 0x72
i2cset -y -f 0 0x45 0x33 0x72
#调节三个灯灯每周期上升沿和最高亮度时间
#想要白色的话,把三个灯时间改为一样的就可以了,比如全部设为0x44
i2cset -y -f 0 0x45 0x37 0x44
i2cset -y -f 0 0x45 0x3a 0x55
i2cset -y -f 0 0x45 0x3d 0x66
#调节三个灯每周期下降沿时间和关机时间
i2cset -y -f 0 0x45 0x38 0x44
i2cset -y -f 0 0x45 0x3b 0x55
i2cset -y -f 0 0x45 0x3e 0x66
i2cset -y -f 0 0x45 0x39 0x40
i2cset -y -f 0 0x45 0x3c 0x40
i2cset -y -f 0 0x45 0x3f 0x40
# 0-255,更亮
i2cset -y -f 0 0x45 0x34 128
i2cset -y -f 0 0x45 0x35 128
i2cset -y -f 0 0x45 0x36 128
 
然后在这条设置里有一个“先行任务”,设置成上边的60秒,也就是60秒那条执行完才执行这条。而60秒那条,没有ip就会重启,有ip就完成了,就会执行亮灯
 
 
我知道很多大神会做内核解决各种问题,我也知道看起来很小的问题,工作量是非常大的,可能要几个月才能解决,所以大神做的东西是不可能轻易免费发出来的,人家也要吃饭,不可能靠爱发电(我也在公司做简单的技术,知道技术无价的道理)。我从99年学电脑开始,绝大部分的东西都是从网上找来学的,所以非常感谢所有把知识发到网上共享的大神们。
 
希望大家有条件能测试一下这个方法,如果可行,请发出去让更多的人看到,如果有改进的方法,也请共享出来,因为这个方法换盘好像不方便。
 

你可能感兴趣的:(群晖)