Ramdisk format errors

Ramdisk format errors

par Andrej Gorjan,
Nombre de réponses : 2


I am running into an unexpected problem when trying to boot Linux. The preloader and u-boot work as expected and I get the same output as the the one in the design guide right up until the "--- Booting Linux---" section of the script. I've attached the output I get on the terminal.

From the error messages, there is obviously something wrong with the zImage file, but after looking for solutions online for quite some time, I found nothing. I also can't really think of why it would go wrong, since it's built by the makefiles.

I double checked all parameters and commands needed to build the zImage file and also tried the latest commit in the repository but I got the same result.

Best regards,
Andrej Gorjan

En réponse à Andrej Gorjan

Re: Ramdisk format errors

par Clyde Laforge,

I found that the script does not exit on error, you can add the following snippet at the beginning of the script so that it does not continue in case of errors:

# exit when any command fails
set -e
# keep track of the last executed command
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
# echo an error message before exiting
trap 'echo "\"${last_command}\" command filed with exit code $?."' EXIT

Now the error you are probably facing is that compiling the zImage fails (the gcc compiler deprecated some features since the release of that kernel).
You can fix that by adding the keyword "extern" at line 41 of the file script/dtc/dtc-lexer.l and line 640 of script/dtc/dtc-lexer.l.c_shipped so that they are:
extern YYLTYPE yylloc;
Use the kernel commit provided by the guide. I wish we could use an updated version, but it's so easy to loose hours on that type of stuff.
I hope it helps

En réponse à Clyde Laforge

Re: Ramdisk format errors

par Andrej Gorjan,

Thank you for the advice, I appreciate it. I tried adding the commands to the script but got errors that they were not implemented. Looking at this document
https://www.digi.com/resources/documentation/digidocs/PDFs/90000852.pdf (page 9)
u-boot doesn't support the commands 'set' and 'trap'. I assumed that you were referring to the 'u-boot.script' file and not the 'config_system.sh' file, maybe this was my mistake.

I tried compiling zImage from the commit in the document and I added the 'extern' keyword to the two lines, but I got the same result as last time. You mentioned that the problem might be caused by errors when compiling zImage, and I do get these two

<stdin>:1310:2: warning: #warning syscall preadv2 not implemented [-Wcpp]
<stdin>:1313:2: warning: #warning syscall pwritev2 not implemented [-Wcpp]

But since they are warnings, I did not give them much thought and there were no other errors reported. But I do not see how this could cause a corrupted ramdisk.

Best regards,
Andrej Gorjan