cancel
Showing results for 
Search instead for 
Did you mean: 

Steps to configure a combined Vendor Defined HostID and Composite HostID on Linux

Steps to configure a combined Vendor Defined HostID and Composite HostID on Linux

Building a Vendor Defined Hostid:

1. Copy the file examples/vendor_hostid/vendor_hostid.c to your machind directory.

2. In machind directory, update lsvendor.c as follows:

2.1. After the comment /* Vendor initialization routines */ Add the following line:

void x_flexlm_newid();

2.2. update the line void (*ls_user_init1)() = 0 to void (*ls_user_init1)() = x_flexlm_newid;

3. In machind directory, update lmcrypt.c as follows:

After the call to lc_init, add the following line:

x_flexlm_newid();

That section of the code should resemble:

if (lc_init((LM_HANDLE *)0, VENDOR_NAME, &site_code, &lm_job))
{
lc_perror(lm_job, "lc_init failed");
exit(-1);
}
x_flexlm_newid();

4. In machind directory, update lmflex.c as follows:

After the call to lc_new_job, add the following line:

x_flexlm_newid();

That section should resemble:
if (lc_new_job(0, lc_new_job_arg2, &code, &lm_job))
{
lc_perror(lm_job, "lc_new_job failed");
exit(lc_get_errno(lm_job));
}
x_flexlm_newid();

5. In the platform directory, update makefile as follows:

5.1. In EXECS list add vendor_hostid.o i.e. the list should look like

EXECS = vendor_hostid.o lmcrypt lmflex

5.2. Add vendor_hostid.obj to the following sections as shown below:

$(DAEMON): $(XTRAOBJS) $(LIBS) $(SRCDIR)/lsserver.h $(SRCDIR)/lm_code.h lm_new.o
$(MAKE) lm_new.o
$(CC) -c $(CFLAGS_NO_PIE) $(CFLAGS) lsrvend.c
mv lsrvend.o lsvendor.o
rm -f lsrvend.c
$(CC) $(CFLAGS) $(LDFLAGS_NO_PIE) $(LDFLAGS) -o $(DAEMON) lsvendor.o lm_new.o vendor_hostid.o $(XTRAOBJS) \
$(LIBS) $(NO_PIE_ACTSTUB) $(XTRALIB) $(THREADLIB)
$(STRIP) $(DAEMON)
rm -f lm_new.o

lmcrypt: $(SRCDIR)/lmcrypt.c \
$(SRCDIR)/lmclient.h $(SRCDIR)/lm_code.h lmprikey.h $(CLIENTLIB)
$(CC) -c $(CFLAGS_PIE) $(CFLAGS) $(SRCDIR)/lmcrypt.c
$(CC) $(LDFLAGS_PIE) $(CFLAGS) $(LDFLAGS) -o lmcrypt lmcrypt.o vendor_hostid.o \
$(CLIENTLIB) $(ACTSTUB) $(XTRALIB) $(THREADLIB)
rm -f $(LM_NEW_OBJ)

lmflex: $(SRCDIR)/lmflex.c $(SRCDIR)/lm_code.h $(CLIENTLIB) $(LM_NEW_OBJ)
$(MAKE) $(LM_NEW_OBJ)
$(CC) -c $(CFLAGS_PIE) $(CFLAGS) $(SRCDIR)/lmflex.c
$(CC) $(CFLAGS) $(LDFLAGS_PIE) $(LDFLAGS) -o lmflex lmflex.o vendor_hostid.o $(LM_NEW_OBJ) $(CLIENTLIB) $(ACTSTUB) $(XTRALIB) \
$(THREADLIB)
rm lmflex.o
$(STRIP) lmflex
rm -f $(LM_NEW_OBJ)

5.3. Add the following after '$(DAEMON); section:

vendor_hostid.o: $(SRCDIR)/vendor_hostid.c
$(CC) -c $(CFLAGS) $(SRCDIR)/vendor_hostid.c

6. Build the toolkit: nmake -f makefile

Adding a Composite HostID to the build:

1. Copy the files lmcomposite.c and init_composite.c from examples\composite directory to your machind directory.

2. In machind directory, update lsvendor.c as follows:

2.1. After the comment /* Vendor initialization routines */ Add the following line: void init_composite_hostid();

2.2. Update the line void (*ls_user_init1)() = 0 to void (*ls_user_init2)() = init_composite_hostid;

3. In machind directory, update lmflex.c as follows:

3.1. In main function after the declaration int nlic=1; add the following declarartions:

int ret;
int hostid_list[] = {HOSTID_ETHER, HOSTID_DISK_SERIAL_NUM};
int hostid_list_count = 2;
int errno;

3.2. In main function, after the following piece of code

if (lc_new_job(0, lc_new_job_arg2, &code, &lm_job))
{
lc_perror(lm_job, "lc_new_job failed");
cleanup(initHandle);
exit(lc_get_errno(lm_job));
}

Add the following code:

ret = lc_init_simple_composite(lm_job, hostid_list, hostid_list_count);
if (ret != 0)
{
printf("Failed to init composite hostid. Errno: %d\n", errno);
lc_free_job(lm_job);
exit(0);
}

4. In the platform directory, update makefile as follows:

4.1. In EXECS list add lmcomposite and init_composite.o, i.e. the list should look like:

EXECS = lmcomposite init_composite.o vendor_hostid.o lmcrypt lmflex

4.2. Add init_composite.o to the following sections as shown below:

$(DAEMON): $(XTRAOBJS) $(LIBS) $(SRCDIR)/lsserver.h $(SRCDIR)/lm_code.h lm_new.o
$(MAKE) lm_new.o
$(CC) -c $(CFLAGS_NO_PIE) $(CFLAGS) lsrvend.c
mv lsrvend.o lsvendor.o
rm -f lsrvend.c
$(CC) $(CFLAGS) $(LDFLAGS_NO_PIE) $(LDFLAGS) -o $(DAEMON) lsvendor.o lm_new.o init_composite.o vendor_hostid.o $(XTRAOBJS) \
$(LIBS) $(NO_PIE_ACTSTUB) $(XTRALIB) $(THREADLIB)
$(STRIP) $(DAEMON

5. Add the following after '$(DAEMON); section:

init_composite.o: $(SRCDIR)/init_composite.c
$(CC) -c $(CFLAGS) $(SRCDIR)/init_composite.c

6. Before the definition of lmflex, add the following lines of code:

lmcomposite: $(SRCDIR)/lmcomposite.c $(SRCDIR)/lm_code.h $(CLIENTLIB) lm_new.o
$(MAKE) $(LM_NEW_OBJ)
$(CC) -c $(CFLAGS_PIE) $(CFLAGS) $(SRCDIR)/lmcomposite.c
$(CC) $(CFLAGS) $(LDFLAGS_PIE) $(LDFLAGS) -o lmcomposite lmcomposite.o $(LM_NEW_OBJ) $(CLIENTLIB) $(ACTSTUB) $(XTRALIB) $(THREADLIB)
rm -f lmcomposite.o
$(STRIP) lmcomposite

7. Build the toolkit: make -f makefile

 

 

Was this article helpful? Yes No
No ratings