Comments (6)
In the good case:
/run/test/temp/temp2/RomWBW$ find . | grep bios.bin
./Tools/Linux/bios.bin
./Tools/zxcc/bios.bin - is in git repo
./Tools/unix/zxcc/bios.bin
./Tools/unix/zxcc/cpm/bios.bin - is in git repo
./Source/pSys/bios.bin
In the bad case:
/tmp/RomWBW$ find . | grep bios.bin
./Tools/zxcc/bios.bin
./Tools/Linux/bios.bin
./Tools/unix/zxcc/cpm/bios.bin
./Tools/unix/zxcc/bios.bin
So it seems that ./Source/pSys/bios.bin
is missing at the point the build fails.
The error message Cannot locate bios.bin
comes from Tools/unix/zxcc.c:
void load_bios(void)
{
char dir[CPM_MAXPATH + 1], fname[CPM_MAXPATH + 1];
char* q;
size_t bios_len;
FILE* fp = fopen("bios.bin", "rb");
if (!fp)
{
strcpy(fname, bindir80);
strcat(fname, "bios.bin");
fp = fopen(fname, "rb");
}
if (!fp)
{
#ifdef _WIN32
dir[0] = 0; /* use strncat in case the path is very long */
strncat(dir, _pgmptr, CPM_MAXPATH - 8); /* copy the executable path */
#elif defined(__APPLE__)
uint32_t size = CPM_MAXPATH - 8;
_NSGetExecutablePath(dir, &size);
#else
readlink("/proc/self/exe", dir, CPM_MAXPATH - 8); /* allow room for bios.bin */
#endif
q = strrchr(dir, DIRSEPCH);
*++q = 0;
strcpy(fname, dir);
strcat(fname, "bios.bin");
fp = fopen(fname, "rb");
}
if (!fp)
{
fprintf(stderr, "%s: Cannot locate bios.bin\n", progname); <---- Appears to fail here
zxcc_term();
zxcc_exit(1);
}
bios_len = fread(RAM + 0xFE00, 1, 512, fp);
if (bios_len < 1 || ferror(fp))
{
fclose(fp);
fprintf(stderr, "%s: Cannot load bios.bin\n", progname);
zxcc_term();
zxcc_exit(1);
}
fclose(fp);
DBGMSGV("Loaded %d bytes of BIOS\n", bios_len);
}
from romwbw.
Modified zxcc.c to show the bios.bin path and filename:
https://github.com/skullandbones/RomWBW/tree/Issue-362_RPI4_no_bios.bin
Repeated a failed build and the reported path shows corruption in the path string:
make[3]: Leaving directory '/tmp/RomWBW/Source/Apps/Test'
+ make --directory ZMP
make[3]: Entering directory '/tmp/RomWBW/Source/Apps/ZMP'
../../../Tools/Linux/zxcc MLOAD25 -ZMP.COM=ZMPX.COM,ZMO-RW01
+ ../../../Tools/Linux/zxcc MLOAD25 -ZMP.COM=ZMPX.COM,ZMO-RW01
zxcc: Cannot locate /tmp/RomWBW/Tools/Linux/zxccV/bios.bin
make[3]: *** [Makefile:10: zmp.com] Error 1
make[3]: Leaving directory '/tmp/RomWBW/Source/Apps/ZMP'
make[2]: *** [../../Tools/Makefile.inc:136: all] Error 2
make[2]: Leaving directory '/tmp/RomWBW/Source/Apps'
make[1]: *** [../Tools/Makefile.inc:136: all] Error 2
make[1]: Leaving directory '/tmp/RomWBW/Source'
make: *** [Makefile:3: all] Error 2
The path string contains a "V" that should not be there.
from romwbw.
Wow, this is very odd. I admit that I did see this exact error once when I first tried an RPi build, but it disappeared after I ran the build again.
Nothing about the build has changed with respect to this. Also, I am not seeing this anywhere but Raspberry Pi. I don't see an obvious problem with the code. Can't imagine how the "V" got there.
The "bios.bin" in the pSys directory is produced by the build. It is not the same bios.bin as the others. It is not in GitHub and should not be. I think you see it in the successful builds because the build produced it.
I will take a look at this in more detail, but probably won't be able to get to it until Monday. Very busy weekend for me. If you have more time to play with this, it would be helpful to see the output of readlink before it is manipulated. It sort of looks like the readlink call is producing invalid results.
Thanks,
Wayne
from romwbw.
Had a few spare minutes and quickly looked up the documentation on readlink(). So... turns out that readlink() does NOT null terminate the resulting string. Basically, it is a miracle that this bug has not been encountered before. The fix is trivial; just need to null terminate the string using the length returned by the readlink() call.
I can take care of this in the next day or two.
Thanks,
Wayne
from romwbw.
@wwarthen I have created PR #363 based on your suggestion of adding a NUL termination to the dir string.
My testing on my RPi4 is now successful with no load bios.bin failures.
Please take a look at my PR and provide review comments. If you think the PR is good enough then please go-ahead and merge it.
Thanks,
Dean
from romwbw.
Hi @skullandbones,
Your PR was great and has been merged. I will be closing this issue now.
Thank you!
Wayne
from romwbw.
Related Issues (20)
- COPY.COM is in the CP/M 2.2 ROM but is missing from the CP/M 2.2 slice HOT 4
- I am working on Linux. Since Version 3.2.0 it is no longer working. First Problem is with zxcc. I am getting an error msg zxcc: Cannot locate bios.bin If I change to this path and do a make twice, it works. Second problem is it no longer generates die ROM-Images. It stops in HBIOS and asks for the he platform. I think there is a problem in the Build.sh which should call itself in a loop, but that doesn't work. HOT 5
- XMODEM issue with RC130 and versions after 3.0.1 HOT 2
- Typo in User Guide HOT 5
- Where to modify number of drives/slices for SD card HOT 3
- CLS returns capital H char on pigfx terminal HOT 8
- diskdefs and combo image HOT 4
- IM MODE 0,1 and 2 (and CTC) HOT 5
- DiskList.txt is missing from the Binary directory HOT 4
- How to modify the ROMDISK image HOT 3
- Doc Folder Minor Reorg (Trivial) HOT 7
- Microdrive detection timeout HOT 11
- eZ80 support HOT 25
- Minor Doc error in RomWBW ROM Applications HOT 2
- BEEP in HBIOS HOT 3
- Activity LED on always sc503 with 3.5.0-dev.52 HOT 5
- Support for Extreme Kits Pico SD IDE interface HOT 17
- Issue with SIO/2 with the Turbo CPU HOT 6
- Build Fail after FZ80 support added HOT 5
- CP/M 2.2 dir only shows one entry HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from romwbw.