Didnt found a way to use the script #4
-
Hello @0nelight , Thanks for contributing with this script. I have a macbook that has problems on RAM at 8.18GB (it has 16gb), but i coulnd find how to use your script on refind.config I`ve noticed that i need to compile te .C to .EFI, but then, what should i do? Please, can you help me? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 12 comments 5 replies
-
Hello,
Please read the rEFInd Documentation to learn how to boot into it. Then change the refind.config File so that the EFI-Script gets visible in the rEFInd Boot-Screen. Also very helpful to enable logging in rEFInd to see how it works and see possible Errors on accessing the Script. Can you please be more specific in what is your question? Maybe this helps also: You have to adjust the lines You can find out the exact area by booting and running a simple test with Memtest86+. In my case the defective area started at 12884901888 and was 40960 in size (see C-File). I never had the time to make this script more user friendly. Maybe I update it sometime so that it is possible to give the place and size of the defective area as a command line argument to the efi-script in refind. Then you compile this to a binary efi-file and run it with refind before you boot into macos (as a boot option in refind). So, do I understand it correctly you successfully compiled it and now you struggle with refind? You can put refind onto an usb-stick in an efi-partition und copy your compiled script (binary efi-file) into the same directory. When starting up you Macbook you can press-and-hold the Option-Key while pressing the power button on your macbook. Then you come into the Boot-Screen from Apple. On this screen you can now switch to the EFI-Partition on the USB-Stick. Could you please mention your exact device? I only tested this with MacBookPro Late 2013 - I don't now about newer devices. Happy to help :-) |
Beta Was this translation helpful? Give feedback.
-
I found out that rEFInd 14.2 only accepts EFI-Files with at least 4096 Bytes - the C-File currently compiles to slightly less than that and in case you turn logging on in rEFInd you will find a log entry saying "... is an invalid loader file". Workaround for now: |
Beta Was this translation helpful? Give feedback.
-
Hello @0nelight , First i wanna thank you for the quick reply. I got caught on a big problem and couldnt get back to you earlier. So, here`s my problem - I got a Macbook Pro 2019 16" i7 16gb A2141 that Memtest86+ informs that the RAM got problems at 8.18GB (Take a look at the image) I dont know how much RAM should i put in the .C script as Memtest86+ only shows me the 8.18GB number. Here in Brazil, i couldn't find anyone able to replace the RAM chips, and neither a new Logic Board. - My only option is Buy a refurbished Logic Board at AliExpress (and pay almost the price of a MB Air M1 2020) or, try your script to skip the RAM part that is Bad. I`ve already installed rEFIt on the Macbook, but idk how to compile your .C script, and how to use it with rEFIt. I know that you made the script just for your use case, but i would be very glad if you could help me on use it with my Macbook, please. Thanks, |
Beta Was this translation helpful? Give feedback.
-
Happy to help you out! So nice to hear you managed to run memtest86+ and are able to boot into refind. When reading the Documentation of memetest86 you will see that you can switch the configuration from "individual error" to "error summary". In "error summary" you will see the first and the last position of an error for your ram - exactly what we need. To save time, also consider running only one of the tests and turn off the others with the Option "Test Selection". https://memtest.org/readme#operation Could you please boot into memtest86+ then change the settings with pressing "F1" and run the test? Then you can write me the exact range. For compiling you only need a linux machine with the following installed:
and then go into the folder with the script and run to create the *.efi file:
But you could simply write the results from memtest86+ here and I can compile the script for you so you only have to deal with getting it into refind. As soon as we disabled the defective area with running the script within refind, we then can run memtest86+ again and then it shouldn't find any faulty ram anymore. After that we can go the final step and check if we can boot into macOs from within refind. I am working on a version of the script where compilation will not be necessary, instead it will be possible to put the faulty ram patterns in an non-binary nsh-script arguments 😀 |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
So according to what your memtest reports you have the following Situation:
So the the two changes to the code are: ...
EFI_PHYSICAL_ADDRESS Addr = 8757182632;
...
gBS -> AllocatePages(2, 8, 8201, & Addr);
... Regarding testing if this works - so as long as Apple follows the EFI 1.1 Standard (at least regarding memory allocation) this always works. Also you still have an Intel CPU in your Model so I am highly confident that this will work :-) For testing macbooks with intact RAM maybe we can go the other way around - simply marking areas which are good as bad ones and check whether memtest86 recognizes this. Also on the Apple-CPU Models this can be very interesting - but lets try your defective Intel-CPU model first 🙂 Also in newer models there can be Issues Apple Startup Security. But as far as I know, this can be also disabled in system settings so that the EFI Script works nevertheless. I will update you here with the compiled script later in the day! |
Beta Was this translation helpful? Give feedback.
-
First of all, thx for this beautiful work @0nelight keep it up! Im having the same problem, let me explain, i have a Macbook Air Early 2015 8GB with faulty RAM, memtest86+ showed 180+ errors than 78 the 2nd time i runned it, however im trying to compile the efi script for myself without any luck. Can you help me? Or can you compile it for me? Tried Windows 11, Debian on ARM and MacOS without any luck, i cant build it... huge thanks! (Adding a kernel panic and a memtest pic but im running it a third time following your istructions) |
Beta Was this translation helpful? Give feedback.
-
@0nelight i managed to boot a Ubuntu VM and compile the .C Script to a .EFI according to your instructions above. The file got 3.584 bytes. So, i`ve put the .efi file on /REFIND/EFI/BOOT/ and edited refind.conf to add the .efi entry: And then, booting rEFInd and selecting the new boot entry, i got: Do you know what i did wrong? Can you help me once again? Thanks, |
Beta Was this translation helpful? Give feedback.
-
I have to say that I am very beginner myself in C-Programming and Makefiles and EFI and so on. I try to solve the Issues with a lot of Willpower, Google and ChatGPT 😆. I released the EFI-File now here. I changed the Code now so that it doesn't need compilation anymore. You can simply load it with rEFInd with providing your defective RAM-Area within the refind.conf File. @daniel-nextgti At least the latest rEFInd Version doesn't seem to accept files smaller than 4KB (4096 Bytes). Back in the days I solved that with simply copying one of the print-messages 20+ times to get to a size. Sorry for any professionals reading this xD Cool that you managed to compile it :-) regarding your menuentry: I think specifying "Volume" is not necessary if your file is in the same Volume than rEFInd itself. Turning on the rEFInd Logfile is very helpful in getting a feeling of how it is working. @VincePuc99 Happy you also try to get it to work! Please refer to the latest Release-Notes! Please feel free to reach out and please update me here in case you are successfully running it! 😊 After running it, you get back to rEFInd Boot-Screen and there you can run memtest86+ again so you can verify that the RAM-Area is invisible to the System now. In case the scripts hangs at the beginning or the end of its short run, please upload a photo here. I got it working for me without hangs, but I don't know yet why. After that you should be able to choose the "Preboot" Option in rEFInd to boot into MacOS. |
Beta Was this translation helpful? Give feedback.
-
I'm glad to tell you that the script works. I had some problems setting the RAM-Area, since every time it has something besides numbers after the 0x, it gave me an error and different areas showed up in Memtest86. I dont know if the Low High results were wrong. Because of that, i`ve used 0x190000000 0x21000000 3000, isolating a bigger area, and bingo, zero errors in Memtest86. I just need to run the .EFI every time my computer turns on. Now, i`ve set the menuentry for the .EFI file as default, and gave a timeout of 2 seconds on boot. The problem is, after the .efi runs, it returns to rEFInd menu, and i have to manually select to Boot MacOS, or Exit the Bootloader so the boot process continues. Using Gemini and ChatGPT, it seems impossible to run a Shell Script to boot one menuentry after another automatically. Maybe inside the .efi is possible to call the next menuentry, or a specific one, this way, making the boot process streamlined. Do you have any idea if that is possible? |
Beta Was this translation helpful? Give feedback.
-
@daniel-nextgti Regarding implementing a complete automatic start of a Mac-Computer I just wrote a Discussions-Entry. |
Beta Was this translation helpful? Give feedback.
-
Good Morning, this is my current situation, efi loaded but im stuck in the booting process any help? Thanks! |
Beta Was this translation helpful? Give feedback.
I have to say that I am very beginner myself in C-Programming and Makefiles and EFI and so on. I try to solve the Issues with a lot of Willpower, Google and ChatGPT 😆.
I released the EFI-File now here.
I changed the Code now so that it doesn't need compilation anymore. You can simply load it with rEFInd with providing your defective RAM-Area within the refind.conf File.
@daniel-nextgti At least the latest rEFInd Version doesn't seem to accept files smaller than 4KB (4096 Bytes). Back in the days I solved that with simply copying one of the print-messages 20+ times to get to a size. Sorry for any professionals reading this xD Cool that you managed to compile it :-) regarding your menuentry…