LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Adding module in an unknown Linux Embedded (https://www.linuxquestions.org/questions/linux-newbie-8/adding-module-in-an-unknown-linux-embedded-4175651593/)

Armandooooo 04-06-2019 02:53 AM

Adding module in an unknown Linux Embedded
 
Dear all,

This is my first post ever in this forum, therefore sorry in advance for the mistake I can make.

I have a board that is equipped with a NXP3143 ARM9 processor, 32Mo of RAM (Winbond) and one Lattice FPGA chip (no idea what is it for).

It has a SD card where the Linux distribution is, a SATA to connect to a DVD drive, a USB port. This USB port is connected to a basic screen (4 inches, with 7 lines) with 3 buttons. The screen display some information about the application that is running and nothing else. The screen has another USB port where you can connect a hard drive.

I would like just to add another module to support a ethernet driver so I can plug in the USB port (instead of a drive) a USB to Ethernet adapter. There is already a driver but I would like to put another one.

The issue is I don't know what is the linux distribution used nor how to access the system through a command line.

The SD card is partitionned in 3 parts:
-the boot
-ext3 with only a few files (rwfs, rootfs and uImage, all of them without extension)
-fat32 empty

I have managed to install QEMU and I have been able to do 2 things:
-Run the ARM emulator (qemu-system-arm.exe -machine virt -kernel uImage -hda rootfs) - which basically does not show anything as there is no graphic adapter in the OS (embedded linux)
-Run the slitaz linux distribution mounting the SD card to see the content of the SD card in ext3 (which I cannot acces with Windows)

I am stuck here.
As far as I understand the file rootfs contains the file system while the uImage contains the kernel. Idon't know what is the rwfs at all.

Is there a way either to emulate the ARM9 and get a console to type a few command or extract the content of the rootfs or uImage to add the module inside somehow?

Thank you very much,
Armandooooo

rokytnji 04-07-2019 02:57 AM

Look up lsmod and modprobe I guess. I am not embedded linux arm system expert.

rokytnji 04-07-2019 03:06 AM

Also. Usually.

You can find info on linux version install inside the /etc folder.

like /etc/issue or just a quick looksee on how I look around

Code:

harry@biker:~
$ cd /etc
harry@biker:/etc
$ ls

after you hit the return/enter key after the "ls" command. A whole bunch of files will show.

to read contents of something. Example from my Linux Chromebook install

Code:

harry@biker:/etc
$ cat antix-version
antiX-17_x64-full Heather Heyer 24 October 2017
harry@biker:/etc
$ cat issue
Welcome to antiX. Powered by Debian.
harry@biker:/etc
$ cat debian_version
9.8
harry@biker:/etc


Armandooooo 04-07-2019 04:58 AM

Hi rokytnji,


Thank you for your answer. I would love to be able to type in commands, however this is my first blocking point.

The board has only a custom screen connected through USB where it is not meant to type in command lines. When I load the the images in QEMU I only have the monitor and the serial ports. There is no prompt coming, and I guess it is because it is not meant to display anything.


I have read it is possible to access the command line through the serial port, but I have had no luck with that so far. I heard about using ssh on the ethernet side but I do not what steps to do exactly. The monitor of QEMU gives me some information but as I am a newbie that is really hard.

I have search the -append command where apparently you can modify a little bit the way the kernel is set in order to make the serial port work. I tried also to find how to see the inside of the 2 files, maybe using another linux OS and mount something? I tried mount -o loop but failed everytime.

Any ways to understand what is this linux embedded version I have got would be really appreciated.

Thank you,
Armandooooo

Armandooooo 04-07-2019 05:05 AM

Hello rokytnji,

My main issue is actually to be able to access the command lines. The board does have a screen that is only there to display application related information and not system therefore no input commands is possible.

That is why I have used QEMU to see if would get an access to the command line somehow (but with no luck, nothing is getting displayed)
What I tried is using the -append command to make the command line available using the serial port which is not working either.

I have heard about using ssh on ethernet, but this is too technical for me at the moment.

Well this is where I am. Any luck to know more of what this linux version is and how to get to the command line would be good.

Do you know what is uImage?

Thank you,
Armandooooo

rokytnji 04-07-2019 02:36 PM

Shoot. Outa my league. I never used Qemu. Don't know about uImage

You are talking serial ports and being locked out. No usb port to tie in a laptop and use a live session off the laptop to get info:

like using the file manager to look in /boot folder in that embedded system.

which will show what kernel that thing is running. Probably ancient also. Which makes me wonder if adding a modern ethernet module will be even possible.

rokytnji 04-07-2019 02:41 PM

Disconnect the usb port to the screen. Connect a Linux laptop. Live session or what ever. Mount the board. Look inside using the usb port.

The laptop keyboard and screen are now your tools.

Armandooooo 04-10-2019 02:15 PM

Ok. I found out that the OS is based on u-boot. That is why the image name is called uImage.

I also found that mkimage is a tool part of u-boot and that it can extract information...

I need to install linux somewhere and meke u-boot tools... hard task for me

I will try.

Thank you.

Armandooooo 04-13-2019 04:03 AM

Ok, I have installed ubuntu, first time ever in Linux...

Installed the uboot tools and got mkimage up and running. I got the l command to see information from the rootfs.

Stuck there for the moment... I ll give more details later if anyone can help somehow.

Armand

fatmac 04-13-2019 07:13 AM

Quote:

The SD card is partitionned in 3 parts:
-the boot
-ext3 with only a few files (rwfs, rootfs and uImage, all of them without extension)
-fat32 empty
Those files are likely to be compressed archives that get extracted to ram when run.

Your boot partition may hold files relating to setting up the processor, as happens on my Raspberry Pi boards.

Ext3 will be your Linux file system.

Empty fat32, don't know, but could be your /home directory, mounted when the system is run.

If you can use a live distro, run the file program against those files to see what type of files they are.

You might be able to extract them, add what you want, & then recompress them.

Armandooooo 04-13-2019 08:39 AM

Hi Fatmac,

I have installed Ubuntu (first time ever). This is what I get when typing some commands.

armand@armand-NQ899AA-UUZ-p6024ch:~/Desktop/Xkey$ file rootfs
rootfs: data
armand@armand-NQ899AA-UUZ-p6024ch:~/Desktop/Xkey$ file uImage
uImage: data
armand@armand-NQ899AA-UUZ-p6024ch:~/Desktop/Xkey$ mkimage -l rootfs
Image Type: Freescale IMX Boot Image
Image Ver: 2 (i.MX53/6/7 compatible)
Mode: PLUGIN
Plugin Data Size: 302835498 Bytes = 295737.79 KiB = 288.81 MiB
Plugin Code Size: 0 Bytes = 0.00 KiB = 0.00 MiB
Plugin Load Address: 6c9053ca
Plugin Entry Point: 3533782f
U-Boot Data Size: 302835498 Bytes = 295737.79 KiB = 288.81 MiB
U-Boot Load Address: 6c9053ca
U-Boot Entry Point: 3533782f
armand@armand-NQ899AA-UUZ-p6024ch:~/Desktop/Xkey$ mkimage -l uImage
GP Header: Size 9411c123 LoadAddr 7f1c7cb5

Size is wrong by the way, the file is 40MB therefore might be compressed somehow.

Seems to be data, but the mkimage recognize the rootfs as boot image. I tried also binwalk who seems to be a great tool when analysing data to see what seems to be inside but no luck here:

armand@armand-NQ899AA-UUZ-p6024ch:~/Desktop/Xkey$ binwalk rootfs

DECIMAL HEXADECIMAL DESCRIPTION
--------------------------------------------------------------------------------

armand@armand-NQ899AA-UUZ-p6024ch:~/Desktop/Xkey$ binwalk uImage

DECIMAL HEXADECIMAL DESCRIPTION
--------------------------------------------------------------------------------

Armandooooo 04-13-2019 08:43 AM

Ahh, I am getting somewhere. I did binwalk into the entire SD card img and found this:

armand@armand-NQ899AA-UUZ-p6024ch:~/Desktop/Xkey$ binwalk XkeySDBackup.img

DECIMAL HEXADECIMAL DESCRIPTION
--------------------------------------------------------------------------------
2097152 0x200000 Linux EXT filesystem, rev 1.0, ext3 filesystem data, UUID=78683da7-e1eb-4354-913d-08514f434f43, volume name "ROOT"
2686976 0x290000 Linux EXT filesystem, rev 1.0, ext3 filesystem data, UUID=78683da7-e1eb-4354-913d-08514f434f43, volume name "ROOT"
2752512 0x2A0000 Linux EXT filesystem, rev 1.0, ext3 filesystem data, UUID=78683da7-e1eb-4354-913d-08514f434f43, volume name "ROOT"
2945024 0x2CF000 Linux EXT filesystem, rev 1.0, ext3 filesystem data, UUID=78683da7-e1eb-4354-913d-08514f434f43, volume name "ROOT"
2977792 0x2D7000 Linux EXT filesystem, rev 1.0, ext3 filesystem data, UUID=78683da7-e1eb-4354-913d-08514f434f43, volume name "ROOT"
94371840 0x5A00000 Linux EXT filesystem, rev 1.0, ext2 filesystem data (mounted or unclean), UUID=3a4a6a5a-a141-455a-9412-20599fb19fb1

need to figure out what's next...


All times are GMT -5. The time now is 05:05 AM.