zsgx1hacks icon indicating copy to clipboard operation
zsgx1hacks copied to clipboard

GK710X Linux SDK ver. 2.0.0

Open paus56 opened this issue 5 years ago • 42 comments

Linux SDK for our cameras on the GK710X

  • uBoot
  • kernel
  • Onvif
  • RTSP
  • PTZ
  • WEB
  • ...

GK710X_SDK_v2_01 GK710X_SDK_v2_04

Download the Linux SDK

paus56 avatar Jul 11 '19 17:07 paus56

Thank you. where do you found that SDK?

alesimoes avatar Jul 22 '19 06:07 alesimoes

Thanks, was good enough for me to build my own kernel w/builtin support for ext2, ext3 and ext4. I had setup root-on-NFS working before, and was really missing for this!

Now i still gotta figure out why i get "detect sflash fail" during boot + empty /proc/mtd with custom kernel, and then i think it's good enough to replace the one provided by vendor on flash.

ps. you can use GK710X_LinuxSDK_v2.0.0/linux/kernel/3.4.43/scripts/extract-ikconfig for dumping the kernel config from (iirc. likely) /dev/mtdblock2

aalm avatar Nov 26 '19 06:11 aalm

@aalm how did you manage to build a working kernel with that SDK? Mine hangs at boot, both with the Goke GCC and a regular one. Which GCC did you use?

This would really help me! I'm trying to get a mainline kernel running on the GK7101, documented here, and all help is welcome!

Incidentally @paus56 I would very much like to know how you got that SDK, and is there any more? An older version (to match what's on the camera), or a datasheet...

biot avatar Nov 26 '19 12:11 biot

GCC from the SDK did work for me, i'm using debian(i686/32bit) in a vm as my build host.

At which point does it exactly hang? Does it print anything? How are you loading it from u-boot?

i also have ip001_linux.rar[0] in which i haven't yet ran diff over to v2 SDK, but it does look very close to same, just stripped to include less than v2 SDK, and different set of old .configs. iirc. i found the link to it from 4pda.ru forums.

[0] sha256: 7B42BE862CF720788F9B8643249DAE7DFB4767DB2F1A39CEBF6E926492FF520E

aalm avatar Nov 26 '19 19:11 aalm

GCC from the SDK did work for me, i'm using debian(i686/32bit) in a vm as my build host.

I tried natively, and in a debian trusty VM but also 64 bit. I'll try a 32-bit VM.

At which point does it exactly hang? Does it print anything? How are you loading it from u-boot?

Just "Uncompressing Linux... done, booting the kernel.". That's the decompressor, using its own UART driver. No output from the actual kernel.

Loading it from U-Boot with "dhcp; bootm". Feeding it the stock kernel from the tftp server that way makes it boot, so the method is ok.

i also have ip001_linux.rar[0] in which i haven't yet ran diff over to v2 SDK, but it does look very close to same, just stripped to include less than v2 SDK, and different set of old .configs. iirc. i found the link to it from 4pda.ru forums.

Found it, thanks. Building that kernel within the SDK environment results in a kernel which hangs after the decompressor, exactly like the SDK kernel.

biot avatar Nov 26 '19 23:11 biot

Did you try with a .config as is extracted from your original vendor kernel?

iirc. both SDKs were preconfigured for "GK710XS", so i guess you you should atleast switch to "GK710X", if using the .config(s) those SDKs ship with.

oh, i only just now noticed the link to your blog, interesting :]

aalm avatar Nov 26 '19 23:11 aalm

Yes, did a manual config to GK7101 earlier, and tried with the extracted config from the booting kernel. The result was the same.

biot avatar Nov 26 '19 23:11 biot

Hi Bert, did you have tested the sample applications in your build? I trying to make the sample applications work using the kernel that come in the camera but not working. I'm creating a p2pcloud for those cameras.

alesimoes avatar Nov 26 '19 23:11 alesimoes

@alesimoes no, I'm only working on the kernel.

biot avatar Nov 27 '19 07:11 biot

alesimoes

I'm creating a p2pcloud for those cameras.

лучше использовать портированную прошивку оттуда: https://github.com/ant-thomas/zsgx1hacks/issues/129

paus56 avatar Nov 27 '19 17:11 paus56

Hi @paus56, I could see your posts in 4pda.ru and thanks for share the SDK. I'm able to build and write my application in camera but it is incompatible with adi lib. I think this SDK have an adi lib different of the cameras that I'm working on.

My cloud works with H264 baseline profile, but the firmware have the Main profile. do you know how can I solve this issue?

alesimoes avatar Nov 27 '19 18:11 alesimoes

@aalm still no luck with a 32-bit VM, but that was always voodoo :) Any chance I could get a custom kernel of yours to try? Also, can I have a copy of your VM (with any account of yours sanitized of course)?

biot avatar Nov 28 '19 09:11 biot

Sure, we can try something. I could start by compiling with your .config, if you share it via ie. http://ix.io or similar pastebin.

aalm avatar Nov 28 '19 11:11 aalm

.config extracted from vendor kernel on mtdblock2: https://paste.ubuntu.com/p/2CYG2R4sY4/ .config I made manually and tried with SDK build: https://paste.ubuntu.com/p/JQ3zZMkSCw/

biot avatar Nov 28 '19 11:11 biot

didn't figure out better way to share the zImage[0]. built the extracted .config(after make mrproper), and answered GK710X for the system(ARCH_), and "y" for the rest of new config options(minor differences between your&sdk option names).

[0] https://github.com/aalm/gk710x-tools/tree/zImage_v1

aalm avatar Nov 28 '19 17:11 aalm

Ok, that kernel also doesn't boot for me, hangs at the same point. Somehow my test platform doesn't like these... I do have some other GK710x gear, will try on those.

biot avatar Nov 28 '19 19:11 biot

I wonder if the v1 (or v1.1.2 w/e the previous SDK version was) would work for that SoC better.

fwiw., i found out that atleast for me, the ip001_linux.rar version is more correct one to use, as it has entry for "XM25QH64" in sflash_devices_supported.

aalm avatar Nov 29 '19 20:11 aalm

This SDK 2.0 is definitely ahead of what my hardware runs, I've found some differences in hardware writes and even hw_ops fields. Definitely would like to get my hands on an earlier SDK version.

Which GK7101 hardware are you using by the way?

biot avatar Nov 29 '19 21:11 biot

The camera i have is actually with GK7102S.

aalm avatar Nov 30 '19 08:11 aalm

Do you have a link to it? I might get one to try out.

biot avatar Nov 30 '19 08:11 biot

Do you have a link to it? I might get one to try out.

Missed your Q earlier; no, and unfortunately i wasn't able to find the product again.

But I just found something i think you might find interesting: https://github.com/RT-Thread/rt-thread/tree/master/bsp/gkipc/armv6

and there was more under ../bsp/gkipc/, but with a quick look it seems like above dir contains most of machdep bootstrap.

I hope you will continue your blog, it got me into trying out ghidra... i already knew about it, but oh wow, reversing something above the size of kernel... is actually fun with a tool like ghidra!!

i got a script for ghidra allowing saving modified bytes under selection back into the elf, which does work out-of-box for only raw/flat binaries. made ghidra more powerful for reversing/modifying the userland "firmware", but if someone will get things running with mainline, that might not be necessary in the end.

i've found enough "worth adapting" srcs w/reasonable licenses to cover most of the features these cameras have/could use.. Repo(or a fork of it) linked below might turn into a thing "hosting" such tools. https://github.com/bolshevik/goke-GK7102-customizer

aalm avatar Dec 24 '19 13:12 aalm

But I just found something i think you might find interesting: https://github.com/RT-Thread/rt-thread/tree/master/bsp/gkipc/armv6

and there was more under ../bsp/gkipc/, but with a quick look it seems like above dir contains most of machdep bootstrap.

That whole gkipc directory is specifically a port of RT-Thread to the Goke 710x platform (gkipc = Goke IP camera). It's easy to build, but... doesn't work. No interrupts. I've also ported ChibiOS to the gk7101, as it's small/easy to control. No interrupts. Nothing works :-(

i got a script for ghidra allowing saving modified bytes under selection back into the elf, which does work out-of-box for only raw/flat binaries. made ghidra more powerful for reversing/modifying the userland "firmware", but if someone will get things running with mainline, that might not be necessary in the end.

Yeah, I don't see serious problems on the userspace end, or even in porting kernel drivers (it's just a lot of work). But there's no way to even get started until I have a basic mainline kernel running, and that's where I'm stuck.

biot avatar Dec 24 '19 14:12 biot

Yeah, I don't see serious problems on the userspace end, or even in porting kernel drivers (it's just a lot of work). But there's no way to even get started until I have a basic mainline kernel running, and that's where I'm stuck.

my best guess atm. is, that you might be running into a situation possibly referred here. i mean, for using !"gk-sio" you'd want the "interrupt_may_hang=true" behaviour, which apparently doesn't exist by that name in mainline anymore, oh well. at least iirc. gk-sio appeared to have somewhat similar 'watchdog' for (these?) issues..

aalm avatar Jan 07 '20 19:01 aalm

Hello Everyone, Can someone help me to build own binaries compatible with this camera, I'm using this SDK but when I try to execute the file, I get segmentation failed.

innerfire3 avatar Jan 10 '20 08:01 innerfire3

[https://github.com/aalm]

Thanks, was good enough for me to build my own kernel w/builtin support for ext2, ext3 and ext4. I had setup root-on-NFS working before, and was really missing for this!

> Now i still gotta figure out why i get "detect sflash fail" during boot + empty /proc/mtd with custom

kernel, and then i think it's good enough to replace the one provided by vendor on flash.

ps. you can use GK710X_LinuxSDK_v2.0.0/linux/kernel/3.4.43/scripts/extract-ikconfig for dumping the kernel config from (iirc. likely) /dev/mtdblock2

[https://github.com/aalm] I managed to build a kernel using the 2.0.0 SDK and the .config extracted from my mtd2 but have the same error detect sflash fail and that is why the mtd-partitions are not initialized. Did you ever find out why this happens or manage to solve this issue? Thanks

maartenjd avatar Apr 12 '20 10:04 maartenjd

[https://github.com/aalm]

Thanks, was good enough for me to build my own kernel w/builtin support for ext2, ext3 and ext4. I had setup root-on-NFS working before, and was really missing for this!

> Now i still gotta figure out why i get "detect sflash fail" during boot + empty /proc/mtd with custom

kernel, and then i think it's good enough to replace the one provided by vendor on flash. ps. you can use GK710X_LinuxSDK_v2.0.0/linux/kernel/3.4.43/scripts/extract-ikconfig for dumping the kernel config from (iirc. likely) /dev/mtdblock2

[https://github.com/aalm] I managed to build a kernel using the 2.0.0 SDK and the .config extracted from my mtd2 but have the same error detect sflash fail and that is why the mtd-partitions are not initialized. Did you ever find out why this happens or manage to solve this issue? Thanks

sure, iirc. i took some sflash definitions from the ".rar sdk". i believe i've "documented" these changes somewhere, possibly linked to from here.

aalm avatar Apr 12 '20 14:04 aalm

as it has entry for "XM25QH64" in sflash_devices_supported.

hmm, didn't find more than the quote from above, but it should be enough for grep to find the .c-file from the SDK that needs editing for your device.

aalm avatar Apr 12 '20 14:04 aalm

as it has entry for "XM25QH64" in sflash_devices_supported.

hmm, didn't find more than the quote from above, but it should be enough for grep to find the .c-file from the SDK that needs editing for your device.

Set CONFIG_MTD_M25P80=y in .config.

Or do make menuconfig and go to Device Drivers > MTD Support > Self Contained MTD Device Drivers > Support most SPI Flash Chips (AT26DF, M25P, W25X, ...) and enable. And detect sflash fail is gone and mtd-partitions are properly created.

IMG_20200413_180124

maartenjd avatar Apr 13 '20 21:04 maartenjd

i am not able to find the PTZ folder in the SDK ,could you please help me where i can find that file and how do i add it to my demo application. Thank You

kumarsanjeevdutt avatar Sep 09 '20 09:09 kumarsanjeevdutt

Link to SDK download appears to be dead. I get 'invalid link code' message. Can someone pls provide a working link to download the SDK?

csurf avatar Jun 07 '21 17:06 csurf