Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GK710X Linux SDK ver. 2.0.0 #124

Open
paus56 opened this issue Jul 11, 2019 · 42 comments
Open

GK710X Linux SDK ver. 2.0.0 #124

paus56 opened this issue Jul 11, 2019 · 42 comments

Comments

@paus56
Copy link

paus56 commented Jul 11, 2019

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

This was referenced Jul 11, 2019
@alesimoes
Copy link

Thank you. where do you found that SDK?

@aalm
Copy link

aalm commented Nov 26, 2019

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

@biot
Copy link

biot commented Nov 26, 2019

@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...

@aalm
Copy link

aalm commented Nov 26, 2019

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

@biot
Copy link

biot commented Nov 26, 2019

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.

@aalm
Copy link

aalm commented Nov 26, 2019

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 :]

@biot
Copy link

biot commented Nov 26, 2019

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

@alesimoes
Copy link

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.

@biot
Copy link

biot commented Nov 27, 2019

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

@paus56
Copy link
Author

paus56 commented Nov 27, 2019

alesimoes

I'm creating a p2pcloud for those cameras.

лучше использовать портированную прошивку оттуда: #129

@alesimoes
Copy link

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?

@biot
Copy link

biot commented Nov 28, 2019

@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)?

@aalm
Copy link

aalm commented Nov 28, 2019

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.

@biot
Copy link

biot commented Nov 28, 2019

.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/

@aalm
Copy link

aalm commented Nov 28, 2019

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

@biot
Copy link

biot commented Nov 28, 2019

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.

@aalm
Copy link

aalm commented Nov 29, 2019

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.

@biot
Copy link

biot commented Nov 29, 2019

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?

@aalm
Copy link

aalm commented Nov 30, 2019

The camera i have is actually with GK7102S.

@biot
Copy link

biot commented Nov 30, 2019

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

@aalm
Copy link

aalm commented Dec 24, 2019

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

@biot
Copy link

biot commented Dec 24, 2019

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.

@aalm
Copy link

aalm commented Jan 7, 2020

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..

@innerfire3
Copy link

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.

@maartenjd
Copy link

[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

@aalm
Copy link

aalm commented Apr 12, 2020

[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
Copy link

aalm commented Apr 12, 2020

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.

@maartenjd
Copy link

maartenjd commented Apr 13, 2020

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

@kumarsanjeevdutt
Copy link

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

@csurf
Copy link

csurf commented Jun 7, 2021

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
Copy link

csurf commented Jun 8, 2021

@paus56 or anyone else,
could you please provide an updated download link for the 2.0.0 SDK?

@AngeloGomes
Copy link

Hi Guys, I´m trying to fix my cam. It seems to be in bootloop. After opening the case, I saw a Goke GK7101 chip and now I am trying to catch any info as much as possible. I noticed the SDK link is not working anymore. Can someone post a new link or share the SDK again. Thank you all.

@0zoon0
Copy link

0zoon0 commented Mar 18, 2022

Hi @paus56, could you please fix the download link? Thank you.

@paus56
Copy link
Author

paus56 commented Mar 19, 2022

Download SDK: https://disk.yandex.ru/d/oJJyHwfsp7bnKA

@sh4tteredd
Copy link

Hi you all, does anyone know if can I build rtsp/onvif for my GK7101S based cameras (netvue vigil 2)? thanks

i'm trying to use this sdk but idk how it works...

@csurf
Copy link

csurf commented Sep 4, 2022

Can someone please help me understand how to compile a complete firmware image that includes the u-boot bootloader?

I downloaded the SDK, ran make deploy and then make. The build seems to complete without any errors, but I don't see when or where the firmware image is created & stored. What make commands should I be running, and where is the built image stored?

Also, I've run into an issue where the only output on the serial console is UGKMC. In my case, the SPI flash chip on my camera died, and I was never able to get a full EEPROM backup (using 'ch341a' programmer). So, I replaced the flash chip & have tried flashing different images that I found on the 4pda.ru forum, but none of the images have worked. I'm guessing that none of these images include the bootloader, and so the GK7102 is unable to boot. Has anyone run into something like this?

Without a datasheet, it's extremely difficult to understand what's going on.

@csurf
Copy link

csurf commented Sep 8, 2022

@maartenjd

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.

Where or how did you do this? I couldn't find any Makefiles in the SDK that supported any type of make config or make menuconfig

@maartenjd
Copy link

@csurf
I gave up a long time ago so really don't remember anymore. When I have some time again, I will have a look. Sorry.

@csurf
Copy link

csurf commented Sep 14, 2022

@aalm can you please help me figure out how to compile u-boot for the GK7102? I'm struggling to figure out how to get a working bootloader built. My original SPI flash chip died, and I didn't have a backup, so I need to build u-boot from scratch & load the u-boot image onto my flash chip. I've tried multiple build options for u-boot, but the processor won't boot. I simply get 'UGKMC' output on the serial console (UART0).

@Wedmer
Copy link

Wedmer commented Sep 17, 2022

@csurf SDK creates uboot, kernel, and rootfs images. For the start you need to flash only uboot. Then get other parts via tftp and flash them via uboot.

@jhony251
Copy link

Hi friends!
this thread is for hacking cameras based on GK7101?
i cant understand all you have said.

I have others cams based on GK7102 and copying some files in SDCard all start to works.
could be possible to do something similar?

Thanks everyone.

@easycome1981
Copy link

Can someone help me with a .bin tab for my ST-291-2M-AI camera, it uses GK7102S sensor 2053
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests