Git Product home page Git Product logo

Comments (6)

r0m30 avatar r0m30 commented on July 18, 2024

Thanks. I'm considering using buildroot to replace tinycore for the rescue system, right now I'm not exploiting it to it's fullest. I think that if I created a board or packages for the PBA's and sedutil I could do a complete and consistent build to avoid these types of issues.

Modifying the makefiles directly will not work, Netbeans will overwrite them on a whim. I'll have to modify the project properties in netbeans.

from sedutil.

juliandroid avatar juliandroid commented on July 18, 2024

Sure. I compile on the command line and that's why I'm patching the makefiles :)

from sedutil.

juliandroid avatar juliandroid commented on July 18, 2024

I'm facing similar problem, this time while booting from the shadow UEFI64 PBA.

/sbin/linuxpba: error while loading shared libraries: libncursesw.so.6: cannot open shared object file: No such file or directory

The first problem is that LinuxPBA depends on ncurses (-lcurses while linking) which probably is different version than the one available in syslinux.
The second problem is that my Arch Linux packages doesn't include statically linked ncurses, so I can't even statically link as I did for sedutil-cli. That makes building process for me blocker :(

from sedutil.

konstmonst avatar konstmonst commented on July 18, 2024

Here is a simplifed linux PBA with ncurses removed, which can be compiled staticly.
This one also properly enumerates avalible block devices. I am using getpass() so you can remove everything from GetPassPhrase.cpp. I refactored UnlockSEDs a bit so I can read it better.
Here is the code, feel free to use it under the License of this project.

main.cpp:
`
using namespace std;
#include <unistd.h>
#include <sys/reboot.h>
#include "log.h"
#include "UnlockSEDs.h"
#include <unistd.h>

int main(int argc, char** argv)
{
char* pw = getpass("Please enter pass-phrase to unlock OPAL drives: ");
if (pw)
{
if (UnlockSEDs(pw) == 0)
{
sync();
reboot(RB_AUTOBOOT);
return EXIT_SUCCESS;
}
}
return EXIT_FAILURE;
} `

UnlockSED.cpp:

`
#include "UnlockSEDs.h"
#include "DtaDevGeneric.h"
#include "DtaDevOpal1.h"
#include "DtaDevOpal2.h"
#include <unistd.h>
#include <dirent.h>
#include <stdio.h>

static int UnlockDevice(DtaDev& d, const char* devref, char* password)
{
d.no_hash_passwords = false;

printf("Unlocking %s\n", devref);
int result = -1;
if (d.MBREnabled())
{
    if (d.setMBRDone(1, password) == 0)
    {
        if (d.setLockingRange(0, OPAL_LOCKINGSTATE::READWRITE, password) == 0)
        {
            result = 0;
        }
        else
        {
            LOG(E) << "Unlock failed - unable to set LockingRange 0 RW";
        }
    }
    else
    {
        LOG(E) << "Unlock failed - unable to set MBRDone";
    }
}
else
{
    LOG(I) << "MBR not enabled";
    result = 0;
}

return result;

}

uint8_t UnlockSEDs(char * password)
{
int result = -1;

DIR* d;
struct dirent* dir;
d = opendir("/sys/block/");
if (d)
{
    LOG(D4) << "Enter UnlockSEDs";
    printf("Scanning...\n");

    while ((dir = readdir(d)) != NULL)
    {
        char devref[16];
        if (dir->d_name[0] != '.')
        {
            snprintf(devref, sizeof(devref), "/dev/%s", dir->d_name);
            DtaDevGeneric tempDev(devref);
            if (tempDev.isPresent())
            {
                if (tempDev.isOpal2())
                {
                    DtaDevOpal2 d(devref);
                    result = UnlockDevice(d, devref, password);
                }
                else if (tempDev.isOpal1())
                {
                    DtaDevOpal1 d(devref);
                    result =  UnlockDevice(d, devref, password);
                }
                else
                {
                    printf("Drive %s not supported\n", devref);
                }
            }
        }
    }
}

closedir(d);
return result;

}
`

from sedutil.

juliandroid avatar juliandroid commented on July 18, 2024

Thanks for sharing.
My current workaround is to compile the ncurses aside of the sedutil project and later modify the makefile to use the generated ncurses.a (object code archive file for static linking). That's way I have LinuxPBA and sedutil-cli statically linked, BUT that is just workaround, nothing more.

from sedutil.

r0m30 avatar r0m30 commented on July 18, 2024

This should be resolved with V1.15

from sedutil.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.