Rock64: A DEBIAN-BASED ROUTER

image

image

image

Advertisements

Rock64: Install J5 Create gbps USB 3.0 network adapter

Rock64 has a gbps network and USB 3.0 port. I want to make a backup router, so I have to add a gbps network adapter.

I have a J5 Create gbps USB 3.0 network adapter purcashed at Courts a few years ago. Dietpi(debian) can detect the device, but does’t  have its driver.

I downloaded its driver from http://www.asix.com.tw/products.php?op=pItemdetail&PItemID=131;71;112 , locate to Linux kernel 4.x/3.x/2.6.x Driver .

The problem is the rock64 image doesn’t have require header files.

root@DietPi:~/AX88179_178A_LINUX_DRIVER_v1.19.0_SOURCE# make      
make -C /lib/modules/4.4.77-rockchip-ayufan-136/build SUBDIRS=/root/AX88179_178A_LINUX_DRIVER_v1.19.0_SOURCE modules
make[1]: *** /lib/modules/4.4.77-rockchip-ayufan-136/build: No such file or directory.  Stop.
Makefile:30: recipe for target ‘default’ failed
make: *** [default] Error 2

 

 

try to install its linux header files, apt install linux-headers

apt remove linux-headers-4.4.77-rockchip-ayufan-136

apt install linux-headers-4.4.77-rockchip-ayufan-136

After installed python, can build without error.

root@DietPi:~/AX88179_178A_LINUX_DRIVER_v1.19.0_SOURCE# make
make -C /lib/modules/4.4.77-rockchip-ayufan-136/build SUBDIRS=/root/AX88179_178A_LINUX_DRIVER_v1.19.0_SOURCE modules
make[1]: Entering directory ‘/usr/src/linux-headers-4.4.77-rockchip-ayufan-136’
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /root/AX88179_178A_LINUX_DRIVER_v1.19.0_SOURCE/ax88179_178a.mod.o
  LD [M]  /root/AX88179_178A_LINUX_DRIVER_v1.19.0_SOURCE/ax88179_178a.ko
make[1]: Leaving directory ‘/usr/src/linux-headers-4.4.77-rockchip-ayufan-136’
root@DietPi:~/AX88179_178A_LINUX_DRIVER_v1.19.0_SOURCE# ls
ax88179_178a.c  ax88179_178a.h  ax88179_178a.ko  ax88179_178a.mod.c  ax88179_178a.mod.o  ax88179_178a.o  Makefile  modules.order  Module.symvers  readme
root@DietPi:~/AX88179_178A_LINUX_DRIVER_v1.19.0_SOURCE#

 

Yes! time to install.

root@DietPi:~/AX88179_178A_LINUX_DRIVER_v1.19.0_SOURCE# make install
su -c “cp -v ax88179_178a.ko /lib/modules/4.4.77-rockchip-ayufan-136/kernel/drivers/net/usb && /sbin/depmod -a”
‘ax88179_178a.ko’ -> ‘/lib/modules/4.4.77-rockchip-ayufan-136/kernel/drivers/net/usb/ax88179_178a.ko’
root@DietPi:~/AX88179_178A_LINUX_DRIVER_v1.19.0_SOURCE# modprobe ax88179_178a

run dmesg to check status

[    5.109774] ASIX USB Ethernet Adapter:v1.19.0                http://www.asix.com.tw
[    5.114141] ax88179_178a 5-1:1.0 (unnamed net_device) (uninitialized): mtu 1500
[    5.124546] ax88179_178a 5-1:1.0 eth1: register ‘ax88179_178a’ at usb-xhci-hcd.8.auto-1, ASIX AX88179 USB 3.0 Gigabit Ethernet, 00:05:1b:a3:63:33
[    5.133166] usbcore: registered new interface driver ax88179_178a

 

So it has been working, modify /etc/modules to make it load automaticly

add ax88179_178aax88179_178a

root@DietPi:~# cat /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with “#” are ignored.

ax88179_178a
8021q

 

modify /etc/network/interfaces, add

allow-hotplug eth1
iface eth1 inet dhcp

 

finally, try DHCP.

root@DietPi:/etc/network# ifup eth1
Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth1/00:05:1b:a3:63:33
Sending on   LPF/eth1/00:05:1b:a3:63:33
Sending on   Socket/fallback
DHCPDISCOVER on eth1 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on eth1 to 255.255.255.255 port 67 interval 4
DHCPREQUEST of 192.168.249.223 on eth1 to 255.255.255.255 port 67
DHCPOFFER of 192.168.249.223 from 192.168.249.254
DHCPACK of 192.168.249.223 from 192.168.249.254
bound to 192.168.249.223 — renewal in 41754 seconds.
root@DietPi:/etc/network# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.249.239  netmask 255.255.255.0  broadcast 192.168.249.255
        inet6 fe80::3c94:9eff:fecf:35f4  prefixlen 64  scopeid 0x20<link>
        ether 3e:94:9e:cf:35:f4  txqueuelen 1000  (Ethernet)
        RX packets 2140  bytes 171268 (167.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 909  bytes 587299 (573.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 39 

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.249.223  netmask 255.255.255.0  broadcast 192.168.249.255
        inet6 fe80::205:1bff:fea3:6333  prefixlen 64  scopeid 0x20<link>
        ether 00:05:1b:a3:63:33  txqueuelen 1000  (Ethernet)
        RX packets 45  bytes 2654 (2.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 9  bytes 1334 (1.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 96  bytes 7664 (7.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 96  bytes 7664 (7.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

Now it has been fully working.

write image to nanopc t3 emmc

root@DietPi:~# fdisk -l
Disk /dev/mmcblk0: 14.9 GiB, 15931539456 bytes, 31116288 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x43492788

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 2048 133119 131072 64M 83 Linux
/dev/mmcblk0p2 133120 31116287 30983168 14.8G 83 Linux

Disk /dev/mmcblk1: 7.3 GiB, 7818182656 bytes, 15269888 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x1bf0d6e1

Device Boot Start End Sectors Size Id Type
/dev/mmcblk1p1 2048 133119 131072 64M 83 Linux
/dev/mmcblk1p2 133120 15269887 15136768 7.2G 83 Linux

Disk /dev/mmcblk1boot1: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mmcblk1boot0: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

 

fdisk /dev/mmcblk1

d,2

n,p,133120,+911360,y,w

dd if=DietPi_v6.0_NanoPiM3-ARMv7-Stretch.img of=/dev/mmcblk1 ibs=512 skip=2048 obs=512 seek=2048

 

backup the first 1024 sectors

dd if=/dev/mmcblk1 of=first2048.bin ibs=512 skip=0 obs=512 seek=0 count=2048

 

a quicker way to install into EMMC in future

dd if=DietPi_v6.0_NanoPiM3-ARMv7-Stretch.img of=/dev/mmcblk1 ibs=512 skip=2048 obs=512 seek=2048

dd if=first2048.bin of=/dev/mmcblk0 ibs=512 skip=0 obs=512 seek=0 count=2048

migrate svn to git

  1. use git client to check out svn repo
git svn clone http://svn/repo/here/trunk
 2. create git repo in server 
git add remote origin ssh://gitlab@10.2.12.1:2222/group/repo.git
git config remote.origin.push "refs/remotes/*:refs/heads/*"

3. push each branch to git server

 https://stackoverflow.com/questions/79165/how-do-i-migrate-an-svn-repository-with-history-to-a-new-git-repository

GetFullyQualifiedObjectName

BOOLEAN GetFullyQualifiedObjectName(IN PUNICODE_STRING i_pUsImageName,OUT
PUNICODE_STRING o_pUsFullImageName)
{
PFILE_OBJECT pFileObject = NULL;
PDEVICE_OBJECT pDeviceObject = NULL;
WCHAR wstrDeviceName[50+(sizeof(UNICODE_STRING)/sizeof(WCHAR))+1] = {0};
ULONG ResultLength = 0;
ULONG BufferLength = 0;
UNICODE_STRING usDeviceName;
NTSTATUS Status = STATUS_SUCCESS;
PDEVICE_EXTENSION deviceExtension = g_FilterCDO->DeviceExtension;

if(!i_pUsImageName || !o_pUsFullImageName)
return FALSE;

//Retrive File Object structure
pFileObject = CONTAINING_RECORD(i_pUsImageName,FILE_OBJECT,FileName);
if(!pFileObject)
return FALSE;

//Retrive Device Object structure
pDeviceObject = pFileObject->DeviceObject;
if(!pDeviceObject)
return FALSE;

//Leave Dlls which are not from File Disk or Network.
if( FILE_DEVICE_DISK != pDeviceObject->DeviceType &&
FILE_DEVICE_NETWORK_FILE_SYSTEM != pDeviceObject->DeviceType
)
return FALSE;

//Retrive Device name for File Disk Dlls.
if(FILE_DEVICE_DISK == pDeviceObject->DeviceType)
{
BufferLength = 50+(sizeof(UNICODE_STRING)/sizeof(WCHAR))+1;
Status = IoGetDeviceProperty( pDeviceObject,
DevicePropertyPhysicalDeviceObjectName ,
BufferLength,
wstrDeviceName,
&ResultLength);
if(STATUS_SUCCESS != Status)
return FALSE;

RtlInitUnicodeString(&usDeviceName,wstrDeviceName);
}
//Retrive Device name for Networks Dlls.
else if(FILE_DEVICE_NETWORK_FILE_SYSTEM == pDeviceObject->DeviceType)
{
if( deviceExtension->OsType == WINDOWS_VISTA || deviceExtension->OsType ==
WINDOWS_SERVER_2008 || deviceExtension->OsType == WINDOWS_7)
RtlInitUnicodeString(&usDeviceName, L”\\Device\\Mup”);
else
RtlInitUnicodeString(&usDeviceName, L”\\Device\\LanmanRedirector”);
}

//Prefix Device name to FullImage path.
//Path convert from Relative to Full.
o_pUsFullImageName->Length = usDeviceName.Length;
RtlCopyUnicodeString(o_pUsFullImageName,&usDeviceName);
RtlAppendUnicodeStringToString(o_pUsFullImageName,i_pUsImageName);

return TRUE;
}

 

https://www.osronline.com/showthread.cfm?link=186317